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/components] Add action to pin and unpin notes

authored by

pancakes and committed by
Iceshrimp development
8fd50f24 8729063b

+51
+11
Iceshrimp.Frontend/Components/Note/NoteFooter.razor
··· 112 112 <MenuElement Icon="Icons.BookmarkSimple" OnSelect="Bookmark"> 113 113 <Text>@(Note.Bookmarked ? Loc["Remove bookmark"] : Loc["Add bookmark"])</Text> 114 114 </MenuElement> 115 + @if (Note.User.Id == Session.Current?.Id) 116 + { 117 + <MenuElement Icon="@(Note.Pinned ? Icons.PushPinSlash : Icons.PushPin)" OnSelect="Pin"> 118 + <Text>@(Note.Pinned ? Loc["Unpin from profile"] : Loc["Pin to profile"])</Text> 119 + </MenuElement> 120 + } 115 121 <MenuElement Icon="Icons.SpeakerX" OnSelect="Mute"> 116 122 <Text>@Loc["Mute thread"]</Text> 117 123 </MenuElement> ··· 197 203 private void Bookmark() 198 204 { 199 205 _ = NoteActions.ToggleBookmarkAsync(Note); 206 + } 207 + 208 + private void Pin() 209 + { 210 + _ = NoteActions.TogglePinnedAsync(Note); 200 211 } 201 212 202 213 private void Like()
+6
Iceshrimp.Frontend/Core/ControllerModels/NoteControllerModel.cs
··· 40 40 public Task UnbookmarkNoteAsync(string id) => 41 41 api.CallAsync(HttpMethod.Post, $"/notes/{id}/unbookmark"); 42 42 43 + public Task PinNoteAsync(string id) => 44 + api.CallAsync(HttpMethod.Post, $"/notes/{id}/pin"); 45 + 46 + public Task UnpinNoteAsync(string id) => 47 + api.CallAsync(HttpMethod.Post, $"/notes/{id}/unpin"); 48 + 43 49 public Task<ValueResponse?> LikeNoteAsync(string id) => 44 50 api.CallNullableAsync<ValueResponse>(HttpMethod.Post, $"/notes/{id}/like"); 45 51
+34
Iceshrimp.Frontend/Core/Services/NoteStore/NoteActions.cs
··· 87 87 } 88 88 } 89 89 90 + public async Task TogglePinnedAsync(NoteBase note) 91 + { 92 + if (note.Pinned) 93 + { 94 + try 95 + { 96 + note.Pinned = false; 97 + Broadcast(note); 98 + await api.Notes.UnpinNoteAsync(note.Id); 99 + } 100 + catch (ApiException e) 101 + { 102 + logger.LogError(e, "Failed to unpin note"); 103 + note.Pinned = true; 104 + Broadcast(note); 105 + } 106 + } 107 + else 108 + { 109 + try 110 + { 111 + note.Pinned = true; 112 + Broadcast(note); 113 + await api.Notes.PinNoteAsync(note.Id); 114 + } 115 + catch (ApiException e) 116 + { 117 + logger.LogError(e, "Failed to pin note"); 118 + note.Pinned = false; 119 + Broadcast(note); 120 + } 121 + } 122 + } 123 + 90 124 public async Task ToggleLikeAsync(NoteBase note) 91 125 { 92 126 if (note.Liked)