feat: allow staff members to see user's unlisted pastes; show dislikes in the paste lists

This commit is contained in:
2026-06-18 21:28:48 -04:00
parent d4976ac9aa
commit 6ed2974e42
4 changed files with 62 additions and 10 deletions
@@ -397,6 +397,8 @@ namespace SharpbinV3.Server.Controllers
Visibility = p.Visibility,
ExpiresAt = p.ExpiresAt,
EditedAt = p.EditedAt,
Likes = p.PositiveInteractionCount,
Dislikes = p.NegativeInteractionCount,
Author =
p.User != null && p.User.Visibility == 0
? new UserSimpleDto
@@ -285,6 +285,11 @@ namespace SharpbinV3.Server.Controllers
{
if (user.Visibility == Visibility.Private && !requesterIsStaff)
return NotFound();
if (requesterIsStaff)
pasteQuery = pasteQuery.Where(p => p.Visibility != Visibility.Private);
else if (user.Visibility == Visibility.Unlisted)
pasteQuery = pasteQuery.Where(p => p.Visibility != Visibility.Private);
else if (user.Visibility != Visibility.Unlisted)
pasteQuery = pasteQuery.Where(p => p.Visibility == Visibility.Public);
}
@@ -314,6 +319,8 @@ namespace SharpbinV3.Server.Controllers
Visibility = p.Visibility,
EditedAt = p.EditedAt,
ExpiresAt = p.ExpiresAt,
Likes = p.Interactions.Count(i => i.Type == Interaction.Positive),
Dislikes = p.Interactions.Count(i => i.Type == Interaction.Negative),
})
.ToListAsync();