[backend/masto-client] Don't require authentication for /accounts/{id}/statuses (ISH-688)

This commit is contained in:
Laura Hausmann 2025-01-21 21:31:38 +01:00
parent f32cd81ada
commit 013ed7380f
No known key found for this signature in database
GPG key ID: D044E84C5BE01605

View file

@ -173,7 +173,8 @@ public class AccountController(
[ProducesResults(HttpStatusCode.OK)]
[ProducesErrors(HttpStatusCode.Forbidden)]
public async Task<IEnumerable<AccountEntity>> GetManyUsers(
[FromQuery(Name = "id")] [MaxLength(40)] HashSet<string> ids
[FromQuery(Name = "id")] [MaxLength(40)]
HashSet<string> ids
)
{
var localUser = HttpContext.GetUser();
@ -392,7 +393,10 @@ public class AccountController(
string id, AccountSchemas.AccountStatusesRequest request, MastodonPaginationQuery query
)
{
var user = HttpContext.GetUserOrFail();
var user = HttpContext.GetUser();
if (config.Value.PublicPreview == Enums.PublicPreview.Lockdown && user == null)
throw GracefulException.Forbidden("Public preview is disabled on this instance");
var account = await db.Users.FirstOrDefaultAsync(p => p.Id == id) ?? throw GracefulException.RecordNotFound();
return await db.Notes