diff --git a/app/models/concerns/reactable.rb b/app/models/concerns/reactable.rb index 9e3fb6e8c64e..1c93cdde7588 100644 --- a/app/models/concerns/reactable.rb +++ b/app/models/concerns/reactable.rb @@ -83,7 +83,7 @@ def user_name_concat_format_sql "users.firstname" when :lastname_firstname "concat_ws(' ', users.lastname, users.firstname)" - when :lastname_coma_firstname + when :lastname_comma_firstname "concat_ws(', ', users.lastname, users.firstname)" when :lastname_n_firstname "concat_ws('', users.lastname, users.firstname)" diff --git a/app/models/principals/scopes/ordered_by_name.rb b/app/models/principals/scopes/ordered_by_name.rb index 39f8f004c5e0..b4699410607c 100644 --- a/app/models/principals/scopes/ordered_by_name.rb +++ b/app/models/principals/scopes/ordered_by_name.rb @@ -57,7 +57,7 @@ def user_concat_sql "concat_ws(' ', users.firstname, users.lastname)" when :firstname "users.firstname" - when :lastname_firstname, :lastname_coma_firstname, :lastname_n_firstname + when :lastname_firstname, :lastname_comma_firstname, :lastname_n_firstname "concat_ws(' ', users.lastname, users.firstname)" when :username "users.login" diff --git a/app/models/queries/filters/shared/user_name_filter.rb b/app/models/queries/filters/shared/user_name_filter.rb index 2de87015a130..c457df1a3807 100644 --- a/app/models/queries/filters/shared/user_name_filter.rb +++ b/app/models/queries/filters/shared/user_name_filter.rb @@ -71,7 +71,7 @@ def sql_concat_name "LOWER(CONCAT(users.firstname, ' ', users.lastname))" when :firstname "LOWER(users.firstname)" - when :lastname_firstname, :lastname_coma_firstname + when :lastname_firstname, :lastname_comma_firstname "LOWER(CONCAT(users.lastname, CONCAT(' ', users.firstname)))" when :lastname_n_firstname "LOWER(CONCAT(users.lastname, users.firstname))" diff --git a/app/models/user.rb b/app/models/user.rb index 4b3d33175723..193e3e361fb5 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -36,7 +36,7 @@ class User < Principal firstname: [:firstname], lastname_firstname: %i[lastname firstname], lastname_n_firstname: %i[lastname firstname], - lastname_coma_firstname: %i[lastname firstname], + lastname_comma_firstname: %i[lastname firstname], username: [:login] }.freeze @@ -295,7 +295,7 @@ def name(formatter = nil) when :firstname_lastname then "#{firstname} #{lastname}" when :lastname_firstname then "#{lastname} #{firstname}" when :lastname_n_firstname then "#{lastname}#{firstname}" - when :lastname_coma_firstname then "#{lastname}, #{firstname}" + when :lastname_comma_firstname then "#{lastname}, #{firstname}" when :firstname then firstname when :username then login diff --git a/lib/api/decorators/sql/hal_associated_resource.rb b/lib/api/decorators/sql/hal_associated_resource.rb index 68fc95ae3612..ce4512005f71 100644 --- a/lib/api/decorators/sql/hal_associated_resource.rb +++ b/lib/api/decorators/sql/hal_associated_resource.rb @@ -58,7 +58,7 @@ def associated_user_link_href(table_name, column_name) def associated_user_link_title(table_name) -> { - join_string = if Setting.user_format == :lastname_coma_firstname + join_string = if Setting.user_format == :lastname_comma_firstname " || ', ' || " else " || ' ' || " diff --git a/lib/api/v3/users/user_sql_representer.rb b/lib/api/v3/users/user_sql_representer.rb index dced22a75101..d8af457821a7 100644 --- a/lib/api/v3/users/user_sql_representer.rb +++ b/lib/api/v3/users/user_sql_representer.rb @@ -39,7 +39,7 @@ def user_name_projection(*) "firstname" when :lastname_firstname "concat(lastname, ' ', firstname)" - when :lastname_coma_firstname + when :lastname_comma_firstname "concat(lastname, ', ', firstname)" when :lastname_n_firstname "concat_ws(lastname, '', firstname)" diff --git a/spec/lib/api/v3/users/user_sql_representer_rendering_spec.rb b/spec/lib/api/v3/users/user_sql_representer_rendering_spec.rb index 8ab6d29b70d2..f15701714279 100644 --- a/spec/lib/api/v3/users/user_sql_representer_rendering_spec.rb +++ b/spec/lib/api/v3/users/user_sql_representer_rendering_spec.rb @@ -99,7 +99,7 @@ it_behaves_like "name property depending on user format setting" end - context "when user_format is set to lastname_coma_firstname", with_settings: { user_format: :lastname_coma_firstname } do + context "when user_format is set to lastname_comma_firstname", with_settings: { user_format: :lastname_comma_firstname } do it_behaves_like "name property depending on user format setting" end diff --git a/spec/mailers/user_mailer_spec.rb b/spec/mailers/user_mailer_spec.rb index 7959fb13bf12..7528e5727bb0 100644 --- a/spec/mailers/user_mailer_spec.rb +++ b/spec/mailers/user_mailer_spec.rb @@ -125,7 +125,7 @@ # and last name whereby an unescaped comma will lead to have two email addresses # defined instead of one (['Bobbi', 'bob.bobbi@example.com'] vs. ['bob.bobbi@example.com']) context "with the user name setting prone to trip up email address separation", - with_settings: { user_format: :lastname_coma_firstname } do + with_settings: { user_format: :lastname_comma_firstname } do it_behaves_like "mail is sent" end diff --git a/spec/models/concerns/reactable_spec.rb b/spec/models/concerns/reactable_spec.rb index 34530f4e2f64..b202d95ce4e5 100644 --- a/spec/models/concerns/reactable_spec.rb +++ b/spec/models/concerns/reactable_spec.rb @@ -159,7 +159,7 @@ end end - context "when user format is set to :lastname_coma_firstname", with_settings: { user_format: :lastname_coma_firstname } do + context "when user format is set to :lastname_comma_firstname", with_settings: { user_format: :lastname_comma_firstname } do it "returns grouped emoji reactions with last coma firstname" do result = Journal.grouped_emoji_reactions(reactable_id: wp_journal1.id, reactable_type: "Journal") diff --git a/spec/models/principal_spec.rb b/spec/models/principal_spec.rb index 83c0a38a1429..38134c1297c9 100644 --- a/spec/models/principal_spec.rb +++ b/spec/models/principal_spec.rb @@ -135,7 +135,7 @@ def self.should_return_groups_and_users_if_active(method, *) shared_let(:placeholder_user_id) { create(:placeholder_user, name: "Wannabejohn").id } shared_examples "name formatting" do - context "for lastname_coma_firstname formatter", with_settings: { user_format: :lastname_coma_firstname } do + context "for lastname_comma_firstname formatter", with_settings: { user_format: :lastname_comma_firstname } do it "returns formatted user name" do expect(user.name).to eq "Smith, John" end diff --git a/spec/models/principals/scopes/ordered_by_name_spec.rb b/spec/models/principals/scopes/ordered_by_name_spec.rb index 65aff95c3e63..5d5c2dd4ee26 100644 --- a/spec/models/principals/scopes/ordered_by_name_spec.rb +++ b/spec/models/principals/scopes/ordered_by_name_spec.rb @@ -73,7 +73,7 @@ end end - context "with lastname_coma_firstname user sort", with_settings: { user_format: :lastname_coma_firstname } do + context "with lastname_comma_firstname user sort", with_settings: { user_format: :lastname_comma_firstname } do it_behaves_like "sorted results" do let(:order) { [anonymous.id, eve.id, group.id, placeholder_user.id, alice.id] } end diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index c0ac9094fbc2..90e00414a8f5 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -332,7 +332,7 @@ it { is_expected.to eq "SmithJohn" } end - context "for lastname_coma_firstname", with_settings: { user_format: :lastname_coma_firstname } do + context "for lastname_comma_firstname", with_settings: { user_format: :lastname_comma_firstname } do it { is_expected.to eq "Smith, John" } end @@ -350,8 +350,8 @@ let(:user) { described_class.select_for_name(formatter).last } - context "for lastname_coma_firstname" do - let(:formatter) { :lastname_coma_firstname } + context "for lastname_comma_firstname" do + let(:formatter) { :lastname_comma_firstname } it { is_expected.to eq "Smith, John" } end