fix wrong actor usage

This commit is contained in:
Nicolas Constant 2020-07-22 02:03:52 -04:00
parent d91ddd4204
commit baf8cd011c
No known key found for this signature in database
GPG Key ID: 1E9F677FB01A5688
2 changed files with 11 additions and 10 deletions

View File

@ -18,7 +18,8 @@ namespace BirdsiteLive.Domain
public interface IUserService
{
Actor GetUser(TwitterUser twitterUser);
Note GetStatus(TwitterUser user, ITweet tweet);
//Note GetStatus(TwitterUser user, ITweet tweet);
Note GetStatus(string username, ITweet tweet);
Task<bool> FollowRequestedAsync(string signature, string method, string path, string queryString, Dictionary<string, string> requestHeaders, ActivityFollow activity);
Task<bool> UndoFollowRequestedAsync(string signature, string method, string path, string queryString, Dictionary<string, string> requestHeaders, ActivityUndoFollow activity);
}
@ -74,15 +75,15 @@ namespace BirdsiteLive.Domain
return user;
}
public Note GetStatus(TwitterUser user, ITweet tweet)
public Note GetStatus(string username, ITweet tweet)
{
var actor = GetUser(user);
//var actor = GetUser(user);
var actorUrl = $"{_host}/users/{user.Acct}";
var noteId = $"{_host}/users/{user.Acct}/statuses/{tweet.Id}";
var noteUrl = $"{_host}/@{user.Acct}/{tweet.Id}";
var actorUrl = $"{_host}/users/{username}";
var noteId = $"{_host}/users/{username}/statuses/{tweet.Id}";
var noteUrl = $"{_host}/@{username}/{tweet.Id}";
var to = $"{actor}/followers";
var to = $"{actorUrl}/followers";
var apPublic = "https://www.w3.org/ns/activitystreams#Public";
var note = new Note

View File

@ -59,10 +59,10 @@ namespace BirdsiteLive.Controllers
if (tweet == null)
return NotFound();
var user = _twitterService.GetUser(id);
if (user == null) return NotFound();
//var user = _twitterService.GetUser(id);
//if (user == null) return NotFound();
var status = _userService.GetStatus(user, tweet);
var status = _userService.GetStatus(id, tweet);
var jsonApUser = JsonConvert.SerializeObject(status);
return Content(jsonApUser, "application/activity+json; charset=utf-8");
}