diff --git a/SharpbinV3.Server/Controllers/PasteController.cs b/SharpbinV3.Server/Controllers/PasteController.cs index 694cff3..fe11e0e 100644 --- a/SharpbinV3.Server/Controllers/PasteController.cs +++ b/SharpbinV3.Server/Controllers/PasteController.cs @@ -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 })); } diff --git a/SharpbinV3.Server/Services/AuthService.cs b/SharpbinV3.Server/Services/AuthService.cs index f5bef43..7a5b84d 100644 --- a/SharpbinV3.Server/Services/AuthService.cs +++ b/SharpbinV3.Server/Services/AuthService.cs @@ -53,13 +53,13 @@ namespace SharpbinV3.Server.Services var totpEnabled = await _db.UserTotps.AnyAsync(t => t.UserUUID == user.UUID); var claims = new List - { - 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) { diff --git a/SharpbinV3.Server/Services/PasteService.cs b/SharpbinV3.Server/Services/PasteService.cs index 4b98e8b..eb6929e 100644 --- a/SharpbinV3.Server/Services/PasteService.cs +++ b/SharpbinV3.Server/Services/PasteService.cs @@ -126,6 +126,7 @@ namespace SharpbinV3.Server.Services .OrderByDescending(p => p.PID) .Skip(offset) .Take(count) + .Include(p => p.User) .ToListAsync(); }