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.

[frontend/core] Add note toggle bookmark action

authored by

pancakes and committed by
Laura Hausmann
e2b43fd2 988d2561

+40
+6
Iceshrimp.Frontend/Core/ControllerModels/NoteControllerModel.cs
··· 34 34 public Task BiteNoteAsync(string id) => 35 35 api.CallAsync(HttpMethod.Post, $"/notes/{id}/bite"); 36 36 37 + public Task BookmarkNoteAsync(string id) => 38 + api.CallAsync(HttpMethod.Post, $"/notes/{id}/bookmark"); 39 + 40 + public Task UnbookmarkNoteAsync(string id) => 41 + api.CallAsync(HttpMethod.Post, $"/notes/{id}/unbookmark"); 42 + 37 43 public Task<ValueResponse?> LikeNoteAsync(string id) => 38 44 api.CallNullableAsync<ValueResponse>(HttpMethod.Post, $"/notes/{id}/like"); 39 45
+34
Iceshrimp.Frontend/Core/Services/NoteStore/NoteActions.cs
··· 52 52 } 53 53 } 54 54 55 + public async Task ToggleBookmarkAsync(NoteBase note) 56 + { 57 + if (note.Bookmarked) 58 + { 59 + try 60 + { 61 + note.Bookmarked = false; 62 + Broadcast(note); 63 + await api.Notes.UnbookmarkNoteAsync(note.Id); 64 + } 65 + catch (ApiException e) 66 + { 67 + logger.LogError(e, "Failed to unbookmark note"); 68 + note.Bookmarked = true; 69 + Broadcast(note); 70 + } 71 + } 72 + else 73 + { 74 + try 75 + { 76 + note.Bookmarked = true; 77 + Broadcast(note); 78 + await api.Notes.BookmarkNoteAsync(note.Id); 79 + } 80 + catch (ApiException e) 81 + { 82 + logger.LogError(e, "Failed to bookmark note"); 83 + note.Bookmarked = false; 84 + Broadcast(note); 85 + } 86 + } 87 + } 88 + 55 89 public async Task ToggleLikeAsync(NoteBase note) 56 90 { 57 91 if (note.Liked)