[backend/masto-client] Fix reblog with visibility
This commit is contained in:
parent
94ac11db88
commit
128b0182fd
2 changed files with 8 additions and 3 deletions
|
@ -94,4 +94,9 @@ public abstract class StatusSchemas
|
|||
{
|
||||
[JR] [J("id")] [B(Name = "id")] public required string Id { get; set; }
|
||||
}
|
||||
|
||||
public class ReblogRequest
|
||||
{
|
||||
[B(Name = "visibility")] [J("visibility")] public string? Visibility { get; set; }
|
||||
}
|
||||
}
|
|
@ -259,7 +259,7 @@ public class StatusController(
|
|||
[Authorize("write:favourites")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK, Type = typeof(StatusEntity))]
|
||||
[ProducesResponseType(StatusCodes.Status404NotFound, Type = typeof(MastodonErrorResponse))]
|
||||
public async Task<IActionResult> Renote(string id, [FromHybrid] string? visibility)
|
||||
public async Task<IActionResult> Renote(string id, [FromHybrid] StatusSchemas.ReblogRequest? request)
|
||||
{
|
||||
var user = HttpContext.GetUserOrFail();
|
||||
if (!await db.Notes.AnyAsync(p => p.RenoteId == id && p.User == user && p.IsPureRenote))
|
||||
|
@ -271,8 +271,8 @@ public class StatusController(
|
|||
.FirstOrDefaultAsync() ??
|
||||
throw GracefulException.RecordNotFound();
|
||||
|
||||
var renoteVisibility = visibility != null
|
||||
? StatusEntity.DecodeVisibility(visibility)
|
||||
var renoteVisibility = request?.Visibility != null
|
||||
? StatusEntity.DecodeVisibility(request.Visibility)
|
||||
: Note.NoteVisibility.Followers;
|
||||
|
||||
if (renoteVisibility == Note.NoteVisibility.Specified)
|
||||
|
|
Loading…
Add table
Reference in a new issue