🐛 Fix get the posts repeatly
This commit is contained in:
@ -1,6 +1,4 @@
|
||||
using DysonNetwork.Sphere.Account;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using NodaTime;
|
||||
using NodaTime.Text;
|
||||
|
||||
@ -24,7 +22,8 @@ public class ActivityController(
|
||||
/// Besides, when users are logged in, it will also mix the other kinds of data and who're plying to them.
|
||||
/// </summary>
|
||||
[HttpGet]
|
||||
public async Task<ActionResult<List<Activity>>> ListActivities([FromQuery] string? cursor, [FromQuery] int take = 20)
|
||||
public async Task<ActionResult<List<Activity>>> ListActivities([FromQuery] string? cursor,
|
||||
[FromQuery] int take = 20)
|
||||
{
|
||||
Instant? cursorTimestamp = null;
|
||||
if (!string.IsNullOrEmpty(cursor))
|
||||
@ -41,9 +40,8 @@ public class ActivityController(
|
||||
|
||||
|
||||
HttpContext.Items.TryGetValue("CurrentUser", out var currentUserValue);
|
||||
if (currentUserValue is not Account.Account currentUser)
|
||||
return Ok(await acts.GetActivitiesForAnyone(take, cursorTimestamp));
|
||||
|
||||
return Ok(await acts.GetActivities(take, cursorTimestamp, currentUser));
|
||||
return currentUserValue is not Account.Account currentUser
|
||||
? Ok(await acts.GetActivitiesForAnyone(take, cursorTimestamp))
|
||||
: Ok(await acts.GetActivities(take, cursorTimestamp, currentUser));
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user