UsersController optimisations

This commit is contained in:
Vincent Cloutier 2023-07-12 21:44:36 -04:00
parent 264320b1bf
commit 95eb63e502

View file

@ -158,7 +158,8 @@ namespace BirdsiteLive.Controllers
if (tweet == null) if (tweet == null)
return NotFound(); return NotFound();
var user = await _twitterUserService.GetUserAsync(id); if (tweet.Author.Acct != id)
return NotFound();
var status = _statusService.GetStatus(id, tweet); var status = _statusService.GetStatus(id, tweet);
@ -178,8 +179,8 @@ namespace BirdsiteLive.Controllers
{ {
Text = tweet.MessageContent, Text = tweet.MessageContent,
OgUrl = $"https://twitter.com/{id}/status/{statusId}", OgUrl = $"https://twitter.com/{id}/status/{statusId}",
UserProfileImage = user.ProfileImageUrl, UserProfileImage = tweet.Author.ProfileImageUrl,
UserName = user.Name, UserName = tweet.Author.Name,
}; };
return View(displayTweet); return View(displayTweet);
} }
@ -233,8 +234,6 @@ namespace BirdsiteLive.Controllers
if (tweet == null) if (tweet == null)
return NotFound(); return NotFound();
var user = await _twitterUserService.GetUserAsync(id);
var status = _statusService.GetActivity(id, tweet); var status = _statusService.GetActivity(id, tweet);
var jsonApUser = JsonSerializer.Serialize(status); var jsonApUser = JsonSerializer.Serialize(status);