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/web] Add setting for bite controls

pancakes cfdc5967 6e3a82f0

+34 -2
+17 -1
Iceshrimp.Backend/Controllers/Web/SettingsController.cs
··· 49 49 var settings = await GetOrInitUserSettings(); 50 50 var user = HttpContext.GetUserOrFail(); 51 51 52 + var canBite = user.CanBite switch 53 + { 54 + Core.Database.Tables.User.BiteControl.Public => BiteControl.Public, 55 + Core.Database.Tables.User.BiteControl.Followers => BiteControl.Followers, 56 + _ => BiteControl.None 57 + }; 58 + 52 59 return new UserSettingsResponse 53 60 { 54 61 FilterInaccessible = settings.FilterInaccessible, ··· 59 66 DefaultRenoteVisibility = (NoteVisibility)settings.DefaultNoteVisibility, 60 67 TwoFactorEnrolled = settings.TwoFactorEnabled, 61 68 ManuallyAcceptFollows = user.IsLocked, 62 - HideRepliesNotFollowing = settings.HideRepliesNotFollowing 69 + HideRepliesNotFollowing = settings.HideRepliesNotFollowing, 70 + CanBite = canBite 63 71 }; 64 72 } 65 73 ··· 89 97 await db.Users.Where(p => p.Id == user.Id) 90 98 .ExecuteUpdateAsync(p => p.SetProperty(u => u.IsLocked, 91 99 newSettings.ManuallyAcceptFollows || newSettings.PrivateMode)); 100 + 101 + await db.Users.Where(p => p.Id == user.Id) 102 + .ExecuteUpdateAsync(p => p.SetProperty(u => u.CanBite, newSettings.CanBite switch 103 + { 104 + BiteControl.Public => Core.Database.Tables.User.BiteControl.Public, 105 + BiteControl.Followers => Core.Database.Tables.User.BiteControl.Followers, 106 + _ => null 107 + })); 92 108 93 109 await db.SaveChangesAsync(); 94 110 }
+8
Iceshrimp.Frontend/Pages/Settings/Account.razor
··· 48 48 </InputSelect> 49 49 </label> 50 50 <label> 51 + @Loc["Allow bites from"] 52 + <InputSelect @bind-Value="SettingsForm.CanBite"> 53 + <option value="@BiteControl.Public">@Loc["Public"]</option> 54 + <option value="@BiteControl.Followers">@Loc["Followers"]</option> 55 + <option value="@BiteControl.None">@Loc["None"]</option> 56 + </InputSelect> 57 + </label> 58 + <label> 51 59 @Loc["Private Mode (Forces all posts from all clients to be followers only)"] 52 60 <InputCheckbox @bind-Value="SettingsForm.PrivateMode"/> 53 61 </label>
+9 -1
Iceshrimp.Shared/Schemas/Web/UserSettingsEntity.cs
··· 9 9 { 10 10 public NoteVisibility DefaultNoteVisibility { get; set; } 11 11 public NoteVisibility DefaultRenoteVisibility { get; set; } 12 + public BiteControl CanBite { get; set; } 12 13 13 14 /// <summary> 14 15 /// Overrides manually accept follow request to <c>true</c> and note/renote visibility to followers-only or lower. ··· 20 21 public bool AlwaysMarkSensitive { get; set; } 21 22 public bool ManuallyAcceptFollows { get; set; } 22 23 public bool HideRepliesNotFollowing { get; set; } 23 - } 24 + } 25 + 26 + public enum BiteControl 27 + { 28 + Public, 29 + Followers, 30 + None 31 + }