Skip to content

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.

test(people): pin the open person in the column heads and the admin view

Guido Boykee66031b2a43d
diff --git a/app/models/meeting_participant.rb b/app/models/meeting_participant.rb
index 691fbba..9278b67 100644
--- a/app/models/meeting_participant.rb
+++ b/app/models/meeting_participant.rb
@@ -21,6 +21,7 @@
# updated_at :datetime not null
# meeting_id :uuid not null
# organisation_id :uuid not null
+# person_id :uuid
# user_id :uuid
#
# Indexes
@@ -28,12 +29,14 @@
# idx_on_organisation_id_normalized_name_5eadc4a5e5 (organisation_id,normalized_name)
# index_meeting_participants_on_meeting_id_and_normalized_name (meeting_id,normalized_name) UNIQUE
# index_meeting_participants_on_meeting_id_and_user_id (meeting_id,user_id) UNIQUE WHERE (user_id IS NOT NULL)
+# index_meeting_participants_on_person_id (person_id)
# index_meeting_participants_on_user_id (user_id)
#
# Foreign Keys
#
# fk_rails_... (meeting_id => meetings.id)
# fk_rails_... (organisation_id => organisations.id)
+# fk_rails_... (person_id => people.id) ON DELETE => nullify
# fk_rails_... (user_id => users.id) ON DELETE => nullify
#
class MeetingParticipant < ApplicationRecord
diff --git a/spec/requests/organisations/people_last_contact_spec.rb b/spec/requests/organisations/people_last_contact_spec.rb
index 3a30396..e4b120f 100644
--- a/spec/requests/organisations/people_last_contact_spec.rb
+++ b/spec/requests/organisations/people_last_contact_spec.rb
@@ -90,6 +90,16 @@ RSpec.describe 'Organisations::People last contact', :ci_guard, type: :request d
expect(response.body).to include(CGI.escapeHTML('"sort"'))
end
+ # Review round 2: a click on a column head keeps the open person.
+ it 'keeps the open person in the column heads' do
+ sign_in viewer
+
+ get organisation_people_path(organisation, person_id: contact.id)
+
+ head = response.body[%r{<div class="people-columns"[\s\S]*?</div>}]
+ expect(head).to include(CGI.escapeHTML(organisation_people_path(organisation, sort: 'last', person_id: contact.id)))
+ end
+
it 'drops an unknown sort from every link' do
sign_in viewer
@@ -149,6 +159,11 @@ RSpec.describe 'Organisations::People last contact', :ci_guard, type: :request d
expect(response.body).not_to include('Geheimrunde')
expect(response.body).not_to include(I18n.t('views.organisations.people.show.all_meetings', count: 4))
expect(response.body).to include('Letztes Meeting: Runde 0')
+
+ sign_in admin
+ get organisation_person_path(organisation, contact), headers: frame_headers
+
+ expect(response.body).to include('Geheimrunde', I18n.t('views.organisations.people.show.all_meetings', count: 4))
end
it 'says so when there is no meeting' do