[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; }
|
[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")]
|
[Authorize("write:favourites")]
|
||||||
[ProducesResponseType(StatusCodes.Status200OK, Type = typeof(StatusEntity))]
|
[ProducesResponseType(StatusCodes.Status200OK, Type = typeof(StatusEntity))]
|
||||||
[ProducesResponseType(StatusCodes.Status404NotFound, Type = typeof(MastodonErrorResponse))]
|
[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();
|
var user = HttpContext.GetUserOrFail();
|
||||||
if (!await db.Notes.AnyAsync(p => p.RenoteId == id && p.User == user && p.IsPureRenote))
|
if (!await db.Notes.AnyAsync(p => p.RenoteId == id && p.User == user && p.IsPureRenote))
|
||||||
|
@ -271,8 +271,8 @@ public class StatusController(
|
||||||
.FirstOrDefaultAsync() ??
|
.FirstOrDefaultAsync() ??
|
||||||
throw GracefulException.RecordNotFound();
|
throw GracefulException.RecordNotFound();
|
||||||
|
|
||||||
var renoteVisibility = visibility != null
|
var renoteVisibility = request?.Visibility != null
|
||||||
? StatusEntity.DecodeVisibility(visibility)
|
? StatusEntity.DecodeVisibility(request.Visibility)
|
||||||
: Note.NoteVisibility.Followers;
|
: Note.NoteVisibility.Followers;
|
||||||
|
|
||||||
if (renoteVisibility == Note.NoteVisibility.Specified)
|
if (renoteVisibility == Note.NoteVisibility.Specified)
|
||||||
|
|
Loading…
Add table
Reference in a new issue