mirror of
https://github.com/whoswhip/Sharpbin.git
synced 2026-12-06 02:48:43 +00:00
fix: include author data in recent paste data
This commit is contained in:
@@ -394,7 +394,16 @@ namespace SharpbinV3.Server.Controllers
|
|||||||
Syntax = p.Syntax,
|
Syntax = p.Syntax,
|
||||||
Visibility = p.Visibility,
|
Visibility = p.Visibility,
|
||||||
ExpiresAt = p.ExpiresAt,
|
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
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -53,13 +53,13 @@ namespace SharpbinV3.Server.Services
|
|||||||
|
|
||||||
var totpEnabled = await _db.UserTotps.AnyAsync(t => t.UserUUID == user.UUID);
|
var totpEnabled = await _db.UserTotps.AnyAsync(t => t.UserUUID == user.UUID);
|
||||||
var claims = new List<Claim>
|
var claims = new List<Claim>
|
||||||
{
|
{
|
||||||
new("uuid", user.UUID.ToString()),
|
new("uuid", user.UUID.ToString()),
|
||||||
new("username", user.Username),
|
new("username", user.Username),
|
||||||
new("displayname", user.DisplayName ?? ""),
|
new("displayname", user.DisplayName ?? ""),
|
||||||
new("totp_enabled", totpEnabled.ToString()),
|
new("totp_enabled", totpEnabled.ToString()),
|
||||||
new(JwtRegisteredClaimNames.Jti, Guid.NewGuid().ToString())
|
new(JwtRegisteredClaimNames.Jti, Guid.NewGuid().ToString())
|
||||||
};
|
};
|
||||||
|
|
||||||
if (user.Roles != null)
|
if (user.Roles != null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -126,6 +126,7 @@ namespace SharpbinV3.Server.Services
|
|||||||
.OrderByDescending(p => p.PID)
|
.OrderByDescending(p => p.PID)
|
||||||
.Skip(offset)
|
.Skip(offset)
|
||||||
.Take(count)
|
.Take(count)
|
||||||
|
.Include(p => p.User)
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user