Self-hosted project management for devs and their clients: tickets, time tracking, docs and meetings, with an AI assistant that cites its sources. AGPL-3.0.
Ruby agplai-assistantdockerdsgvogdprhotwireissue-trackerjira-alternativeknowledge-basellmmcp-servermeeting-notesopen-sourceproject-managementredmine-alternativeruby-on-railsself-hostedticketingtime-tracking
Show and search the salutation in the people list
Guido Boykebeeb65e6a229
diff --git a/app/services/people/directory.rb b/app/services/people/directory.rbindex ba83ec2..185e375 100644--- a/app/services/people/directory.rb+++ b/app/services/people/directory.rb@@ -14,8 +14,9 @@ module People# * Contact half: rows without a link, and rows linked to someone who is no# longer an active member (name from the row itself).# * Search: one normalized substring match (PersonName.normalize, so "Muller"- # finds nothing but "mueller" and "Müller" find each other) over name,- # function, department, company and email. In Ruby, because the member half+ # finds nothing but "mueller" and "Müller" find each other) over name+ # (with the salutation in front: "Frau Müller"), function, department,+ # company and email. In Ruby, because the member half# reads its names from users; the list is sized for a few hundred rows per# organisation. Pagination is a follow-up once an organisation passes that.class Directory@@ -38,12 +39,13 @@ module Peopleend# The line under the name, in the list and in the link dialog: function- # and company of the row, else a member's email. A contact without- # either has none (nil). A contact never shows an email here: the row's- # own email is a field of its page, not a label.+ # and company of the row, else a member's email, else the salutation+ # (two contacts called "Müller" are "Frau" and "Herr"). A contact without+ # any has none (nil). A contact never shows an email here: the row's own+ # email is a field of its page, not a label.def detail[person&.function, person&.company].compact_blank.join(' · ').presence ||- (user&.email if member?)+ (user&.email if member?) || person&.salutationendend@@ -209,7 +211,8 @@ module Peopleenddef matches?(entry)- haystack = [entry.plain_name, entry.person&.function, entry.person&.department, entry.person&.company,+ addressed = [entry.person&.salutation, entry.plain_name].compact_blank.join(' ')+ haystack = [addressed, entry.person&.function, entry.person&.department, entry.person&.company,entry.person&.email, entry.user&.email]haystack.any? { |value| value.present? && PersonName.normalize(value).include?(@query) }enddiff --git a/spec/services/people/directory_spec.rb b/spec/services/people/directory_spec.rbindex 1fe82c6..d5db8ec 100644--- a/spec/services/people/directory_spec.rb+++ b/spec/services/people/directory_spec.rb@@ -96,6 +96,18 @@ RSpec.describe People::Directory, :ci_guard doendend+ # Often only "Frau Müller" is known: the name is "Müller", the salutation+ # "Frau". A search for what one would say finds her, and only her.+ it 'finds a person by salutation and name together' do+ frau = create(:person, organisation: organisation, name: 'Müller', salutation: 'Frau', company: nil)+ create(:person, organisation: organisation, name: 'Müller', salutation: 'Herr', company: nil)++ found = described_class.new(viewer: admin, organisation: organisation, query: 'Frau Müller')++ expect(found.entries.map(&:person)).to eq([frau])+ expect(found.candidates.map(&:person)).to eq([frau])+ end+# External review of 26.10.2026: a linked member is compared by the name# the directory shows, not by the copy taken when the row was linked.it 'finds duplicates of a member by the current account name' do@@ -263,6 +275,18 @@ RSpec.describe People::Directory, :ci_guard doexpect(entry(kind: :member, user: user).detail).to eq('[email protected]')expect(entry(kind: :contact, person: build(:person, email: '[email protected]', **bare)).detail).to be_nilend++ # Two contacts named "Müller" without function or company: the salutation+ # tells them apart in the list and in the link dialog.+ it 'is the salutation of a row without function and company' do+ bare = { function: nil, company: nil }++ expect(entry(kind: :contact, person: build(:person, salutation: 'Frau', **bare)).detail).to eq('Frau')+ expect(entry(kind: :contact, person: build(:person, salutation: 'Frau', function: 'CTO', company: nil)).detail)+ .to eq('CTO')+ expect(entry(kind: :member, user: build(:user, email: '[email protected]'),+ person: build(:person, salutation: 'Herr', **bare)).detail).to eq('[email protected]')+ endendend