DEV: use hidden site_setting prioritize_full_name_in_ux instead of prioritize_username_in_ux

This commit is contained in:
marstall
2025-01-21 17:20:09 -05:00
parent d971f2ca19
commit eeb462ad0d
8 changed files with 14 additions and 11 deletions

View File

@@ -79,7 +79,7 @@ export default class UserMenuMessagesList extends UserMenuNotificationsList {
if (
this.siteSettings.show_user_menu_avatars ||
!this.siteSettings.prioritize_username_in_ux
this.siteSettings.prioritize_full_name_in_ux
) {
// Populate avatar_template for lastPoster
const usersById = new Map(data.users.map((u) => [u.id, u]));

View File

@@ -73,7 +73,7 @@ export default class NotificationTypeBase {
* @returns {string} The label is the first part of the text content displayed in the notification. For example, in a like notification, the username of the user who liked the post is the label. If a falsey value is returned, the label is omitted.
*/
get label() {
if (this.siteSettings.prioritize_username_in_ux) {
if (!this.siteSettings.prioritize_full_name_in_ux) {
return this.username;
}

View File

@@ -24,7 +24,7 @@ export default class UserMenuBookmarkItem extends UserMenuBaseItem {
}
get label() {
if (this.siteSettings.prioritize_username_in_ux) {
if (!this.siteSettings.prioritize_full_name_in_ux) {
return this.bookmark.user?.username;
}

View File

@@ -31,7 +31,7 @@ export default class UserMenuMessageItem extends UserMenuBaseItem {
}
get label() {
if (this.siteSettings.prioritize_username_in_ux) {
if (!this.siteSettings.prioritize_full_name_in_ux) {
return this.message.last_poster_username;
}

View File

@@ -365,8 +365,7 @@ class Notification < ActiveRecord::Base
end
def self.populate_acting_user(notifications)
should_be_done = SiteSetting.show_user_menu_avatars || !SiteSetting.prioritize_username_in_ux
return notifications if !should_be_done
return notifications if !(SiteSetting.show_user_menu_avatars || SiteSetting.prioritize_full_name_in_ux)
usernames =
notifications.map do |notification|
notification.acting_username =

View File

@@ -750,6 +750,10 @@ users:
prioritize_username_in_ux:
client: true
default: true
prioritize_full_name_in_ux:
client: true
default: false
hidden: true
email_token_valid_hours:
default: 48
min: 1

View File

@@ -837,7 +837,7 @@ RSpec.describe Notification do
end
it "Sets the acting_user correctly for each notification" do
SiteSetting.prioritize_username_in_ux = false
SiteSetting.prioritize_full_name_in_ux = true
Notification.populate_acting_user(
[notification1, notification2, notification3, notification4, notification5],
)

View File

@@ -49,8 +49,8 @@ RSpec.describe "Viewing User Menu", system: true do
expect(user_menu).to have_group_mentioned_notification(topic, user, mentionable_group)
end
context "with SiteSetting.prioritize_username_in_ux=false" do
before { SiteSetting.prioritize_username_in_ux = false }
context "with SiteSetting.prioritize_full_name_in_ux=true" do
before { SiteSetting.prioritize_full_name_in_ux = true }
it "should display user full name in mention notifications" do
Jobs.run_immediately!
@@ -117,8 +117,8 @@ RSpec.describe "Viewing User Menu", system: true do
end
end
context "with SiteSetting.prioritize_username_in_ux=true" do
before { SiteSetting.prioritize_username_in_ux = true }
context "with SiteSetting.prioritize_full_name_in_ux=false" do
before { SiteSetting.prioritize_full_name_in_ux = false }
it "should display only username in mention notifications" do
Jobs.run_immediately!