Skip to content

Commit

Permalink
fix autowatch user setting, improve clarity and add explanations (#2023)
Browse files Browse the repository at this point in the history
  • Loading branch information
Masterjun3 authored Nov 2, 2024
1 parent 97e2860 commit 4427a1c
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 7 deletions.
9 changes: 6 additions & 3 deletions TASVideos/Pages/Forum/Posts/Create.cshtml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,13 @@ public async Task<IActionResult> 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)
Expand Down
9 changes: 6 additions & 3 deletions TASVideos/Pages/Forum/Topics/Create.cshtml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,13 @@ public async Task<IActionResult> 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)
Expand Down
9 changes: 8 additions & 1 deletion TASVideos/Pages/Profile/Settings.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,15 @@
</div>
</fieldset>
<fieldset>
<label asp-for="AutoWatchTopic">Automatically Watch Topics When Posting</label>
<label asp-for="AutoWatchTopic">Preselect "Watch Topic" When Posting</label>
<select asp-for="AutoWatchTopic" asp-items="@SettingsModel.AvailableUserPreferenceTypes"></select>
<small>
This setting affects how the "Watch Topic" checkbox will be preselected when creating a new Post or Topic.<br />
<strong>Auto:</strong> Keep the current Watch Topic setting.
<strong>Always:</strong> Always enable the checkbox.
<strong>Never:</strong> Always disable the checkbox.<br />
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.
</small>
</fieldset>
</column>
<column lg="6">
Expand Down

0 comments on commit 4427a1c

Please sign in to comment.