diff --git a/ProjectLighthouse.Localization/Profile.resx b/ProjectLighthouse.Localization/Profile.resx index fb0fade3..f2b43522 100644 --- a/ProjectLighthouse.Localization/Profile.resx +++ b/ProjectLighthouse.Localization/Profile.resx @@ -27,4 +27,7 @@ {0}'s user page + + Profile Tag + \ No newline at end of file diff --git a/ProjectLighthouse.Localization/StringLists/ProfileStrings.cs b/ProjectLighthouse.Localization/StringLists/ProfileStrings.cs index 2c0c3879..73b3ae18 100644 --- a/ProjectLighthouse.Localization/StringLists/ProfileStrings.cs +++ b/ProjectLighthouse.Localization/StringLists/ProfileStrings.cs @@ -5,6 +5,7 @@ public static class ProfileStrings public static readonly TranslatableString Title = create("title"); public static readonly TranslatableString Biography = create("biography"); public static readonly TranslatableString NoBiography = create("no_biography"); + public static readonly TranslatableString ProfileTag = create("profile_tag"); private static TranslatableString create(string key) => new(TranslationAreas.Profile, key); } \ No newline at end of file diff --git a/ProjectLighthouse.Servers.Website/Extensions/FormattingExtensions.cs b/ProjectLighthouse.Servers.Website/Extensions/FormattingExtensions.cs index d33e2eae..3181e041 100644 --- a/ProjectLighthouse.Servers.Website/Extensions/FormattingExtensions.cs +++ b/ProjectLighthouse.Servers.Website/Extensions/FormattingExtensions.cs @@ -28,7 +28,7 @@ public static class FormattingExtensions return permissionLevel switch { PermissionLevel.Administrator => "red", - PermissionLevel.Moderator => "rgb(200, 130, 0)", + PermissionLevel.Moderator => "orange", _ => "", }; } diff --git a/ProjectLighthouse.Servers.Website/Pages/Partials/UserCardPartial.cshtml b/ProjectLighthouse.Servers.Website/Pages/Partials/UserCardPartial.cshtml index 429d239c..683c69c3 100644 --- a/ProjectLighthouse.Servers.Website/Pages/Partials/UserCardPartial.cshtml +++ b/ProjectLighthouse.Servers.Website/Pages/Partials/UserCardPartial.cshtml @@ -25,10 +25,16 @@ @Model.Username @if (Model.IsModerator) { - + @Model.PermissionLevel.ToString() } + @if (!string.IsNullOrWhiteSpace(Model.ProfileTag)) + { + + @Model.ProfileTag + + } } else @@ -37,10 +43,16 @@ @Model.Username @if (Model.IsModerator) { - + @Model.PermissionLevel.ToString() } + @if (!string.IsNullOrWhiteSpace(Model.ProfileTag)) + { + + @Model.ProfileTag + + } } @{ diff --git a/ProjectLighthouse.Servers.Website/Pages/UserSettingsPage.cshtml b/ProjectLighthouse.Servers.Website/Pages/UserSettingsPage.cshtml index c0242301..85fb155b 100644 --- a/ProjectLighthouse.Servers.Website/Pages/UserSettingsPage.cshtml +++ b/ProjectLighthouse.Servers.Website/Pages/UserSettingsPage.cshtml @@ -61,7 +61,7 @@ function onSubmit(e){
- +
@if (ServerConfiguration.Instance.Mail.MailEnabled && (Model.User == Model.ProfileUser || Model.User!.IsAdmin)) @@ -71,6 +71,16 @@ function onSubmit(e){ } +
+ + +
diff --git a/ProjectLighthouse.Servers.Website/Pages/UserSettingsPage.cshtml.cs b/ProjectLighthouse.Servers.Website/Pages/UserSettingsPage.cshtml.cs index 6c314136..066ca973 100644 --- a/ProjectLighthouse.Servers.Website/Pages/UserSettingsPage.cshtml.cs +++ b/ProjectLighthouse.Servers.Website/Pages/UserSettingsPage.cshtml.cs @@ -20,7 +20,17 @@ public class UserSettingsPage : BaseLayout {} [SuppressMessage("ReSharper", "SpecifyStringComparison")] - public async Task OnPost([FromRoute] int userId, [FromForm] string? avatar, [FromForm] string? username, [FromForm] string? email, [FromForm] string? biography, [FromForm] string? timeZone, [FromForm] string? language) + public async Task OnPost + ( + [FromRoute] int userId, + [FromForm] string? avatar, + [FromForm] string? username, + [FromForm] string? email, + [FromForm] string profileTag, + [FromForm] string? biography, + [FromForm] string? timeZone, + [FromForm] string? language + ) { this.ProfileUser = await this.Database.Users.FirstOrDefaultAsync(u => u.UserId == userId); if (this.ProfileUser == null) return this.NotFound(); @@ -33,6 +43,8 @@ public class UserSettingsPage : BaseLayout if (avatarHash != null) this.ProfileUser.IconHash = avatarHash; + if (this.User.IsAdmin) this.ProfileUser.ProfileTag = profileTag; + if (biography != null) { biography = CensorHelper.FilterMessage(biography); diff --git a/ProjectLighthouse/Migrations/20230827004014_AddProfileVanityTagsToUsers.cs b/ProjectLighthouse/Migrations/20230827004014_AddProfileVanityTagsToUsers.cs new file mode 100644 index 00000000..ed599e6b --- /dev/null +++ b/ProjectLighthouse/Migrations/20230827004014_AddProfileVanityTagsToUsers.cs @@ -0,0 +1,30 @@ +using LBPUnion.ProjectLighthouse.Database; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace ProjectLighthouse.Migrations +{ + [DbContext(typeof(DatabaseContext))] + [Migration("20230827004014_AddProfileVanityTagsToUsers")] + public partial class AddProfileVanityTagsToUsers : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "ProfileTag", + table: "Users", + type: "longtext", + nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "ProfileTag", + table: "Users"); + } + } +} diff --git a/ProjectLighthouse/ProjectLighthouse/Migrations/DatabaseModelSnapshot.cs b/ProjectLighthouse/ProjectLighthouse/Migrations/DatabaseModelSnapshot.cs index 386017f5..df977196 100644 --- a/ProjectLighthouse/ProjectLighthouse/Migrations/DatabaseModelSnapshot.cs +++ b/ProjectLighthouse/ProjectLighthouse/Migrations/DatabaseModelSnapshot.cs @@ -16,7 +16,7 @@ namespace ProjectLighthouse.Migrations { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("ProductVersion", "7.0.8") + .HasAnnotation("ProductVersion", "7.0.10") .HasAnnotation("Relational:MaxIdentifierLength", 64); modelBuilder.Entity("LBPUnion.ProjectLighthouse.Types.Entities.Interaction.HeartedLevelEntity", b => @@ -858,6 +858,9 @@ namespace ProjectLighthouse.Migrations b.Property("PlanetHashLBPVita") .HasColumnType("longtext"); + b.Property("ProfileTag") + .HasColumnType("longtext"); + b.Property("ProfileVisibility") .HasColumnType("int"); diff --git a/ProjectLighthouse/StaticFiles/css/styles.css b/ProjectLighthouse/StaticFiles/css/styles.css index 0f9aa846..e455fd39 100644 --- a/ProjectLighthouse/StaticFiles/css/styles.css +++ b/ProjectLighthouse/StaticFiles/css/styles.css @@ -244,19 +244,9 @@ div.cardStatsUnderTitle > span { /*#region User permission badge */ -.permissionBadge { - width: auto; - height: auto; - color: white; - background-color: inherit; - border: 0px solid black; - border-radius: 50px; - font-weight: 200; - font-size: 10pt; - padding: 1px; - padding-left: 6px; - padding-right: 6px; - vertical-align: top; +.profile-tag { + position: relative; + bottom: 0.45rem; } /*#endregion User permission badge */ \ No newline at end of file diff --git a/ProjectLighthouse/Types/Entities/Profile/UserEntity.cs b/ProjectLighthouse/Types/Entities/Profile/UserEntity.cs index d0a9f0fe..998c63b8 100644 --- a/ProjectLighthouse/Types/Entities/Profile/UserEntity.cs +++ b/ProjectLighthouse/Types/Entities/Profile/UserEntity.cs @@ -72,6 +72,7 @@ public class UserEntity public string PlanetHashLBP2 { get; set; } = ""; + // ReSharper disable once InconsistentNaming public string PlanetHashLBP2CC { get; set; } = ""; public string PlanetHashLBP3 { get; set; } = ""; @@ -130,6 +131,8 @@ public class UserEntity // should not be adjustable by user public bool CommentsEnabled { get; set; } = true; + + public string ProfileTag { get; set; } = ""; #nullable enable public override bool Equals(object? obj)