fix: include author data in recent paste data

This commit is contained in:
2026-01-25 09:41:59 -05:00
parent 51449abe6e
commit c9aa0d9a16
3 changed files with 18 additions and 8 deletions
@@ -394,7 +394,16 @@ namespace SharpbinV3.Server.Controllers
Syntax = p.Syntax,
Visibility = p.Visibility,
ExpiresAt = p.ExpiresAt,
EditedAt = p.EditedAt
EditedAt = p.EditedAt,
Author = p.User != null && p.User.Visibility == 0 ? new UserSimpleDto
{
UID = p.User.UID,
UUID = p.User.UUID,
Username = p.User.Username,
DisplayName = p.User.DisplayName,
Visibility = p.User.Visibility,
Roles = p.User.Roles
} : null
}));
}
+7 -7
View File
@@ -53,13 +53,13 @@ namespace SharpbinV3.Server.Services
var totpEnabled = await _db.UserTotps.AnyAsync(t => t.UserUUID == user.UUID);
var claims = new List<Claim>
{
new("uuid", user.UUID.ToString()),
new("username", user.Username),
new("displayname", user.DisplayName ?? ""),
new("totp_enabled", totpEnabled.ToString()),
new(JwtRegisteredClaimNames.Jti, Guid.NewGuid().ToString())
};
{
new("uuid", user.UUID.ToString()),
new("username", user.Username),
new("displayname", user.DisplayName ?? ""),
new("totp_enabled", totpEnabled.ToString()),
new(JwtRegisteredClaimNames.Jti, Guid.NewGuid().ToString())
};
if (user.Roles != null)
{
@@ -126,6 +126,7 @@ namespace SharpbinV3.Server.Services
.OrderByDescending(p => p.PID)
.Skip(offset)
.Take(count)
.Include(p => p.User)
.ToListAsync();
}