[backend/masto-client] Reblog endpoint should be idempotent
This commit is contained in:
parent
e14686ea8c
commit
780ffa076d
1 changed files with 10 additions and 6 deletions
|
@ -129,6 +129,8 @@ public class StatusController(
|
||||||
public async Task<IActionResult> Renote(string id)
|
public async Task<IActionResult> Renote(string id)
|
||||||
{
|
{
|
||||||
var user = HttpContext.GetUserOrFail();
|
var user = HttpContext.GetUserOrFail();
|
||||||
|
if (!await db.Notes.AnyAsync(p => p.RenoteId == id && p.User == user && p.IsPureRenote))
|
||||||
|
{
|
||||||
var note = await db.Notes.Where(p => p.Id == id)
|
var note = await db.Notes.Where(p => p.Id == id)
|
||||||
.IncludeCommonProperties()
|
.IncludeCommonProperties()
|
||||||
.EnsureVisibleFor(user)
|
.EnsureVisibleFor(user)
|
||||||
|
@ -136,6 +138,8 @@ public class StatusController(
|
||||||
throw GracefulException.RecordNotFound();
|
throw GracefulException.RecordNotFound();
|
||||||
|
|
||||||
await noteSvc.CreateNoteAsync(user, Note.NoteVisibility.Followers, renote: note);
|
await noteSvc.CreateNoteAsync(user, Note.NoteVisibility.Followers, renote: note);
|
||||||
|
}
|
||||||
|
|
||||||
return await GetNote(id);
|
return await GetNote(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue