mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-08-01 09:48:37 +00:00
Implement profile and level privacy settings (#841)
* Create interactions management page and basic GET logic * Fix client side query and add blocked count as well as comments nitpick * Implement basic backend logic for interactions management * Remove errant null/whitespace checks and add border to blocked users partials * Implement user page's respect to profile privacy settings * Fix issue where user can't view their own profile if privacy settings are tightened * Fix other issues with profile access * Remove excess conditional expression from PSN privtype check * Check if access is allowed within request handler and hide bio/RA if private * Fix PSN privacy level check * Display private users in search and add base UI class to level lock icon * Rename everything from interactions to privacy for clarity * Dagg requested an eyeball Co-authored-by: vilijur <69403080+vilijur@users.noreply.github.com> * Clarify profile settings page title * Implement level privacy settings * Formatting nitpicks within UserPrivacyPage * Add discard changes buttons * Apply suggestion from code review * Consolidate privacy settings areas together * Grammar nitpick for comments enable/disable dropdown * Remove un-needed blue UI segment * Allow mods to issue disable comments case regardless of privacy settings Also addresses a few frontend and backend nitpicks left unaddressed by previous commits * Remove limiting AND operator expression * Grammar clarity on disable comments button * Add missing hidden button divider under Wipe Earth Decorations * No eyeball -m88youngling Removes eyeball from actual privacy settings page to match styling * Use long-text description for privacy type dropdowns * Use long-text description for comments toggle dropdown * Implement slot page privacy * Grammar nitpicks with Daggintosh * Daggintosh grammar review second edition * Once again put request handler arguments on one line * Rename LevelsPrivate variable to SlotsPrivate for internal consistency * Fix issue with PSN slot privacy type * Un-break comments * Apply most of the suggestions from code review * Correct form dropdown values for privacy types * Potentially fix broken privacy type extension * Slightly rework access calculation extension method * Fix issues with if statements * Apply suggestions from code review * Make everything translatable --------- Co-authored-by: vilijur <69403080+vilijur@users.noreply.github.com>
This commit is contained in:
parent
f084189a29
commit
6558d09c8d
16 changed files with 645 additions and 353 deletions
101
ProjectLighthouse.Servers.Website/Pages/UserPrivacyPage.cshtml
Normal file
101
ProjectLighthouse.Servers.Website/Pages/UserPrivacyPage.cshtml
Normal file
|
@ -0,0 +1,101 @@
|
|||
@page "/user/{userId:int}/privacy"
|
||||
@using LBPUnion.ProjectLighthouse.Extensions
|
||||
@using LBPUnion.ProjectLighthouse.Localization.StringLists
|
||||
@using LBPUnion.ProjectLighthouse.Types.Entities.Profile
|
||||
@using LBPUnion.ProjectLighthouse.Types.Users
|
||||
@model LBPUnion.ProjectLighthouse.Servers.Website.Pages.UserPrivacyPage
|
||||
|
||||
@{
|
||||
Layout = "Layouts/BaseLayout";
|
||||
Model.Title = Model.Translate(ProfileStrings.Title, Model.ProfileUser!.Username);
|
||||
Model.ShowTitleInPage = false;
|
||||
|
||||
bool isMobile = Request.IsMobile();
|
||||
}
|
||||
|
||||
<div class="@(isMobile ? "" : "ui left aligned grid")">
|
||||
<div class="column">
|
||||
<h1>@Model.ProfileUser.Username's Privacy Settings</h1>
|
||||
<form method="POST" class="ui form center aligned" action="/user/@Model.ProfileUser.UserId/privacy">
|
||||
@Html.AntiForgeryToken()
|
||||
<div class="ui yellow segment">
|
||||
<h2><i class="ui icon comment alternate"></i> Profile Privacy</h2>
|
||||
<div class="field">
|
||||
<label style="text-align: left" for="profilePrivacyLevel">Privacy Level</label>
|
||||
<select class="ui fluid dropdown" type="text" name="profilePrivacyLevel" id="profilePrivacyLevel">
|
||||
@foreach (PrivacyType type in Enum.GetValues(typeof(PrivacyType)))
|
||||
{
|
||||
<option value="@type.ToSerializedString()" @(Model.ProfileUser.ProfileVisibility == type ? "selected" : "")>
|
||||
@Model.Translate(type.ToReadableString(), "profile")
|
||||
</option>
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label style="text-align: left" for="profileCommentsEnabled">
|
||||
Comments
|
||||
@if (Model.CommentsDisabledByModerator)
|
||||
{
|
||||
<small class="ui red text">Locked by a moderator</small>
|
||||
}
|
||||
</label>
|
||||
<select class="ui fluid dropdown @(Model.CommentsDisabledByModerator ? "disabled" : "")" type="text" name="profileCommentsEnabled" id="profileCommentsEnabled">
|
||||
<option value="true" @(Model.ProfileUser.CommentsEnabled ? "selected" : "")>
|
||||
@Model.Translate(PrivacyStrings.EnableComments)
|
||||
</option>
|
||||
<option value="false" @(!Model.ProfileUser.CommentsEnabled ? "selected" : "")>
|
||||
@Model.Translate(PrivacyStrings.DisableComments)
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
<h2><i class="ui icon play"></i> Level Privacy</h2>
|
||||
<div class="field">
|
||||
<label style="text-align: left" for="slotPrivacyLevel">Privacy Level</label>
|
||||
<select class="ui fluid dropdown" type="text" name="slotPrivacyLevel" id="slotPrivacyLevel">
|
||||
@foreach (PrivacyType type in Enum.GetValues(typeof(PrivacyType)))
|
||||
{
|
||||
<option value="@type.ToSerializedString()" @(Model.ProfileUser.LevelVisibility == type ? "selected" : "")>
|
||||
@Model.Translate(type.ToReadableString(), "levels")
|
||||
</option>
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
<div class="ui divider"></div>
|
||||
<button type="submit" class="ui button green" tabindex="0">Save Changes</button>
|
||||
<a class="ui button red" href="/user/@Model.ProfileUser.UserId">Discard Changes</a>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<div class="ui red segment">
|
||||
<h2><i class="user alternate slash icon"></i> Blocked Users</h2>
|
||||
@if (Model.BlockedUsers.Count == 0)
|
||||
{
|
||||
<span>@Model.Translate(PrivacyStrings.NoBlockedUsers)</span>
|
||||
}
|
||||
else
|
||||
{
|
||||
<p>@Model.Translate(PrivacyStrings.BlockedUsers, Model.BlockedUsers.Count)</p>
|
||||
}
|
||||
@foreach (UserEntity user in Model.BlockedUsers)
|
||||
{
|
||||
<div class="ui segment">
|
||||
@await Html.PartialAsync("Partials/UserCardPartial", user, new ViewDataDictionary(ViewData)
|
||||
{
|
||||
{
|
||||
"ShowLink", true
|
||||
},
|
||||
{
|
||||
"IsMobile", isMobile
|
||||
},
|
||||
{
|
||||
"Language", Model.GetLanguage()
|
||||
},
|
||||
{
|
||||
"TimeZone", Model.GetTimeZone()
|
||||
},
|
||||
})
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
Loading…
Add table
Add a link
Reference in a new issue