From 4427a1c86210250b9661b215bdc5e4322791c7c5 Mon Sep 17 00:00:00 2001 From: Masterjun Date: Sat, 2 Nov 2024 16:41:03 +0100 Subject: [PATCH] fix autowatch user setting, improve clarity and add explanations (#2023) --- TASVideos/Pages/Forum/Posts/Create.cshtml.cs | 9 ++++++--- TASVideos/Pages/Forum/Topics/Create.cshtml.cs | 9 ++++++--- TASVideos/Pages/Profile/Settings.cshtml | 9 ++++++++- 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/TASVideos/Pages/Forum/Posts/Create.cshtml.cs b/TASVideos/Pages/Forum/Posts/Create.cshtml.cs index ef20fbd1d..f42d44e50 100644 --- a/TASVideos/Pages/Forum/Posts/Create.cshtml.cs +++ b/TASVideos/Pages/Forum/Posts/Create.cshtml.cs @@ -75,10 +75,13 @@ public async Task OnGet() WatchTopic = await topicWatcher.IsWatchingTopic(TopicId, User.GetUserId()); var user = await userManager.GetRequiredUser(User); - if (user.AutoWatchTopic == UserPreference.Always) + WatchTopic = user.AutoWatchTopic switch { - WatchTopic = true; - } + UserPreference.Auto => WatchTopic, + UserPreference.Always => true, + UserPreference.Never => false, + _ => WatchTopic, + }; PreviousPosts = await db.ForumPosts .ForTopic(TopicId) diff --git a/TASVideos/Pages/Forum/Topics/Create.cshtml.cs b/TASVideos/Pages/Forum/Topics/Create.cshtml.cs index 75177561d..8201ca690 100644 --- a/TASVideos/Pages/Forum/Topics/Create.cshtml.cs +++ b/TASVideos/Pages/Forum/Topics/Create.cshtml.cs @@ -62,10 +62,13 @@ public async Task OnGet() UserAvatars = await forumService.UserAvatars(User.GetUserId()); var user = await userManager.GetRequiredUser(User); - if (user.AutoWatchTopic == UserPreference.Always) + WatchTopic = user.AutoWatchTopic switch { - WatchTopic = true; - } + UserPreference.Auto => true, + UserPreference.Always => true, + UserPreference.Never => false, + _ => true, + }; BackupSubmissionDeterminator = (await db.ForumTopics .ForForum(ForumId) diff --git a/TASVideos/Pages/Profile/Settings.cshtml b/TASVideos/Pages/Profile/Settings.cshtml index 44a6f5d27..212b7da4e 100644 --- a/TASVideos/Pages/Profile/Settings.cshtml +++ b/TASVideos/Pages/Profile/Settings.cshtml @@ -65,8 +65,15 @@
- + + + This setting affects how the "Watch Topic" checkbox will be preselected when creating a new Post or Topic.
+ Auto: Keep the current Watch Topic setting. + Always: Always enable the checkbox. + Never: Always disable the checkbox.
+ Note that this is only a preselect. No matter what you choose here, you can always override it manually when creating a new Post or Topic. +