a fork of iceshrimp.net but a tweaked frontend to my personal liking. waow
fediverse social-media social iceshrimp fedi
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

[backend/api] Add endpoints to bookmark and unbookmark a note

authored by

pancakes and committed by
Laura Hausmann
1ac4e428 151f1140

+36
+36
Iceshrimp.Backend/Controllers/Web/NoteController.cs
··· 191 191 await biteSvc.BiteAsync(user, target); 192 192 } 193 193 194 + [HttpPost("{id}/bookmark")] 195 + [Authenticate] 196 + [Authorize] 197 + [ProducesResults(HttpStatusCode.OK)] 198 + [ProducesErrors(HttpStatusCode.NotFound)] 199 + public async Task BookmarkNote(string id) 200 + { 201 + var user = HttpContext.GetUserOrFail(); 202 + var note = await db.Notes 203 + .Where(p => p.Id == id) 204 + .IncludeCommonProperties() 205 + .EnsureVisibleFor(user) 206 + .FirstOrDefaultAsync() ?? 207 + throw GracefulException.NotFound("Note not found"); 208 + 209 + await noteSvc.BookmarkNoteAsync(note, user); 210 + } 211 + 212 + [HttpPost("{id}/unbookmark")] 213 + [Authenticate] 214 + [Authorize] 215 + [ProducesResults(HttpStatusCode.OK)] 216 + [ProducesErrors(HttpStatusCode.NotFound)] 217 + public async Task UnbookmarkNote(string id) 218 + { 219 + var user = HttpContext.GetUserOrFail(); 220 + var note = await db.Notes 221 + .Where(p => p.Id == id) 222 + .IncludeCommonProperties() 223 + .EnsureVisibleFor(user) 224 + .FirstOrDefaultAsync() ?? 225 + throw GracefulException.NotFound("Note not found"); 226 + 227 + await noteSvc.UnbookmarkNoteAsync(note, user); 228 + } 229 + 194 230 [HttpPost("{id}/like")] 195 231 [Authenticate] 196 232 [Authorize]