Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix autowatch user setting logic and add explanations #2023

Merged
merged 1 commit into from
Nov 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading