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
Give "Alle Meetings" the shared filter bar and the project page's list
Guido Boykef478eac38623
diff --git a/.github/workflows/guards.yml b/.github/workflows/guards.ymlindex a21f22b..4171ad8 100644--- a/.github/workflows/guards.yml+++ b/.github/workflows/guards.yml@@ -465,7 +465,6 @@ jobs:spec/jobs/solid_queue_concurrency_spec.rbspec/system/assistant_meeting_analyses_spec.rbspec/system/assistant_ticket_suggestions_spec.rb- spec/services/meetings/overview_list_spec.rbspec/services/activities/area_registry_spec.rbspec/services/activities/visible_to_spec.rbspec/services/assistant/panel_registry_spec.rb@@ -585,6 +584,8 @@ jobs:spec/requests/organisations/meeting_list_views_spec.rbspec/requests/organisations/meetings_lane_spec.rbspec/requests/organisations/meetings_overview_spec.rb+ spec/requests/organisations/meetings_overview_access_spec.rb+ spec/requests/organisations/meetings_overview_views_spec.rbspec/services/actors/save_smart_folder_from_filters_spec.rbspec/services/actors/save_smart_folder_concurrency_spec.rbspec/services/actors/create_ticket_relation_concurrency_spec.rbdiff --git a/app/controllers/concerns/CLAUDE.md b/app/controllers/concerns/CLAUDE.mdindex 9ce41bc..5c10a4b 100644--- a/app/controllers/concerns/CLAUDE.md+++ b/app/controllers/concerns/CLAUDE.md@@ -1,4 +1,4 @@-# Karte: app/controllers/concerns (Stand: 2026-09-30)+# Karte: app/controllers/concerns (Stand: 2026-10-17)> Für die Ticket-**Domäne** (Attributsystem, Kanban, Actors, Fallen) gilt zusätzlich> `docs/architektur/tickets_lesepfad.md`. Diese Karte hier beschreibt nur den **Stack**.@@ -65,7 +65,12 @@ Fundamente — Tickets = dieser Stack, Knowledge = `Pageable`+`AdHocFilterable`+`ViewportSwitchable`+`ProjectController` mit `KnowledgeSearchQuery` (UNION über`Knowledge::TypeRegistry`, kein `ObjectListController`), TimeSessions = `Sortable`+`Pageable`direkt, Notifications = bespoke + `MasterListPresenter`, Meetings =-`ProjectController`+`ViewportSwitchable`.+`ProjectController`+`ViewportSwitchable`+`meeting_list.rb`.+`meeting_list.rb` (17.10.2026) ist der EINE Besitzer der Meeting-Liste: Projektseite+(`meeting_list_project` = `@project`) und „Alle Meetings“ (`nil`, auch der Refresh nach dem+Modal in `MeetingsController#create`). Eine Meeting-Ansicht gehört der Liste ihres Projekts,+ohne Projekt der Übersicht. Die Filterleiste und das Speichern von Ansichten nehmen+`project: nil` als „organisationsweit“; Tickets und Wissen geben weiter ein Projekt mit.Der Entscheid für EINE kanonische Listen-Architektur steht aus; bis dahin gilt für neueListen-Features: am ähnlichsten Bestands-Feature orientieren und die Wahl im PR begründen.Seit 10.09.2026 teilen Tickets und Knowledge immerhin die OBERFLÄCHE der Liste-mit-Bahndiff --git a/app/controllers/concerns/meeting_list.rb b/app/controllers/concerns/meeting_list.rbnew file mode 100644index 0000000..3910bcd--- /dev/null+++ b/app/controllers/concerns/meeting_list.rb@@ -0,0 +1,93 @@+# frozen_string_literal: true++# The ONE meetings list (doc/meetings_uebersicht_vereinheitlichen_plan.md, "One+# list owner"): saved views, the filter bar's conditions, the search with its+# depth, sort and pages, over the meetings the reader may read. Two lists use+# it and differ only in their project, which the includer names in+# #meeting_list_project:+#+# the project page Organisations::MeetingsController @project+# "Alle Meetings" Organisations::MeetingsOverviewController, and+# MeetingsController after a save from its modal nil+#+# A list shows the meeting views of its own project: a view without a project+# belongs to "Alle Meetings" and shows only there (decision 3 of the plan).+# Until 17.10.2026 a project page also showed every view without a project, and+# the overview had a list owner of its own with only search, a participant and a+# project select.+#+# The includer brings AdHocFilterable and Pageable; this module overrides+# AdHocFilterable#active_folder_record so that a view of another list does not+# open by address.+module MeetingList+ extend ActiveSupport::Concern++ # The columns of "Alle Meetings" until it gets the column picker (PR 2 of the+ # plan). Labels and types come from the meetings column list; project is the+ # one column only this list has.+ OVERVIEW_COLUMN_KEYS = %w[title project occurred_at duration_minutes participants].freeze++ private++ # Sets what the list head and the rows read (@meeting_smart_folders,+ # @active_smart_folder, @dissolver_result, @current_search_mode, @columns,+ # @pagy, @meeting_list_query) and answers the page of meetings on screen.+ def filtered_meetings+ @meeting_smart_folders = meeting_list_folders.order(:name)+ @active_smart_folder = active_folder_record+ @dissolver_result = dissolved_active_view if @active_smart_folder+ @current_search_mode = params[:search_mode] == 'title_only' ? 'title_only' : 'content'+ @columns = meeting_list_columns+ @meeting_list_query = Meetings::ListQuery.call(+ scope: meeting_list_scope, search: scalar_param(:search), search_mode: @current_search_mode,+ filters: list_filter_params, operators: list_filter_op_params,+ smart_folder: @active_smart_folder, apply_folder_rules: !edited_saved_view?, sort: nested_param(:sort)+ )+ # Every row of "Alle Meetings" names its project; a project page knows its own.+ rows = meeting_list_project ? @meeting_list_query : @meeting_list_query.preload(:project)+ @pagy, meetings = paginate(rows, overflow: :last_page)+ meetings+ end++ def active_folder_record+ return @active_folder_record if defined?(@active_folder_record)++ @active_folder_record = (meeting_list_folders.find_by(id: params[:smart_folder_id]) if params[:smart_folder_id].is_a?(String))+ end++ # The meeting views of this list: project_id = the list's project, or IS NULL+ # on "Alle Meetings" (where(project_id: nil) says the latter).+ def meeting_list_folders+ policy_scope(SmartFolder).where(target_object_type: 'Meeting', project_id: meeting_list_project&.id)+ end++ def meeting_list_scope+ project = meeting_list_project+ project ? policy_scope(project.meetings) : policy_scope(Meeting)+ end++ def meeting_list_columns+ project = meeting_list_project+ return overview_columns unless project++ @view_configuration = ViewConfiguration.for_user_project(current_user, project, 'meetings')+ Lists::ResolveColumns.call(view_configuration: @view_configuration, smart_folder: @active_smart_folder)+ end++ # The same column hashes the project list renders from (Lists::ResolveColumns),+ # in a fixed order.+ def overview_columns+ by_key = ViewConfiguration.meeting_base_columns.index_by { |column| column[:key] }+ by_key['project'] = { key: 'project', type: 'text', label: t('models.view_configuration.meeting_columns.project') }+ OVERVIEW_COLUMN_KEYS.each_with_index.map do |key, index|+ column = by_key.fetch(key)+ column.merge(rank: (index unless column[:required]), min_width: ViewConfiguration.column_min_width(column), pinned: false)+ end+ end++ # A search term is one string; any other shape is no search.+ def scalar_param(key)+ value = params[key]+ value if value.is_a?(String)+ end+enddiff --git a/app/controllers/organisations/meetings_controller.rb b/app/controllers/organisations/meetings_controller.rbindex e20eafe..96dd213 100644--- a/app/controllers/organisations/meetings_controller.rb+++ b/app/controllers/organisations/meetings_controller.rb@@ -11,6 +11,7 @@ module Organisationsinclude ViewportSwitchableinclude AdHocFilterableinclude Pageable+ include MeetingList# edit/update included so the detail-frame re-render after a save keeps the right# viewport: the edit link + form carry viewport so the round-trip preserves it.@@ -27,6 +28,7 @@ module Organisations# controller's own `new` form in a frame of its own. Both ids are declared by the# partial that carries the frame — meetings_overview/_new_meeting_modal.html.erb# and _results.html.erb — the same "keep them in sync" rule as the two above.+ # The filter bar of that page targets OVERVIEW_LIST_FRAME_ID too.# OVERVIEW_LIST_FRAME_ID is REPLACED on a save, so its partial has to bring the# <turbo-frame> itself; a frameless partial would delete the frame and every# later stream to it would vanish without a word.@@ -153,7 +155,7 @@ module Organisations# on "Alle Meetings" belongs back there, not in the project's own# master-detail — the same rule the turbo_stream branch follows.if overview_modal?- redirect_to organisation_meetings_path(@current_organisation), notice: t('flash.meetings.created')+ redirect_to organisation_meetings_path(@current_organisation, meeting_index_query), notice: t('flash.meetings.created')elseredirect_to organisation_project_meetings_path(@current_organisation,@@ -438,28 +440,10 @@ module Organisations@meeting = @project.meetings.find(params[:id])end- def filtered_meetings- @meeting_smart_folders = policy_scope(SmartFolder).where(target_object_type: 'Meeting')- .where('project_id IS NULL OR project_id = ?', @project.id).order(:name)- @active_smart_folder = active_folder_record- @dissolver_result = dissolved_active_view if @active_smart_folder- @current_search_mode = params[:search_mode] == 'title_only' ? 'title_only' : 'content'- @view_configuration = ViewConfiguration.for_user_project(current_user, @project, 'meetings')- @columns = Lists::ResolveColumns.call(view_configuration: @view_configuration, smart_folder: @active_smart_folder)- query = Meetings::ListQuery.call(- scope: policy_scope(@project.meetings), search: params[:search], search_mode: @current_search_mode,- filters: list_filter_params, operators: list_filter_op_params,- smart_folder: @active_smart_folder, apply_folder_rules: !edited_saved_view?, sort: nested_param(:sort)- )- @pagy, meetings = paginate(query, overflow: :last_page)- meetings- end-- def active_folder_record- return @active_folder_record if defined?(@active_folder_record)-- @active_folder_record = policy_scope(SmartFolder).where(target_object_type: 'Meeting')- .where('project_id IS NULL OR project_id = ?', @project.id).find_by(id: params[:smart_folder_id])+ # The list this request shows (MeetingList): the project's own, or "Alle+ # Meetings" after a save from that page's modal.+ def meeting_list_project+ overview_modal? ? nil : @projectenddef ad_hoc_filter_params@@ -501,19 +485,19 @@ module OrganisationsMeetings::ListState.extract(params)end- # The refreshed list keeps the filters the page is showing, so a meeting saved- # for another project (or without the searched word) is legitimately not in it.- # Then the frame renders the "filter matched nothing" empty state, which reads- # like a failed save — so the flash says which of the two happened.+ # The refreshed list keeps the state the page is showing (the form carries it+ # as hidden fields), so a meeting saved for another project (or without the+ # searched word) is legitimately not in it. Then the list looks as if the save+ # failed, so the flash says which of the two happened. The list is the one+ # MeetingsOverviewController renders (MeetingList, project nil).def overview_created_streams(meeting)- results = overview_list.fetch_results- hidden = results.none? { |row| row.id == meeting.id }+ results = filtered_meetings+ hidden = !@meeting_list_query.exists?(id: meeting.id)[turbo_stream.replace(OVERVIEW_LIST_FRAME_ID,partial: 'organisations/meetings_overview/results',- locals: { meetings: results,- filters_active: overview_list.filters_active? }),+ locals: { meetings: results }),flash_stream(hidden ? 'flash.meetings.created_hidden_by_filter' : 'flash.meetings.created')]end@@ -642,8 +626,7 @@ module Organisationsmeeting: meeting,detail_frame_id: MODAL_FRAME_ID,context: OVERVIEW_MODAL_CONTEXT,- cancel_action: MODAL_CANCEL_ACTION,- overview_project_id: params[:overview_project_id]+ cancel_action: MODAL_CANCEL_ACTION}end@@ -651,18 +634,6 @@ module Organisationsparams[:context] == OVERVIEW_MODAL_CONTEXTend- # The org-wide list, through its one owner — the same object the overview page- # itself renders with, so the list after a save cannot drift from the list- # before it. The project filter arrives as overview_project_id: project_id is- # this route's own parameter.- def overview_list- @overview_list ||= Meetings::OverviewList.from_params(- scope: policy_scope(Meeting),- params: params,- project_id_key: Meetings::OverviewList::NESTED_PROJECT_ID_KEY- )- end-def meeting_params# participants: the chips field posts meeting[participants][i][display_name]# and [user_id]; the actor strips this key out before touching Meetingdiff --git a/app/controllers/organisations/meetings_overview_controller.rb b/app/controllers/organisations/meetings_overview_controller.rbindex f7f1426..2fc8cc1 100644--- a/app/controllers/organisations/meetings_overview_controller.rb+++ b/app/controllers/organisations/meetings_overview_controller.rb@@ -1,36 +1,68 @@# frozen_string_literal: true-# Organisation-wide meetings index (Gespräche Slice 1c): "all conversations with-# person X" across project boundaries, and the DSGVO lookup tool (find every-# meeting a person took part in). A slim, index-only controller — deliberately-# NOT the project-nested Organisations::MeetingsController, which is bound to-# @project via ProjectController.+# Organisation-wide meetings index ("Alle Meetings", Gespräche Slice 1c): "all+# conversations with person X" across project boundaries, and the DSGVO lookup+# tool (find every meeting a person took part in). Deliberately NOT the+# project-nested Organisations::MeetingsController, which is bound to @project+# via ProjectController.#-# Since 05.09.2026 the page also CREATES: the title box carries a "+" that opens a-# modal with a project select, and the modal's turbo-frame loads the real form from-# the project-nested MeetingsController (frame: 'modal'). This controller therefore-# only decides WHETHER to offer the button and WHICH projects it may offer — the-# write itself never happens here.+# Since 17.10.2026 the list is the project page's list+# (doc/meetings_uebersicht_vereinheitlichen_plan.md, PR 1): the shared filter+# bar with saved views, conditions and the search depth, sort by column head,+# pagination, all through MeetingList with no project. Two things exist only+# here: the condition "Projekt" and the column "Projekt". A row still opens the+# meeting on its project's page; the detail in a lane of its own comes with PR 3.+#+# The title box carries a "+" that opens a modal with a project select, and the+# modal's turbo-frame loads the real form from the project-nested+# MeetingsController (frame: 'modal'). This controller only decides WHETHER to+# offer the button and WHICH projects it may offer; the write never happens here.## Security rests entirely on MeetingPolicy::Scope (accessible_project_ids for the-# :meetings area, within the tenant — never without_tenant): the list, both-# filters and the filter OPTIONS all derive from policy_scope(Meeting), so a-# meeting or participant name from a project the user cannot read can never-# surface. verify_policy_scoped (BaseController, index-only) enforces that the-# scope is actually applied. A user with no :meetings read access anywhere is-# redirected before the action runs.+# :meetings area, within the tenant, never without_tenant): the list, every+# condition and every option of the bar derive from policy_scope(Meeting), and a+# condition only narrows it. verify_policy_scoped (BaseController, index-only)+# enforces that the scope is applied. A user with no :meetings read access+# anywhere is redirected before the action runs.module Organisationsclass MeetingsOverviewController < Organisations::BaseController+ include ViewportSwitchable+ include AdHocFilterable+ include Pageable+ include MeetingList++ LIST_FRAME_ID = MeetingsController::OVERVIEW_LIST_FRAME_ID++ # The addresses of the page before the filter bar, still in bookmarks and+ # links from elsewhere: ?participant= and ?project_id= become the bar's+ # conditions (old name => condition).+ LEGACY_FILTER_PARAMS = { 'participant' => 'participant', 'project_id' => 'project' }.freeze+before_action :require_meetings_access+ before_action :redirect_legacy_filters, only: :index+ before_action :set_viewport_mode, only: :indexdef index@meetings = filtered_meetings+ return unless turbo_frame_request?++ case request.headers['Turbo-Frame']+ when LIST_FRAME_ID+ render partial: 'organisations/meetings_overview/results', locals: { meetings: @meetings }+ when "#{LIST_FRAME_ID}_sentence"+ render partial: 'organisations/meetings_overview/list_head'+ end# The claim hint (Nachtrag) is rendered lazily via the meeting_claim_matches- # helper (shared with the project index) — nothing to set up here.+ # helper (shared with the project index), nothing to set up here.endprivate+ # MeetingList: this list belongs to no project.+ def meeting_list_project+ nil+ end+# Nav gate + direct-URL guard: without :meetings read access in ANY project# the page has nothing to show, so redirect instead of rendering an empty# shell. Mirrors the "Zeiten" menu visibility, but a single .any? check@@ -43,50 +75,46 @@ module Organisationsalert: t('shared.errors.not_authorized')end+ # One redirect to the address the bar writes, so the chips show the old+ # filter and every later change carries it as a condition. A value that is+ # not a single string was no filter before either and is dropped.+ def redirect_legacy_filters+ query = request.query_parameters+ return if (LEGACY_FILTER_PARAMS.keys & query.keys).empty?++ filters = query['filter'].is_a?(Hash) ? query['filter'].dup : {}+ LEGACY_FILTER_PARAMS.each do |old, condition|+ value = query[old]+ filters[condition] ||= [value] if value.is_a?(String) && value.present?+ end+ kept = query.except(*LEGACY_FILTER_PARAMS.keys, 'filter')+ redirect_to organisation_meetings_path(@current_organisation, filters.empty? ? kept : kept.merge('filter' => filters))+ end+def accessible_meeting_project_ids@accessible_meeting_project_ids ||= AccessCheck::ProjectAccessService.accessible_project_ids(current_user, @current_organisation, action: :read, area: :meetings)end- # The list query lives in Meetings::OverviewList — the same object refreshes- # this frame after a save from the modal (MeetingsController#create), so the- # two paths cannot drift apart.- def overview_list- @overview_list ||= Meetings::OverviewList.from_params(scope: policy_scope(Meeting), params: params)- end-- def filtered_meetings- overview_list.fetch_results- end-- def filters_active?- overview_list.filters_active?- end- helper_method :filters_active?-- # What the modal's option URLs must carry: the filters as the LIST applies them,- # not the raw params. Reading params there let the two disagree, and a nested- # value (?project_id[a]=1) made the route helper raise on a page anyone can call.- def overview_filter_params- overview_list.active_filters+ # The options of the condition "Projekt": the projects whose meetings this+ # reader may read, nothing else.+ def meeting_filter_projects+ Project.where(id: accessible_meeting_project_ids).order(:name)end- helper_method :overview_filter_params+ helper_method :meeting_filter_projects- # Filter dropdown options, both derived from the readable meeting set so no- # name/project from an unreadable project appears.- def participant_filter_options- MeetingParticipant.distinct_names_for_meetings(policy_scope(Meeting))- end- helper_method :participant_filter_options+ # No readable meeting anywhere yet: the page shows its first-time state and+ # no filter bar, like the project page before its first meeting.+ def meetings_overview_first_use?+ return @meetings_overview_first_use if defined?(@meetings_overview_first_use)- def project_filter_options- Project.where(id: accessible_meeting_project_ids).order(:name).pluck(:name, :id)+ @meetings_overview_first_use = !policy_scope(Meeting).exists?end- helper_method :project_filter_options+ helper_method :meetings_overview_first_use?# The projects the "+" may offer: where this person may WRITE meetings. Read- # access is not enough — the modal's form would be refused by the area gate in+ # access is not enough: the modal's form would be refused by the area gate in# MeetingsController, and a button that leads to an error message is a promise# without cover (same rule as the Zeiten title box). The reach itself comes from# the single owner in AccessCheck::ProjectAccessService, not a second copy here.diff --git a/app/helpers/meetings_helper.rb b/app/helpers/meetings_helper.rbindex d460380..3b92592 100644--- a/app/helpers/meetings_helper.rb+++ b/app/helpers/meetings_helper.rb@@ -11,11 +11,20 @@ module MeetingsHelpersafe_join(URI.decode_www_form(meeting_list_state.to_query).map { |key, value| hidden_field_tag(key, value) })end- def meeting_filter_categories_json(project, organisation)- scope = policy_scope(project.meetings)- categories = [{ key: 'participant', label: t('smart_folders.fields.participant'), icon: 'bi-people',+ # The categories of the meetings filter bar, every option from `scope`, the+ # meetings this reader may read in this list. projects: the options of the+ # category "Projekt", given only on the list of the whole organisation ("Alle+ # Meetings"); a project page has its project already.+ def meeting_filter_categories_json(scope:, organisation:, projects: nil)+ categories = []+ if projects+ categories << { key: 'project', label: t('smart_folders.fields.project'), icon: 'bi-folder',+ type: 'special', allowed_operators: %w[or not],+ options: projects.map { |project| { value: project.id, label: project.name } } }+ end+ categories << { key: 'participant', label: t('smart_folders.fields.participant'), icon: 'bi-people',type: 'special', allowed_operators: %w[or and not],- options: MeetingParticipant.distinct_names_for_meetings(scope).map { |label, value| { value: value, label: label } } }]+ options: MeetingParticipant.distinct_names_for_meetings(scope).map { |label, value| { value: value, label: label } } }creators = organisation.users.where(id: scope.select(:creator_id)).map { |user| { value: user.id, label: user.display_name } }categories << { key: 'creator', label: t('smart_folders.fields.creator'), icon: 'bi-person-badge',type: 'special', allowed_operators: %w[or not], options: creators.sort_by { |option| option[:label].downcase } }@@ -35,18 +44,33 @@ module MeetingsHelperwhen 'duration_minutes't('views.organisations.meetings.shared.duration_minutes', count: meeting.duration_minutes) if meeting.duration_minuteswhen 'participants' then meeting.meeting_participants.map(&:display_name).join(', ')+ when 'project' then meeting.project.namewhen 'creator' then viewer_display_name(meeting.creator)endend- def meeting_sort_link(column, project:, organisation:)+ # The share of the width each fixed column of "Alle Meetings" takes+ # (MeetingList::OVERVIEW_COLUMN_KEYS). Here and not in the concern: Tailwind+ # scans helpers for class names, controllers it does not.+ MEETING_OVERVIEW_COLUMN_WIDTHS = {+ 'title' => 'w-[30%]', 'project' => 'w-[18%]', 'occurred_at' => 'w-[18%]',+ 'duration_minutes' => 'w-[10%]', 'participants' => 'w-[24%]'+ }.freeze++ def meeting_overview_column_width_class(column)+ MEETING_OVERVIEW_COLUMN_WIDTHS.fetch(column[:key].to_s)+ end++ # A column head that sorts its list: base_path is the list's address (the+ # project page or "Alle Meetings"), frame_id the frame the list lives in. The+ # link keeps the list state and the open meeting, and starts again at page 1.+ def meeting_sort_link(column, base_path:, frame_id:)return column[:label] unless Meetings::ListQuery::SORT_COLUMNS.include?(column[:key])sort = params[:sort].respond_to?(:[]) && params[:sort].respond_to?(:permit) ? params[:sort] : {}direction = sort['column'] == column[:key] && sort['direction'] == 'asc' ? 'desc' : 'asc'- link_to column[:label], organisation_project_meetings_path(organisation, project,- meeting_list_state.except('page').merge(params.permit(:meeting_id, :new).to_h).merge(sort: { column: column[:key], direction: direction })),- data: { turbo_frame: 'meetings_results' }+ query = meeting_list_state.except('page').merge(params.permit(:meeting_id, :new).to_h).merge('sort' => { column: column[:key], direction: direction })+ link_to column[:label], "#{base_path}?#{query.to_query}", data: { turbo_frame: frame_id }end# DOM id of the "Verknüpfte Tickets" turbo-frame on the meeting detaildiff --git a/app/helpers/pagination_helper.rb b/app/helpers/pagination_helper.rbindex 9bbbea6..647d1d0 100644--- a/app/helpers/pagination_helper.rb+++ b/app/helpers/pagination_helper.rb@@ -10,6 +10,10 @@ module PaginationHelper'smart_folders' => 'smart-folders-list'}.freeze+ # The meetings lists, project page and "Alle Meetings": their links carry the+ # whitelisted list state (Meetings::ListState), never the raw address.+ MEETING_LIST_CONTROLLERS = %w[meetings meetings_overview].freeze+ITEMS_OPTIONS_COMPACT = [10, 20, 50].freezeITEMS_OPTIONS_FULL = [5, 10, 20, 50].freeze@@ -47,10 +51,10 @@ module PaginationHelperend# Builds the URL for a pagination page (prev/next).- def pagination_page_url(_pagy, page, organisation: nil, project: nil, sort_params: {}, smart_folder_id: nil)+ def pagination_page_url(_pagy, page, organisation: nil, project: nil, sort_params: {}, smart_folder_id: nil, base_path: nil)return '#' unless page- base = pagination_base_path(organisation: organisation, project: project)+ base = base_path || pagination_base_path(organisation: organisation, project: project)query = pagination_query_params(sort_params: sort_params, smart_folder_id: smart_folder_id)query[:page] = page@@ -61,8 +65,8 @@ module PaginationHelperend# Builds the URL for an items-per-page option.- def pagination_items_url(items_count, organisation: nil, project: nil, sort_params: {}, smart_folder_id: nil)- base = pagination_base_path(organisation: organisation, project: project)+ def pagination_items_url(items_count, organisation: nil, project: nil, sort_params: {}, smart_folder_id: nil, base_path: nil)+ base = base_path || pagination_base_path(organisation: organisation, project: project)query = pagination_query_params(sort_params: sort_params, smart_folder_id: smart_folder_id)query[:items] = items_countquery.delete(:page)@@ -126,7 +130,7 @@ module PaginationHelper# Passes through ALL current query parameters (preserves filter state on page/items change),# only removes the 'page' param (pagination is set by the caller).def pagination_query_params(sort_params: {}, smart_folder_id: nil)- url_params = (controller_name == 'meetings' ? meeting_list_state.merge(params.permit(:meeting_id, :new).to_h) : request.query_parameters.deep_dup).with_indifferent_access+ url_params = (MEETING_LIST_CONTROLLERS.include?(controller_name) ? meeting_list_state.merge(params.permit(:meeting_id, :new).to_h) : request.query_parameters.deep_dup).with_indifferent_accessurl_params.delete(:page)url_params[:smart_folder_id] = smart_folder_id if smart_folder_id.present?diff --git a/app/javascript/controllers/meeting_modal_controller.js b/app/javascript/controllers/meeting_modal_controller.jsindex da0926b..21aaf03 100644--- a/app/javascript/controllers/meeting_modal_controller.js+++ b/app/javascript/controllers/meeting_modal_controller.js@@ -9,8 +9,8 @@ import { trapTabKey } from "dialog_a11y"* project, so the modal asks for one first and then loads the real form for it.** Every <option> carries its own new-URL from ERB; this controller only copies that- * value onto the frame's src, after merging in whatever the filter row says RIGHT- * NOW (lib/meeting_modal.js). Nothing here knows how a meetings route is spelled, so+ * value onto the frame's src, after adding the state the list shows RIGHT NOW+ * (lib/meeting_modal.js). Nothing here knows how a meetings route is spelled, so* a route change cannot silently break the modal.** Shape and lifecycle follow docs/dokumentation/modal_pattern.md, which names this@@ -19,10 +19,10 @@ import { trapTabKey } from "dialog_a11y"*/export default class extends Controller {static targets = ["modal", "frame", "projectSelect", "card"]- // filterForm: the id of the overview's filter form. It lives OUTSIDE this+ // listFrame: the id of the overview's list frame. It lives OUTSIDE this// controller's element (the title box), so it cannot be a Stimulus target; the// id travels from ERB rather than being hard-coded here.- static values = { filterForm: String }+ static values = { listFrame: String }connect() {this.modalTarget.classList.add("hidden")@@ -82,7 +82,7 @@ export default class extends Controller {/** Load the form for the chosen project; back to the zero state when cleared. */projectChanged() {const option = this.projectSelectTarget.selectedOptions[0]- const url = newFormUrl(option && option.dataset.newUrl, this.currentFilters())+ const url = newFormUrl(option && option.dataset.newUrl, this.currentListQuery())if (!url) {this.resetFrame()@@ -93,20 +93,14 @@ export default class extends Controller {}/**- * What the filter row says at this moment, NOT what it said when ERB rendered the- * options. The form is a frame-scoped GET without history advance, so the page- * (and with it this modal) is never re-rendered when a filter changes.+ * The state the list shows at this moment, NOT the one when ERB rendered the+ * options: the list frame writes it at every load, the page is never re-rendered+ * when a filter, a sort or a page changes.*/- currentFilters() {- const form = this.hasFilterFormValue ? document.getElementById(this.filterFormValue) : null- if (!form) return {}-- const data = new FormData(form)- return {- search: data.get("search"),- participant: data.get("participant"),- projectId: data.get("project_id")- }+ currentListQuery() {+ const frame = this.hasListFrameValue ? document.getElementById(this.listFrameValue) : null+ const state = frame && frame.querySelector("[data-list-filter-query]")+ return state ? state.dataset.listFilterQuery : ""}close() {diff --git a/app/javascript/lib/meeting_modal.js b/app/javascript/lib/meeting_modal.jsindex 25565f3..7239fe8 100644--- a/app/javascript/lib/meeting_modal.js+++ b/app/javascript/lib/meeting_modal.js@@ -3,45 +3,34 @@// Why: both were review findings on PR #716, and neither is visible from the// server side.//-// 1. newFormUrl merges the LIVE filter values into the option's URL. The-// modal sits in the title box, OUTSIDE the meetings_overview_results-// frame, and the filter row is a frame-scoped GET with no-// data-turbo-action="advance". So the page never re-renders and the-// filter values ERB baked into every data-new-url are the ones from the-// first page load. Without this merge the list after a save shows-// something other than what the filter controls say.+// 1. newFormUrl adds the list's LIVE state to the option's URL. The modal sits+// in the title box, OUTSIDE the meetings_overview_results frame, and the+// filter bar reloads only that frame. So the page never re-renders, and a+// state ERB baked into every data-new-url would be the one from the first+// page load. The list frame writes its state into data-list-filter-query+// at every load; without it, the list after a save would show something+// other than what the bar says.// 2. submissionClosesModal decides whether a finished submit really saved.// Turbo's detail.success is response.ok AFTER fetch followed redirects,// so the area gate's redirect_to reads as a success. A modal that closes// on that throws away a pasted transcript and shows no reason.-// The page's own filter field names, mapped to the names the nested meetings-// route expects. project_id is the nested route's OWN parameter, so the-// overview's project filter has to travel under a different name -- this map is-// the only place that rename is written down on the client.-export const FILTER_PARAMS = Object.freeze({- search: 'search',- participant: 'participant',- projectId: 'overview_project_id'-})-// Base URL comes from ERB (each <option data-new-url>), so no route is-// assembled here; only values are set or removed. A blank value REMOVES its-// parameter, so clearing a filter and saving does not resurrect it.-export function newFormUrl(baseUrl, filters = {}) {+// assembled here; the list query is added as it stands. The server wrote it+// from its own whitelist (Meetings::ListState), so it names nothing of the+// route. A name the base already carries (frame) is the base's: the list+// state never overrides it.+export function newFormUrl(baseUrl, listQuery = '') {if (!baseUrl) return null// A dummy origin lets URL parse a path-only value; we return path + search,// so the result stays relative and the origin never leaks into the DOM.const url = new URL(baseUrl, 'http://meeting-modal.invalid')+ const own = new Set(url.searchParams.keys())- for (const [key, param] of Object.entries(FILTER_PARAMS)) {- const value = filters[key]- if (value === undefined || value === null || String(value).trim() === '') {- url.searchParams.delete(param)- } else {- url.searchParams.set(param, String(value))- }+ for (const [key, value] of new URLSearchParams(listQuery || '')) {+ if (own.has(key)) continue+ url.searchParams.append(key, value)}return `${url.pathname}${url.search}`diff --git a/app/services/meetings/overview_list.rb b/app/services/meetings/overview_list.rbdeleted file mode 100644index 4dfc190..0000000--- a/app/services/meetings/overview_list.rb+++ /dev/null@@ -1,99 +0,0 @@-# frozen_string_literal: true--# The org-wide meetings list (Gespräche Slice 1c): search, participant filter,-# project filter and ordering over an ALREADY policy-scoped relation.-#-# One owner, because two controllers need the very same list: MeetingsOverviewController-# renders it, and MeetingsController#create refreshes it after a save from the overview-# modal. The Pundit scope stays with the caller — this object never widens what it is-# handed, it only narrows.-#-# Entry point: fetch_results-module Meetings- class OverviewList- # The list renders only these columns; loading full rows would de-TOAST- # notes/transcript/plain_text_version (up to ~1 MB each) for every meeting.- # project_id feeds includes(:project) + the row link, id the participant chips.- # Pinned by a spec: dropping the select has no symptom except a slow page.- LIST_COLUMNS = %i[id project_id organisation_id title occurred_at].freeze-- # The request parameter each filter travels under. The project filter has two- # possible names and that is the whole reason this builder exists: on the- # overview it is `project_id`, but the save comes through the project-NESTED- # route, where `project_id` is the route's own parameter and would collide, so- # it travels as `overview_project_id` there. Written down once, read by both- # controllers.- DEFAULT_PROJECT_ID_KEY = :project_id- NESTED_PROJECT_ID_KEY = :overview_project_id-- # Builds the list straight from a controller's params, so a new filter is added- # in ONE place instead of in every controller that renders this list.- def self.from_params(scope:, params:, project_id_key: DEFAULT_PROJECT_ID_KEY)- new(scope: scope,- search: params[:search],- participant: params[:participant],- project_id: params[project_id_key])- end-- # Every filter is reduced to a scalar HERE, once, so nothing downstream has to- # remember to do it. A request parameter can be a Hash or an Array- # (?project_id[a]=1), and that shape has two ways to hurt: `where` reads it as a- # condition on a table named project_id, and a route helper refuses to build an- # address from unpermitted parameters (a 500 on the overview page). A non-scalar- # is not a filter, so it becomes nil.- def initialize(scope:, search: nil, participant: nil, project_id: nil)- @scope = scope- @search = scalar(search)- @participant = scalar(participant)- @project_id = scalar(project_id)- end-- def fetch_results- scope- .search_by_content(search)- .with_participant(participant) # subquery, no row dup- .where(project_filter)- # created_at breaks ties: occurred_at comes from a minute-resolution form- # field, so two meetings entered back to back share it, and without a- # second key Postgres may put the older one first — which would make the- # modal's promise ("the new one is at the top") false at random.- .order(occurred_at: :desc, created_at: :desc)- .select(*LIST_COLUMNS)- .includes(:project, :meeting_participants) # project name + chips per row, no N+1 (D10)- end-- # Distinguishes the two empty states without an extra COUNT: with no filter- # active an empty result means "no meetings yet", with one it means "the filter- # matched nothing" (and the empty state offers a reset).- def filters_active?- active_filters.any?- end-- # The filters as this list actually applies them, ready to be put into a URL.- # The modal's option URLs must carry exactly these: reading raw params there- # would let the two disagree, and a non-scalar would break the route helper.- def active_filters- { search: search, participant: participant, project_id: project_id }.compact_blank- end-- private-- attr_reader :scope, :search, :participant, :project_id-- # A forged or unreadable project_id cannot leak: this only narrows the already- # policy-scoped relation, so an id outside the readable set matches nothing.- def project_filter- project_id.present? ? { project_id: project_id } : {}- end-- # A filter value is a scalar or it is not a filter. ActionController::Parameters- # and Hash/Array answer to neither #to_str nor Numeric/Symbol, so they fall out- # here instead of reaching a query or a route helper.- def scalar(value)- return nil if value.blank?- return nil unless value.respond_to?(:to_str) || value.is_a?(Numeric) || value.is_a?(Symbol)-- value.to_s- end- end-enddiff --git a/app/views/organisations/meetings/_list_head.html.erb b/app/views/organisations/meetings/_list_head.html.erbindex f44039f..419ca8e 100644--- a/app/views/organisations/meetings/_list_head.html.erb+++ b/app/views/organisations/meetings/_list_head.html.erb@@ -63,7 +63,7 @@ad_hoc_filters: ad_hoc_filter_params,ad_hoc_operators: ad_hoc_filter_op_params,dropped_categories: dropped_filter_categories,- filter_categories_json: meeting_filter_categories_json(@project, @current_organisation),+ filter_categories_json: meeting_filter_categories_json(scope: policy_scope(@project.meetings), organisation: @current_organisation),search_value: params[:search],search_mode: @current_search_mode,search_modes: %w[title_only content],diff --git a/app/views/organisations/meetings/_meeting_new_for_frame.html.erb b/app/views/organisations/meetings/_meeting_new_for_frame.html.erbindex a2cd5f8..220b145 100644--- a/app/views/organisations/meetings/_meeting_new_for_frame.html.erb+++ b/app/views/organisations/meetings/_meeting_new_for_frame.html.erb@@ -1,13 +1,13 @@-<%# locals: (meeting:, detail_frame_id: nil, context: nil, cancel_action: nil, overview_project_id: nil) %>+<%# locals: (meeting:, detail_frame_id: nil, context: nil, cancel_action: nil) %><%# The ONE "new meeting" form, rendered into whichever frame asked for it: thedetail pane of the project master-detail, or the modal on the org-wide list.Submits as turbo_stream — MeetingsController#create decides what to refresh fromthe `context` field below, because the two pages have different frames.- context / cancel_action / overview_project_id are the modal's three additions:- where the save came from, how "Abbrechen" closes (a link back to the list makes- no sense inside a modal) and the org-wide project filter, which cannot travel as- project_id because that is the nested route's own parameter. %>+ context / cancel_action are the modal's two additions: where the save came from+ and how "Abbrechen" closes (a link back to the list makes no sense inside a+ modal). The org-wide list's state, its project condition included, travels in+ the same hidden fields as the project list's (meeting_list_hidden_fields). %><% modal_context = context.present? %><div id="meeting-form-card" class="<%= modal_context ? 'bg-cream-50 py-6 px-8 rounded-lg border border-cream-300 relative' : 'meeting-content min-w-0 relative' %>"><% current_frame_id = detail_frame_id || 'meeting_display_frame' %>@@ -25,7 +25,6 @@turbo_stream re-renders the list the form was opened from; without this thefiltered list silently snaps back to "all". %><%= meeting_list_hidden_fields %>- <%= hidden_field_tag :overview_project_id, overview_project_id if overview_project_id.present? %><%= render 'organisations/meetings/form_fields', form: form, meeting: meeting %><div class="flex justify-end items-center gap-2 mt-6">diff --git a/app/views/organisations/meetings/_meetings_results.html.erb b/app/views/organisations/meetings/_meetings_results.html.erbindex 0a4c0d0..af0fd6c 100644--- a/app/views/organisations/meetings/_meetings_results.html.erb+++ b/app/views/organisations/meetings/_meetings_results.html.erb@@ -57,7 +57,7 @@<th scope="col" data-column="<%= column[:key] %>" <%= tag.attributes(data: { rank: column[:rank] }) %>data-col-min="<%= column[:min_width] %>" style="<%= column_min_width_style(column) %>"class="py-3 px-3 text-[11px] font-mono font-medium uppercase tracking-wider text-muted <%= column[:required] ? 'title-header text-start' : column_align_class(column) %>">- <%= meeting_sort_link(column, project: @project, organisation: @current_organisation) %>+ <%= meeting_sort_link(column, base_path: organisation_project_meetings_path(@current_organisation, @project), frame_id: 'meetings_results') %></th><% end %></tr>diff --git a/app/views/organisations/meetings_overview/_list_head.html.erb b/app/views/organisations/meetings_overview/_list_head.html.erbnew file mode 100644index 0000000..84db261--- /dev/null+++ b/app/views/organisations/meetings_overview/_list_head.html.erb@@ -0,0 +1,58 @@+<%# locals: () %>+<%# The head of "Alle Meetings": the title box, the claim hint and the shared+ filter bar. All of it stays outside #meetings_overview_results, so a filter,+ a sort or a page reloads only the rows and never the controls that asked for+ it (the same rule as meetings/_list_head). The sentence frame of the bar is+ answered from this partial too (MeetingsOverviewController#index). %>+<%# The shared title box (like "Zeiten" and the other overview pages) keeps the+ h1 typography consistent app-wide. The "?" carries the contextual meetings+ help, same wiring as the project page. %>+<%= render NeoTitleBoxComponent.new(+ title: t('views.organisations.meetings_overview.index.title'),+ variant: :organisation+) do |box| %>+ <%# Same square primary "+" as the project meetings page and the Zeiten list.+ Only where this person may write meetings somewhere: a button that leads+ to an error message is a promise without cover. %>+ <% if can_create_meeting? %>+ <% box.with_title_action do %>+ <%= render 'organisations/meetings_overview/new_meeting_modal', projects: writable_meeting_projects %>+ <% end %>+ <% end %>+ <% box.with_right_content do %>+ <%= render 'common/contextual_help_menu', context: :meetings %>+ <% end %>+<% end %>++<%# Claim hint (Nachtrag): outside the results frame so a filter never wipes it. %>+<%= render 'organisations/meetings/claim_suggestions', matches: meeting_claim_matches %>++<% unless meetings_overview_first_use? %>+ <%# The words of the bar are the project page's (i18n_scope): the same list,+ the same sentence. Only the category "Projekt" is this page's own. %>+ <%= render NeoFilterBarComponent.new(+ current_user_id: current_user.id,+ smart_folders: @meeting_smart_folders,+ url: organisation_meetings_path(@current_organisation),+ frame_id: Organisations::MeetingsOverviewController::LIST_FRAME_ID,+ i18n_scope: 'views.organisations.meetings.index',+ all_items_label: t('smart_folders.all_meetings'),+ smart_folder_context_type: 'Meeting',+ smart_folder_return_to: 'meetings',+ save_target_object_type: 'Meeting',+ return_params: meeting_list_state,+ return_keys: Meetings::ListState::KEYS,+ active_smart_folder: @active_smart_folder,+ active_view_permissions: filter_bar_view_permissions(@active_smart_folder),+ dissolver_result: @dissolver_result,+ ad_hoc_filters: ad_hoc_filter_params,+ ad_hoc_operators: ad_hoc_filter_op_params,+ dropped_categories: dropped_filter_categories,+ filter_categories_json: meeting_filter_categories_json(scope: policy_scope(Meeting), organisation: @current_organisation,+ projects: meeting_filter_projects),+ search_value: params[:search],+ search_mode: @current_search_mode,+ search_modes: %w[title_only content],+ organisation: @current_organisation+ ) %>+<% end %>diff --git a/app/views/organisations/meetings_overview/_new_meeting_modal.html.erb b/app/views/organisations/meetings_overview/_new_meeting_modal.html.erbindex bd86de3..b2c4d95 100644--- a/app/views/organisations/meetings_overview/_new_meeting_modal.html.erb+++ b/app/views/organisations/meetings_overview/_new_meeting_modal.html.erb@@ -7,14 +7,14 @@the meeting form.Each <option> carries its own new-URL, built here by ERB. meeting_modal_controller- merges the filter row's CURRENT values into it before setting the frame's src: the- values baked in below are only the ones from this page load, and the filter row is- a frame-scoped GET that never re-renders this modal. No route is assembled in- JavaScript, only values are set.- The project filter travels as overview_project_id: `project_id` is the nested- route's own parameter and would collide. %>+ adds the list's CURRENT state to it before setting the frame's src: the state the+ list frame wrote into data-list-filter-query at its last load (the filter bar, a+ sort or a page reload only that frame, never this modal). No route is assembled+ in JavaScript, only the list's own query is added. Its conditions travel as+ filter[...], so the overview's filter[project][] does not collide with the+ nested route's own project_id. %><div data-controller="meeting-modal"- data-meeting-modal-filter-form-value="meetings-overview-filters"+ data-meeting-modal-list-frame-value="<%= Organisations::MeetingsController::OVERVIEW_LIST_FRAME_ID %>"data-action="keydown@window->meeting-modal#closeOnEscape keydown@window->meeting-modal#trapFocus"><%= render Neo::Buttons::IconButtonComponent.new(@@ -66,13 +66,7 @@<option value=""><%= t('views.organisations.meetings_overview.index.modal_project_prompt') %></option><% projects.each do |project| %><option value="<%= project.id %>"- data-new-url="<%= new_organisation_project_meeting_path(- @current_organisation, project,- frame: 'modal',- search: overview_filter_params[:search],- participant: overview_filter_params[:participant],- overview_project_id: overview_filter_params[:project_id]- ) %>"><%= project.name %></option>+ data-new-url="<%= new_organisation_project_meeting_path(@current_organisation, project, frame: 'modal') %>"><%= project.name %></option><% end %></select></div>diff --git a/app/views/organisations/meetings_overview/_results.html.erb b/app/views/organisations/meetings_overview/_results.html.erbindex b4be89c..6bcc35f 100644--- a/app/views/organisations/meetings_overview/_results.html.erb+++ b/app/views/organisations/meetings_overview/_results.html.erb@@ -1,91 +1,106 @@-<%# locals: (meetings:, filters_active:) %>-<%# The meetings_overview_results frame, brought by this partial ITSELF -- the same- rule as the project list's _meetings_results.html.erb, and for the same reason:- MeetingsController#create replaces this frame wholesale after a save from the- overview modal. A partial without the frame would leave a plain <div> behind, and- from then on the filter row would target a frame that no longer exists and every- later save would be dropped by Turbo without a word.- filters_active is a local, not a helper call -- the create path runs in a- controller that has no such helper. %>-<turbo-frame id="meetings_overview_results">- <%# One query, not two: .empty? on an unloaded relation asks the database, then the- loop asks it again. %>+<%# locals: (meetings:, first_use: false) %>+<%# The meetings_overview_results frame, brought by this partial ITSELF: the+ filter bar, the column heads and the pages reload it, and+ MeetingsController#create REPLACES it after a save from the overview modal. A+ partial without the frame would leave a plain <div> behind, and from then on+ every reload would target a frame that no longer exists.+ Rendered from two controllers, so it reads no helper only one of them has:+ first_use is a local (false after a save, there is a meeting then).++ data-list-filter-query is the list state as the server applied it; the+ modal's "+" reads it when a project is chosen (meeting_modal_controller), so+ the list after a save keeps its conditions, view, search and sort. %>+<% frame_id = Organisations::MeetingsController::OVERVIEW_LIST_FRAME_ID %>+<% base_path = organisation_meetings_path(@current_organisation) %>+<turbo-frame id="<%= frame_id %>">+ <%# One query, not two: .empty? on an unloaded relation asks the database, then+ the loop asks it again. %><% rows = meetings.to_a %>- <div class="text-base min-h-[60vh]">+ <div data-fb-hits-total="<%= @pagy.count %>" class="text-base min-h-[60vh]" data-list-filter-query="<%= meeting_list_state(pagy: @pagy).to_query %>"><% if rows.empty? %><div class="flex items-center justify-center min-h-[40vh]">- <% if filters_active %>- <%# Existing meetings, but the current filter/search matched none. %>- <% reset_cta = capture do %>- <%= link_to t('views.organisations.meetings_overview.index.empty_reset'),- organisation_meetings_path(@current_organisation),- data: { turbo_frame: '_top' },- class: 'inline-flex items-center gap-1 text-sm font-medium text-cream-800 underline hover:text-ink' %>- <% end %>- <%= render 'shared/empty_content',- variant: :no_results,- icon_class: 'bi bi-search',- title: t('views.organisations.meetings_overview.index.empty_no_results'),- actions: reset_cta %>- <% else %>- <%# First time: no readable meetings exist yet in any project. %>+ <% if first_use %>+ <%# No readable meetings exist yet in any project. %><%= render 'shared/empty_content',variant: :first_time,icon_class: 'bi bi-chat-quote',title: t('views.organisations.meetings_overview.index.empty_first_time_title'),description: t('views.organisations.meetings_overview.index.empty_first_time_description') %>+ <% else %>+ <%# Meetings exist, but the view, a condition or the search matched none. %>+ <%= render 'shared/empty_content',+ variant: :no_results,+ icon_class: 'bi bi-search',+ title: t('views.organisations.meetings.index.empty_no_results') %><% end %></div>+ <% elsif @viewport_mode == 'mobile' %>+ <%# Phone: one block per meeting, the title on its own line and the project,+ date and participants below it. No table, so nothing scrolls sideways. %>+ <ul class="divide-y divide-cream-200">+ <% rows.each do |meeting| %>+ <% row_url = organisation_project_meetings_path(@current_organisation, meeting.project, meeting_id: meeting.id) %>+ <li data-meeting-id="<%= meeting.id %>"+ data-controller="clickable-row"+ data-clickable-row-url-value="<%= row_url %>"+ data-action="click->clickable-row#click"+ class="px-3 py-3 cursor-pointer hover:bg-cream-100">+ <h5 class="text-sm font-medium truncate">+ <%= link_to meeting.title, row_url, data: { turbo_frame: '_top' }, class: 'text-cream-900 hover:text-ink hover:underline' %>+ </h5>+ <p class="text-[11px] text-muted truncate">+ <%= safe_join([meeting.project.name,+ display_time(meeting.occurred_at, user: current_user),+ meeting_column_value(meeting, { key: 'participants' }).presence].compact, ' · ') %>+ </p>+ </li>+ <% end %>+ </ul><% else %>- <div class="relative w-full overflow-y-auto bg-cream-50 rounded-lg">- <table class="min-w-full border-collapse">+ <div class="relative w-full">+ <table class="w-full table-fixed meeting-table"><thead><tr>- <th scope="col" class="p-3 text-start text-[11px] font-mono font-medium text-cream-600 uppercase tracking-wider border-b border-ink w-[32%]">- <%= t('views.organisations.meetings_overview.index.col_title') %>- </th>- <th scope="col" class="p-3 text-start text-[11px] font-mono font-medium text-cream-600 uppercase tracking-wider border-b border-ink w-[22%]">- <%= t('views.organisations.meetings_overview.index.col_project') %>- </th>- <th scope="col" class="p-3 text-start text-[11px] font-mono font-medium text-cream-600 uppercase tracking-wider border-b border-ink w-[20%]">- <%= t('views.organisations.meetings_overview.index.col_date') %>- </th>- <th scope="col" class="p-3 text-start text-[11px] font-mono font-medium text-cream-600 uppercase tracking-wider border-b border-ink w-[26%]">- <%= t('views.organisations.meetings_overview.index.col_participants') %>- </th>+ <% @columns.each do |column| %>+ <th scope="col" data-column="<%= column[:key] %>"+ class="py-3 px-3 text-start text-[11px] font-mono font-medium uppercase tracking-wider text-muted <%= meeting_overview_column_width_class(column) %>">+ <%= meeting_sort_link(column, base_path: base_path, frame_id: frame_id) %>+ </th>+ <% end %></tr></thead>- <tbody class="divide-y divide-cream-200">+ <tbody><% rows.each do |meeting| %><% row_url = organisation_project_meetings_path(@current_organisation, meeting.project, meeting_id: meeting.id) %>- <%# clickable-row's default branch (no data-*-id attr) navigates the- whole window to row_url — breaking out of this frame into the- project master-detail. The title stays a real link for keyboard- access; the controller ignores clicks on it. %>- <tr data-controller="clickable-row"+ <%# A row opens the meeting on its project's page (clickable-row's+ default branch navigates the window). The title stays a real+ link for keyboard access; the controller ignores clicks on it. %>+ <tr data-meeting-id="<%= meeting.id %>"+ data-controller="clickable-row"data-clickable-row-url-value="<%= row_url %>"data-action="click->clickable-row#click"class="transition-colors duration-100 ease-in-out cursor-pointer hover:bg-cream-100">- <td class="p-3 w-[32%]">- <%= link_to meeting.title, row_url, data: { turbo_frame: '_top' },- class: 'text-sm font-medium text-cream-900 hover:text-ink hover:underline' %>- </td>- <td class="p-3 w-[22%] text-sm text-cream-700 truncate"><%= meeting.project.name %></td>- <td class="p-3 whitespace-nowrap w-[20%] text-sm">- <%= display_time(meeting.occurred_at, user: current_user) %>- </td>- <td class="p-3 w-[26%] text-sm text-cream-600">- <% if meeting.meeting_participants.any? %>- <span class="truncate"><i class="bi bi-people text-[10px]"></i> <%= meeting.meeting_participants.map(&:display_name).join(', ') %></span>- <% else %>- <span class="text-cream-400">–</span>- <% end %>- </td>+ <% @columns.each do |column| %>+ <td data-column="<%= column[:key] %>" class="p-3 text-sm">+ <% if column[:key] == 'title' %>+ <h5 class="text-sm font-medium truncate">+ <%= link_to meeting.title, row_url, data: { turbo_frame: '_top' }, class: 'text-cream-900 hover:text-ink hover:underline' %>+ </h5>+ <% else %>+ <% value = meeting_column_value(meeting, column) %>+ <%= tag.div value, class: 'truncate', title: strip_tags(value.to_s) %>+ <% end %>+ </td>+ <% end %></tr><% end %></tbody></table></div><% end %>+ <% if @pagy.count.positive? %>+ <%= render 'shared/pagination_nav_compact', pagy: @pagy, frame_id: frame_id, items_per_page: @pagy.limit,+ smart_folder_id: @active_smart_folder&.id, current_organisation: @current_organisation, base_path: base_path %>+ <% end %></div></turbo-frame>diff --git a/app/views/organisations/meetings_overview/index.html.erb b/app/views/organisations/meetings_overview/index.html.erbindex c67bdef..3117156 100644--- a/app/views/organisations/meetings_overview/index.html.erb+++ b/app/views/organisations/meetings_overview/index.html.erb@@ -1,80 +1,27 @@-<%# Org-wide meetings index (Gespräche Slice 1c): "all conversations with person- X" across project boundaries. A flat lookup table (NOT a master-detail)- modelled on the "Zeiten" page — a row click opens the meeting in its own- project's master-detail. Filters submit via GET into the results turbo-frame- so the search input keeps focus; a reset link does a full navigation to clear- the inputs (which live outside the frame).+<%# Org-wide meetings index ("Alle Meetings", Gespräche Slice 1c): "all+ conversations with person X" across project boundaries. Since 17.10.2026 the+ same list as the project meetings page: the shared filter bar above a list+ frame that the bar, the column heads and the pages reload. A row opens the+ meeting in its own project's master-detail (the lane here comes with PR 3 of+ doc/meetings_uebersicht_vereinheitlichen_plan.md).- Since 05.09.2026 the page also creates: the "+" in the title box opens a modal- that asks for a project and then loads that project's real meeting form. %>+ index-page restores the list on Back and Forward: the bar pushes history+ entries of its own ({ lane: true }), which Turbo leaves alone. viewport+ reloads the page below the breakpoint with ?viewport=mobile, as on the+ project page. %><% content_for :head do %><meta name="turbo-cache-control" content="no-cache"><% end %>-<div class="w-full">- <%# Header via the shared title box (like "Zeiten" and the other overview- pages) so the h1 typography stays consistent app-wide — no bespoke- icon/font-black heading. The "?" carries the contextual meetings help- (what a meeting is / is not), same wiring as the per-project page. %>- <%= render NeoTitleBoxComponent.new(- title: t('views.organisations.meetings_overview.index.title'),- variant: :organisation- ) do |box| %>- <%# Same square primary "+" as the project meetings page and the Zeiten list.- Only where this person may write meetings somewhere: a button that leads- to an error message is a promise without cover. %>- <% if can_create_meeting? %>- <% box.with_title_action do %>- <%= render 'organisations/meetings_overview/new_meeting_modal', projects: writable_meeting_projects %>- <% end %>- <% end %>- <% box.with_right_content do %>- <%= render 'common/contextual_help_menu', context: :meetings %>- <% end %>- <% end %>+<%# The expert filter of the bar's view menu opens into this frame. %>+<turbo-frame id="modal"></turbo-frame>- <%# Claim hint (Nachtrag): outside the results frame so a filter GET never wipes it. %>- <%= render 'organisations/meetings/claim_suggestions', matches: meeting_claim_matches %>-- <%# Filter row (search + participant + project). GET, targets the results frame- so the detail navigation and the inputs survive a filter. Search is- debounced, the selects submit immediately (auto-submit controller). %>- <%# No data-turbo-action="advance": like the sibling filter forms (knowledge,- project meetings, time_sessions), the frame-scoped submit must not promote- each debounced keystroke into a history entry. %>- <%# The id is read by meeting_modal_controller: the modal sits outside this frame- and needs the CURRENT filter values, not the ones ERB baked into its options. %>- <%= form_with url: organisation_meetings_path(@current_organisation),- method: :get,- id: 'meetings-overview-filters',- data: { turbo_frame: 'meetings_overview_results', controller: 'auto-submit' },- class: 'mb-4' do %>- <div class="flex flex-wrap items-center gap-2">- <%= search_field_tag :search, params[:search],- placeholder: t('views.organisations.meetings_overview.index.search_placeholder'),- autocomplete: 'off',- class: 'w-full md:w-80 py-2 px-4 border border-cream-300 rounded-lg focus:outline-none focus:border-ink focus:ring-1 focus:ring-ink bg-surface-raised' %>-- <% participant_options = participant_filter_options %>- <% if participant_options.any? %>- <%= select_tag :participant,- options_for_select([[t('views.organisations.meetings_overview.index.filter_participant_all'), '']] + participant_options, params[:participant]),- 'aria-label': t('views.organisations.meetings_overview.index.filter_participant_label'),- class: 'py-2 px-4 border border-cream-300 rounded-lg bg-surface-raised focus:outline-none focus:border-ink focus:ring-1 focus:ring-ink' %>- <% end %>-- <% project_options = project_filter_options %>- <% if project_options.many? %>- <%= select_tag :project_id,- options_for_select([[t('views.organisations.meetings_overview.index.filter_project_all'), '']] + project_options, params[:project_id]),- 'aria-label': t('views.organisations.meetings_overview.index.filter_project_label'),- class: 'py-2 px-4 border border-cream-300 rounded-lg bg-surface-raised focus:outline-none focus:border-ink focus:ring-1 focus:ring-ink' %>- <% end %>- </div>- <% end %>-- <%# The <turbo-frame> is inside the partial, so MeetingsController#create can- replace it wholesale without deleting it. %>- <%= render 'organisations/meetings_overview/results',- meetings: @meetings, filters_active: filters_active? %>+<div class="w-full"+ data-controller="index-page viewport"+ data-index-page-param-name-value="meeting_id"+ data-index-page-frame-id-value="meeting_display_frame"+ data-lane-params="<%= lane_params_json(selection: %w[meeting_id]) %>"+ data-viewport-current-mode-value="<%= @viewport_mode %>">+ <%= render 'organisations/meetings_overview/list_head' %>+ <%= render 'organisations/meetings_overview/results', meetings: @meetings, first_use: meetings_overview_first_use? %></div>diff --git a/app/views/organisations/smart_folders/show.html.erb b/app/views/organisations/smart_folders/show.html.erbindex 7792d44..78ed3a2 100644--- a/app/views/organisations/smart_folders/show.html.erb+++ b/app/views/organisations/smart_folders/show.html.erb@@ -146,7 +146,7 @@<div class="mt-6"><% back_path = if @smart_folder.target_object_type == 'Meeting'- @smart_folder.project ? organisation_project_meetings_path(@current_organisation, @smart_folder.project) : organisation_meetings_path(@current_organisation)+ @smart_folder.project ? organisation_project_meetings_path(@current_organisation, @smart_folder.project) : organisation_meetings_path(@current_organisation, smart_folder_id: @smart_folder.id)elseorganisation_smart_folders_path(@current_organisation)end %>diff --git a/app/views/shared/_pagination_nav_compact.html.erb b/app/views/shared/_pagination_nav_compact.html.erbindex 0a42275..d1c877f 100644--- a/app/views/shared/_pagination_nav_compact.html.erb+++ b/app/views/shared/_pagination_nav_compact.html.erb@@ -14,7 +14,9 @@proj = local_assigns[:project] || @projectsf_id = local_assigns[:smart_folder_id]sp = local_assigns[:sort_params] || {}- url_opts = { organisation: org, project: proj, sort_params: sp, smart_folder_id: sf_id }+ # base_path: a list whose address the controller name does not tell+ # (meetings_overview/_results, also rendered from MeetingsController).+ url_opts = { organisation: org, project: proj, sort_params: sp, smart_folder_id: sf_id, base_path: local_assigns[:base_path] }link_class = "flex items-center justify-center px-3 h-8 leading-tight [&.active]:bg-lime-300 hover:bg-lime-300 bg-surface-raised border border-stroke"disabled_class = "flex items-center justify-center px-3 h-8 leading-tight bg-surface-raised border border-stroke opacity-50 cursor-not-allowed"diff --git a/config/locales/views/meetings.de.yml b/config/locales/views/meetings.de.ymlindex 834ae20..7d91f4b 100644--- a/config/locales/views/meetings.de.yml+++ b/config/locales/views/meetings.de.yml@@ -199,23 +199,13 @@ de:modal_project_label: Projektmodal_project_prompt: Projekt wählen …modal_select_project_first: Wähle zuerst ein Projekt.- search_placeholder: Titel & Inhalt durchsuchen …- filter_participant_label: Teilnehmer- filter_participant_all: Alle Teilnehmer- filter_project_label: Projekt- filter_project_all: Alle Projekte- col_title: Titel- col_project: Projekt- col_date: Datum- col_participants: Teilnehmer- empty_no_results: Keine Meetings gefunden- empty_reset: Filter zurücksetzenempty_first_time_title: Noch keine Meetingsempty_first_time_description: Sobald in deinen Projekten Meetings erfasst werden, findest du sie hier projektübergreifend — zum Beispiel alle Meetings mit einer bestimmten Person.models:view_configuration:meeting_columns:title: Titel+ project: Projektoccurred_at: Meetingdatumduration_minutes: Dauerparticipants: Teilnehmer@@ -225,6 +215,7 @@ de:smart_folders:all_meetings: Alle Meetingsfields:+ project: Projektcreator: Erstellt vonparticipant: Teilnehmeroccurred_at: Meetingdatumdiff --git a/config/locales/views/meetings.en.yml b/config/locales/views/meetings.en.ymlindex 92ea837..ea933ae 100644--- a/config/locales/views/meetings.en.yml+++ b/config/locales/views/meetings.en.yml@@ -198,23 +198,13 @@ en:modal_project_label: Projectmodal_project_prompt: Choose a project …modal_select_project_first: Choose a project first.- search_placeholder: Search title & content …- filter_participant_label: Participant- filter_participant_all: All participants- filter_project_label: Project- filter_project_all: All projects- col_title: Title- col_project: Project- col_date: Date- col_participants: Participants- empty_no_results: No meetings found- empty_reset: Reset filtersempty_first_time_title: No meetings yetempty_first_time_description: As soon as meetings are recorded in your projects, you'll find them here across project boundaries — for example every meeting with a particular person.models:view_configuration:meeting_columns:title: Title+ project: Projectoccurred_at: Meeting dateduration_minutes: Durationparticipants: Participants@@ -224,6 +214,7 @@ en:smart_folders:all_meetings: All meetingsfields:+ project: Projectcreator: Created byparticipant: Participantsoccurred_at: Meeting datediff --git a/spec/javascript/lib/meeting_modal.test.js b/spec/javascript/lib/meeting_modal.test.jsindex e74e231..d157d74 100644--- a/spec/javascript/lib/meeting_modal.test.js+++ b/spec/javascript/lib/meeting_modal.test.js@@ -2,10 +2,10 @@// Why: both were review findings on PR #716 that no server-side spec can see, and// spec/system does not run in CI while this file does (guards.yml -> npm test).//-// newFormUrl: the modal lives OUTSIDE the results frame, and the filter row is a-// frame-scoped GET without history advance, so the page never re-renders and the-// filter values ERB put into every data-new-url are frozen at first load. Saving-// then refreshed the list with values the filter controls no longer showed.+// newFormUrl: the modal lives OUTSIDE the results frame, and the filter bar+// reloads only that frame, so the page never re-renders and anything ERB put into+// every data-new-url is frozen at first load. The list frame writes its state at+// every load (data-list-filter-query); the modal adds exactly that.//// submissionClosesModal: Turbo's detail.success is response.ok AFTER fetch// followed redirects. The area gate answers a denied write with redirect_to, so a@@ -17,49 +17,42 @@ import { newFormUrl, submissionClosesModal, responseContentType } from "../../..const BASE = "/organisations/o1/projects/p1/meetings/new?frame=modal"-test("merges the live filter values in, renaming project_id for the nested route", () => {- const url = newFormUrl(BASE, { search: "Kickoff", participant: "anna mueller", projectId: "p9" })- const params = new URL(url, "http://x.invalid").searchParams+const LIST = "search=Kickoff&filter%5Bproject%5D%5B%5D=p9&filter%5Bparticipant%5D%5B%5D=anna+mueller&filter_op%5Bparticipant%5D=and&smart_folder_id=v1"++test("adds the list state as it stands, the project condition as filter[project][]", () => {+ const params = new URL(newFormUrl(BASE, LIST), "http://x.invalid").searchParamsassert.equal(params.get("search"), "Kickoff")- assert.equal(params.get("participant"), "anna mueller")- // project_id is the nested route's OWN parameter, so the overview filter must- // arrive under a different name or it would silently retarget the route.- assert.equal(params.get("overview_project_id"), "p9")+ assert.deepEqual(params.getAll("filter[project][]"), ["p9"])+ assert.deepEqual(params.getAll("filter[participant][]"), ["anna mueller"])+ assert.equal(params.get("filter_op[participant]"), "and")+ assert.equal(params.get("smart_folder_id"), "v1")+ // project_id is the nested route's OWN parameter; the list never names it.assert.equal(params.get("project_id"), null)})-test("keeps the frame marker and the path untouched", () => {- const url = newFormUrl(BASE, { search: "Kickoff" })+test("keeps several values of one condition", () => {+ const params = new URL(newFormUrl(BASE, "filter%5Bproject%5D%5B%5D=p1&filter%5Bproject%5D%5B%5D=p2"), "http://x.invalid").searchParams- assert.equal(url.split("?")[0], "/organisations/o1/projects/p1/meetings/new")- assert.equal(new URL(url, "http://x.invalid").searchParams.get("frame"), "modal")+ assert.deepEqual(params.getAll("filter[project][]"), ["p1", "p2"])})-test("a cleared filter REMOVES the value ERB baked in at page load", () => {- // The exact regression: the page was opened with ?participant=Anna, the reader- // then cleared the select. Keeping the stale value would refresh the list- // filtered to Anna and hide the meeting that was just saved.- const stale = `${BASE}&participant=Anna&search=old&overview_project_id=p9`-- for (const blank of [undefined, null, "", " "]) {- const params = new URL(newFormUrl(stale, { search: blank, participant: blank, projectId: blank }),- "http://x.invalid").searchParams- assert.equal(params.get("participant"), null, `participant for ${JSON.stringify(blank)}`)- assert.equal(params.get("search"), null)- assert.equal(params.get("overview_project_id"), null)- assert.equal(params.get("frame"), "modal")- }+test("keeps the frame marker and the path untouched, even against the list state", () => {+ const url = newFormUrl(BASE, "frame=other&search=Kickoff")++ assert.equal(url.split("?")[0], "/organisations/o1/projects/p1/meetings/new")+ assert.deepEqual(new URL(url, "http://x.invalid").searchParams.getAll("frame"), ["modal"])})test("no option selected means no URL, so the frame falls back to its zero state", () => {- assert.equal(newFormUrl(undefined, { search: "Kickoff" }), null)- assert.equal(newFormUrl("", {}), null)+ assert.equal(newFormUrl(undefined, LIST), null)+ assert.equal(newFormUrl("", ""), null)})-test("no filters at all leaves the base URL alone", () => {+test("an empty list state leaves the base URL alone", () => {assert.equal(newFormUrl(BASE), BASE)- assert.equal(newFormUrl(BASE, {}), BASE)+ assert.equal(newFormUrl(BASE, ""), BASE)+ assert.equal(newFormUrl(BASE, null), BASE)})const turboStream = (ok) => ({diff --git a/spec/requests/organisations/meetings_overview_access_spec.rb b/spec/requests/organisations/meetings_overview_access_spec.rbnew file mode 100644index 0000000..074df58--- /dev/null+++ b/spec/requests/organisations/meetings_overview_access_spec.rb@@ -0,0 +1,148 @@+# frozen_string_literal: true++require 'rails_helper'++# "Alle Meetings" with the shared filter bar: what the page may reveal. The list,+# every filter category's options and every chip label come from the meetings+# this reader may read (policy_scope(Meeting), area :meetings). A filter only+# narrows; an id from the address names nothing the reader could not see anyway.+#+# Every negative assertion first proves the page rendered with the thing it is+# about (the bar, the row), so a 404 or a redirect cannot pass it in a vacuum.+RSpec.describe 'Organisations::MeetingsOverview access', :ci_guard, type: :request do+ before { Prosopite.pause } # several requests and setup writes per example+ after { Prosopite.resume }++ let(:organisation) { create(:organisation) }+ let(:project_a) { ActsAsTenant.with_tenant(organisation) { create(:project, organisation: organisation, name: 'Projekt Alpha') } }+ let(:project_b) { ActsAsTenant.with_tenant(organisation) { create(:project, organisation: organisation, name: 'Projekt Beta') } }+ let(:overview_path) { organisation_meetings_path(organisation) }++ def member_with(levels)+ user = create(:user)+ ActsAsTenant.with_tenant(organisation) do+ role = create(:role, title: "Role #{SecureRandom.hex(4)}", organisation: organisation)+ create(:membership, user: user, organisation: organisation, role: role, active: true)+ levels.each { |project, level| create(:project_permission, user: user, project: project, meetings_access: level) }+ end+ user+ end++ let(:reader_a) { member_with(project_a => 'read_only') }+ let(:other_user) { create(:user, first_name: 'Bertha', last_name: 'Beta') }++ def create_meeting(project:, title:, creator:, participants: [])+ ActsAsTenant.with_tenant(organisation) do+ create(:meeting, project: project, organisation: organisation, creator: creator, title: title).tap do |meeting|+ participants.each { |name| create(:meeting_participant, meeting: meeting, display_name: name) }+ end+ end+ end++ def page_body+ Capybara.string(response.body)+ end++ def bar_categories+ JSON.parse(page_body.find('[data-controller="filter-bar"]')['data-filter-bar-categories-value'])+ end++ def category_options(key)+ bar_categories.find { |category| category['key'] == key }&.fetch('options') || []+ end++ def row_titles+ page_body.all('#meetings_overview_results tr[data-meeting-id] h5').map { |title| title.text.strip }+ end++ before do+ ActsAsTenant.with_tenant(organisation) do+ create(:membership, user: other_user, organisation: organisation,+ role: create(:role, title: "Role #{SecureRandom.hex(4)}", organisation: organisation), active: true)+ end+ create_meeting(project: project_a, title: 'Alpha Kickoff', creator: reader_a, participants: ['Anna Müller'])+ create_meeting(project: project_b, title: 'Beta Retro', creator: other_user, participants: ['Bert Berg'])+ end++ describe 'filter options' do+ it 'offers project, participant and creator options only from readable meetings' do+ sign_in reader_a+ get overview_path++ expect(response).to have_http_status(:ok)+ expect(category_options('project').map { |option| option['label'] }).to eq(['Projekt Alpha'])+ expect(category_options('participant').map { |option| option['label'] }).to eq(['Anna Müller'])+ expect(category_options('creator').map { |option| option['value'] }).to eq([reader_a.id])+ expect(response.body).not_to include('Projekt Beta', 'Bert Berg', 'Bertha')+ end+ end++ describe 'a forged project filter' do+ it 'matches nothing and names nothing, not even in the chip' do+ sign_in reader_a+ get overview_path, params: { filter: { project: [project_b.id] } }++ expect(response).to have_http_status(:ok)+ expect(page_body).to have_css('[data-controller="filter-bar"]')+ expect(row_titles).to be_empty+ expect(response.body).not_to include('Beta Retro', 'Projekt Beta')+ end++ it 'cannot be saved as a view either' do+ sign_in reader_a++ expect do+ post create_from_filters_organisation_smart_folders_path(organisation, target_object_type: 'Meeting', return_to: 'meetings'),+ params: { smart_folder_name: 'Forged', filter: { project: [project_b.id] } }+ end.not_to(change { ActsAsTenant.with_tenant(organisation) { SmartFolder.count } })++ expect(response).to redirect_to(organisation_meetings_path(organisation))+ end+ end++ describe 'saved views of somebody else' do+ it 'does not open a private overview view of another user' do+ foreign = ActsAsTenant.with_tenant(organisation) do+ create(:smart_folder, name: 'Fremde Ansicht', user: other_user, organisation: organisation,+ project: nil, target_object_type: 'Meeting')+ end+ sign_in reader_a+ get overview_path, params: { smart_folder_id: foreign.id }++ expect(response).to have_http_status(:ok)+ expect(row_titles).to eq(['Alpha Kickoff'])+ expect(page_body).not_to have_css('[role="tab"]', text: 'Fremde Ansicht')+ expect(page_body.find('[data-controller="filter-bar"]')['data-filter-bar-smart-folder-id-value']).to be_blank+ end+ end++ describe 'another organisation' do+ it 'shows nothing of it, not by address and not as an option' do+ other_org = create(:organisation)+ ActsAsTenant.with_tenant(other_org) do+ foreign_project = create(:project, organisation: other_org, name: 'Fremd Projekt')+ create(:meeting, project: foreign_project, organisation: other_org, creator: create(:user), title: 'Fremd Meeting')+ @foreign_project_id = foreign_project.id+ end+ sign_in reader_a++ get overview_path+ expect(row_titles).to eq(['Alpha Kickoff'])+ expect(response.body).not_to include('Fremd Meeting', 'Fremd Projekt')++ get overview_path, params: { filter: { project: [@foreign_project_id] } }+ expect(page_body).to have_css('[data-controller="filter-bar"]')+ expect(row_titles).to be_empty+ expect(response.body).not_to include('Fremd Projekt')+ end+ end++ describe 'a reader without meetings access anywhere' do+ it 'is sent away before the page renders' do+ sign_in member_with({})+ get overview_path++ expect(response).to have_http_status(:redirect)+ end+ end+enddiff --git a/spec/requests/organisations/meetings_overview_create_spec.rb b/spec/requests/organisations/meetings_overview_create_spec.rbindex 823fb2b..5bc3512 100644--- a/spec/requests/organisations/meetings_overview_create_spec.rb+++ b/spec/requests/organisations/meetings_overview_create_spec.rb@@ -17,10 +17,12 @@ require 'rails_helper'# Turbo drops a stream whose target is missing WITHOUT a word. A `replace` whose# partial does not bring the <turbo-frame> deletes the frame, and from then on# the filter row and every LATER save hit exactly that silent drop.-# 3. The three filters must survive the whole round trip: page -> option URL ->-# hidden field -> refreshed list. Each link is asserted here; the middle one is-# where the overview's `project_id` becomes `overview_project_id`, because that-# name is taken by the nested route.+# 3. The list state must survive the whole round trip: list frame -> option URL ->+# hidden field -> refreshed list. The list frame writes its state into+# data-list-filter-query; meeting_modal_controller merges it into the option's+# URL when a project is chosen. The overview's project filter travels as+# filter[project][], which does not collide with the nested route's own+# project_id.RSpec.describe 'Organisations::MeetingsOverview create', type: :request dolet(:organisation) { create(:organisation) }let(:project_a) { ActsAsTenant.with_tenant(organisation) { create(:project, organisation: organisation, name: 'Projekt Alpha') } }@@ -100,33 +102,23 @@ RSpec.describe 'Organisations::MeetingsOverview create', type: :request doexpect(response.body).not_to include(new_form_path_for(project_b))end- it 'writes the active filters into every option URL, project_id renamed' do- # First link of the round trip. Only this assertion can catch the rename:- # the page's `project_id` has to leave as `overview_project_id`, or it would- # retarget the nested route instead of filtering the list.+ it 'leaves the list state out of the option URL: the modal reads it from the list' dosign_in writer_a- get overview_path, params: { search: 'Kickoff', participant: anna, project_id: project_a.id }+ get overview_path, params: { search: 'Kickoff', filter: { project: [project_a.id] } }- query = new_url_query_for(project_a)- expect(query).to include('frame' => 'modal', 'search' => 'Kickoff', 'participant' => anna,- 'overview_project_id' => project_a.id)- expect(query).not_to have_key('project_id')+ expect(new_url_query_for(project_a)).to eq('frame' => 'modal')+ modal = Nokogiri::HTML(response.body).at_css('[data-controller="meeting-modal"]')+ expect(modal['data-meeting-modal-list-frame-value']).to eq('meetings_overview_results')end- it 'survives a non-scalar project_id in the address instead of 500ing' do+ it 'writes the list state into the list frame, where the modal reads it' docreate_meeting(project: project_a, title: 'Alpha Kickoff', creator: writer_a)sign_in writer_a+ get overview_path, params: { search: 'Kickoff', filter: { project: [project_a.id] }, filter_op: { project: 'or' } }- get overview_path, params: { project_id: { 'a' => '1' } }-- expect(response).to have_http_status(:ok)- end-- it 'leaves the filter parameters out of the option URL when nothing is filtered' do- sign_in writer_a- get overview_path-- expect(new_url_query_for(project_a)).to eq('frame' => 'modal')+ state = Nokogiri::HTML(response.body).at_css('#meetings_overview_results [data-list-filter-query]')+ expect(Rack::Utils.parse_nested_query(state['data-list-filter-query']))+ .to eq('search' => 'Kickoff', 'filter' => { 'project' => [project_a.id] }, 'filter_op' => { 'project' => 'or' })endend@@ -152,18 +144,17 @@ RSpec.describe 'Organisations::MeetingsOverview create', type: :request doexpect(response.body).not_to include('meeting-form-card')end- it 'carries the active list filters into the form as hidden fields, by value' do- # Second link. Asserting the field NAMES only would pass even if the three- # were cross-wired or arrived empty — the regression this example is for.+ it 'carries the list state into the form as hidden fields, by value' do+ # Second link. Asserting the field NAMES only would pass even if the values+ # were cross-wired or arrived empty, the regression this example is for.sign_in writer_a- get new_organisation_project_meeting_path(organisation, project_a, frame: 'modal',- search: 'Kickoff', participant: anna,- overview_project_id: project_b.id),+ get new_organisation_project_meeting_path(organisation, project_a, frame: 'modal', search: 'Kickoff',+ filter: { participant: [anna], project: [project_b.id] }),headers: { 'Turbo-Frame' => 'meeting_modal_form' }expect(hidden_field_value('search')).to eq('Kickoff')- expect(hidden_field_value('participant')).to eq(anna)- expect(hidden_field_value('overview_project_id')).to eq(project_b.id)+ expect(hidden_field_value('filter[participant][]')).to eq(anna)+ expect(hidden_field_value('filter[project][]')).to eq(project_b.id)expect(hidden_field_value('context')).to eq('overview_modal')end@@ -230,38 +221,54 @@ RSpec.describe 'Organisations::MeetingsOverview create', type: :request dosign_in writer_apost organisation_project_meetings_path(organisation, project_a),- params: valid_params.merge(participant: anna), as: :turbo_stream+ params: valid_params.merge(filter: { participant: [anna] }), as: :turbo_streamexpect(response.body).to include('meetings_overview_results')expect(response.body).to include('Alpha Kickoff')expect(response.body).not_to include('Beta Sync')end- it 'keeps an active project filter, which travels as overview_project_id' do- # Third link, and the only place the rename is observable end to end. The save- # deliberately goes into a DIFFERENT project than the filter names: reading- # params[:project_id] instead would silently pick up the nested route's own- # parameter (the project being saved into) and look right anyway.+ it 'keeps an active project filter, which travels as filter[project][]' do+ # Third link. The save deliberately goes into a DIFFERENT project than the+ # filter names: reading params[:project_id] instead would silently pick up the+ # nested route's own parameter (the project being saved into) and look right.create_meeting(project: project_a, title: 'Alpha Kickoff', creator: writer_both)create_meeting(project: project_b, title: 'Beta Retro', creator: writer_both)sign_in writer_bothpost organisation_project_meetings_path(organisation, project_a),- params: valid_params.merge(overview_project_id: project_b.id), as: :turbo_stream+ params: valid_params.merge(filter: { project: [project_b.id] }), as: :turbo_streamexpect(response.body).to include('Beta Retro')expect(response.body).not_to include('Alpha Kickoff')# The saved meeting lives in project_a, which the filter excludes.expect(response.body).not_to include('Kickoff Alpha')+ expect(response.body).to include(I18n.t('flash.meetings.created_hidden_by_filter'))+ end++ it 'keeps an active saved view of the overview in the refreshed list' do+ create_meeting(project: project_b, title: 'Beta Retro', creator: writer_both)+ view = ActsAsTenant.with_tenant(organisation) do+ create(:smart_folder, name: 'Nur Beta', user: writer_both, organisation: organisation, project: nil,+ target_object_type: 'Meeting').tap do |folder|+ folder.smart_folder_rule_groups.create!(position: 1)+ .smart_folder_rules.create!(field: 'project', operator: 'equals', value: project_b.id, position: 1)+ end+ end+ sign_in writer_both++ post organisation_project_meetings_path(organisation, project_b),+ params: valid_params.merge(smart_folder_id: view.id), as: :turbo_stream++ expect(response.body).to include('Beta Retro', 'Kickoff Alpha')+ expect(response.body).to include(I18n.t('flash.meetings.created'))end- it 'answers a non-scalar overview_project_id with a filtered list, not a 500' do- # search and participant both coerce; this one reached `where` untouched, where- # a nested parameter is read as a condition on a table called project_id.+ it 'answers a filter of the wrong shape with a list, not a 500' dosign_in writer_apost organisation_project_meetings_path(organisation, project_a),- params: valid_params.merge(overview_project_id: { 'a' => '1' }), as: :turbo_stream+ params: valid_params.merge(filter: 'oops', sort: 'oops'), as: :turbo_streamexpect(response).to have_http_status(:ok)expect(response.body).to include('meetings_overview_results')@@ -286,12 +293,12 @@ RSpec.describe 'Organisations::MeetingsOverview create', type: :request dosign_in writer_apost organisation_project_meetings_path(organisation, project_a),- params: valid_params.merge(participant: MeetingParticipant.normalize_name('Bert Berg')),+ params: valid_params.merge(filter: { participant: [MeetingParticipant.normalize_name('Bert Berg')] }),as: :turbo_streamexpect(response.body).to include(I18n.t('flash.meetings.created_hidden_by_filter'))expect(response.body).not_to include(I18n.t('flash.meetings.created'))- expect(response.body).to include(I18n.t('views.organisations.meetings_overview.index.empty_no_results'))+ expect(response.body).to include(I18n.t('views.organisations.meetings.index.empty_no_results'))endit 'answers 422 back into the modal frame on an invalid submit and creates nothing' dodiff --git a/spec/requests/organisations/meetings_overview_spec.rb b/spec/requests/organisations/meetings_overview_spec.rbindex 7fb2082..146f628 100644--- a/spec/requests/organisations/meetings_overview_spec.rb+++ b/spec/requests/organisations/meetings_overview_spec.rb@@ -2,20 +2,20 @@require 'rails_helper'-# Org-wide meetings index (Gespräche Slice 1c): "all conversations with person X"-# across project boundaries. The load-bearing guarantee is SCOPING — the list,-# both filters AND the filter options must never reveal a meeting (or a-# participant name) from a project the current user cannot read in the :meetings-# area, and never from another organisation. Denial for a user with no meetings-# access anywhere surfaces as a redirect (the app convention — not a literal 403).+# "Alle Meetings" (/organisations/:id/meetings): the organisation-wide meetings+# list. Since 17.10.2026 it is the same list as the project meetings page+# (doc/meetings_uebersicht_vereinheitlichen_plan.md, PR 1): the shared filter bar+# with saved views, "+ Filter" and the search with its depth, sort by column+# head, pagination. Two things exist only here: the filter category "Projekt"+# and the column "Projekt". What the page may reveal is pinned by+# meetings_overview_access_spec.rb; this file is about behaviour.RSpec.describe 'Organisations::MeetingsOverview', type: :request dolet(:organisation) { create(:organisation) }let(:project_a) { ActsAsTenant.with_tenant(organisation) { create(:project, organisation: organisation, name: 'Projekt Alpha') } }let(:project_b) { ActsAsTenant.with_tenant(organisation) { create(:project, organisation: organisation, name: 'Projekt Beta') } }+ let(:overview_path) { organisation_meetings_path(organisation) }- # A signed-up user whose meetings access is granted per project via- # ProjectPermission. `on:` accepts a single project or an array; :none grants- # membership but no project access at all.+ # `on:` accepts a single project or an array; :none grants membership only.def user_with_access(level, on: project_a)user = create(:user)ActsAsTenant.with_tenant(organisation) do@@ -26,29 +26,45 @@ RSpec.describe 'Organisations::MeetingsOverview', type: :request douserend- let(:overview_path) { organisation_meetings_path(organisation) }+ let(:reader) { user_with_access('read_only', on: [project_a, project_b]) }- # reader_a can read meetings only in project_a.- let(:reader_a) { user_with_access('read_only', on: project_a) }- let(:no_access_user) { user_with_access(:none) }+ # Setup writes re-read the tenant organisation per participant; that is setup+ # noise, not the request under test, so Prosopite does not scan it.+ def create_meeting(project:, title:, participants: [], creator: reader, **attributes)+ Prosopite.pause { create_meeting!(project: project, title: title, participants: participants, creator: creator, **attributes) }+ end- def create_meeting(project:, title:, participants: [], occurred_at: Time.current)+ def create_meeting!(project:, title:, participants:, creator:, **attributes)ActsAsTenant.with_tenant(organisation) do- meeting = create(:meeting, project: project, organisation: organisation, creator: reader_a, title: title, occurred_at: occurred_at)- participants.each { |name| create(:meeting_participant, meeting: meeting, display_name: name) }- meeting+ create(:meeting, project: project, organisation: organisation, creator: creator, title: title, **attributes).tap do |meeting|+ participants.each { |name| create(:meeting_participant, meeting: meeting, display_name: name) }+ endendend+ def page_body+ Capybara.string(response.body)+ end++ def list(**params)+ get overview_path, params: params+ expect(response).to have_http_status(:ok)+ page_body+ end++ def titles(page = page_body)+ page.all('#meetings_overview_results tr[data-meeting-id] h5').map { |title| title.text.strip }+ end+describe 'access gate' doit 'renders for a user with meetings read access in at least one project' do- sign_in reader_a+ sign_in user_with_access('read_only')get overview_pathexpect(response).to have_http_status(:ok)endit 'redirects a user with no meetings access in any project' do- sign_in no_access_user+ sign_in user_with_access(:none)get overview_pathexpect(response).to have_http_status(:redirect)end@@ -59,122 +75,220 @@ RSpec.describe 'Organisations::MeetingsOverview', type: :request doendend- describe 'project scoping (the load-bearing negative path)' do- let!(:meeting_a) { create_meeting(project: project_a, title: 'Alpha Kickoff', participants: ['Anna Müller']) }- let!(:meeting_b) { create_meeting(project: project_b, title: 'Beta Retro', participants: ['Bert Berg']) }+ describe 'the list head' do+ before { sign_in reader }++ it 'shows the shared filter bar: base tab, "+ Filter" and the search with its depth' do+ create_meeting(project: project_a, title: 'Alpha Kickoff')+ page = list++ bar = page.find('[data-controller="filter-bar"]')+ expect(bar['data-filter-bar-frame-value']).to eq('meetings_overview_results')+ expect(bar['data-filter-bar-url-value']).to eq(overview_path)+ expect(bar['data-filter-bar-project-id-value']).to be_blank+ expect(page).to have_css('[role="tab"]', text: I18n.t('smart_folders.all_meetings'))+ expect(page).to have_css('[data-filter-bar-target="searchInput"]')+ expect(bar.all('button[data-mode]', visible: :all).map { |mode| mode['data-mode'] }).to contain_exactly('title_only', 'content')+ keys = JSON.parse(bar['data-filter-bar-categories-value']).map { |category| category['key'] }+ expect(keys).to eq(%w[project participant creator occurred_at created_at updated_at])+ end- before { sign_in reader_a } # read access on project_a only+ it 'no longer renders its own search field and the two selects' do+ create_meeting(project: project_a, title: 'Alpha Kickoff')+ page = list- it 'shows meetings from the readable project and hides those from the unreadable one' do- get overview_path- expect(response.body).to include('Alpha Kickoff')- expect(response.body).not_to include('Beta Retro')+ content = page.find('[data-controller~="index-page"]')+ expect(content).to have_css('[data-controller="filter-bar"]')+ expect(page).not_to have_css('#meetings-overview-filters')+ expect(content).not_to have_css('select[name="participant"], select[name="project_id"]')end- it 'shows the readable project name but never the unreadable one' do- get overview_path- expect(response.body).to include('Projekt Alpha')- expect(response.body).not_to include('Projekt Beta')+ it 'saves a new view without a project and back to this page' do+ create_meeting(project: project_a, title: 'Alpha Kickoff')+ page = list+ bar = page.find('[data-controller="filter-bar"]')+ save_url = bar['data-filter-bar-save-url-value']++ expect(save_url).to include('target_object_type=Meeting')+ expect(bar.find_link(I18n.t('components.filter_bar.open_expert_filter'), visible: :all)[:href]).not_to include('project_id')end+ end- it 'does not leak the unreadable project\'s participant into the filter options' do- get overview_path- # Bind the actual <select> option, not the table cell: assert the participant- # dropdown renders and lists the readable participant by its normalized value- # (which only surfaces in an <option>), and never the unreadable project's name.- expect(response.body).to include('name="participant"')- expect(response.body).to include(%(value="#{MeetingParticipant.normalize_name('Anna Müller')}"))- expect(response.body).not_to include('Bert Berg')+ describe 'filters' do+ before { sign_in reader }++ let!(:alpha) { create_meeting(project: project_a, title: 'Alpha Kickoff', participants: ['Anna Müller', 'Clara Klein'], occurred_at: 2.days.ago) }+ let!(:beta) { create_meeting(project: project_b, title: 'Beta Retro', participants: ['Anna Müller'], occurred_at: 1.day.ago) }+ let!(:gamma) { create_meeting(project: project_a, title: 'Gamma Sync', participants: ['Bert Berg'], occurred_at: 3.days.ago) }+ let(:anna) { MeetingParticipant.normalize_name('Anna Müller') }+ let(:clara) { MeetingParticipant.normalize_name('Clara Klein') }++ it 'filters by project, and excludes a project with "not"' do+ expect(titles(list(filter: { project: [project_a.id] }))).to eq(['Alpha Kickoff', 'Gamma Sync'])+ expect(titles(list(filter: { project: [project_a.id] }, filter_op: { project: 'not' }))).to eq(['Beta Retro'])+ expect(titles(list(filter: { project: [project_a.id, project_b.id] }))).to eq(['Beta Retro', 'Alpha Kickoff', 'Gamma Sync'])end- it 'does not let a participant filter reach into an unreadable project (no bypass)' do- # Filter by project_b's participant: even though such a meeting exists, the- # user cannot read it, so nothing matches — no leak through the filter.- get overview_path, params: { participant: MeetingParticipant.normalize_name('Bert Berg') }- expect(response.body).not_to include('Beta Retro')- expect(response.body).not_to include('Alpha Kickoff') # the filter also excludes non-matching readable meetings+ it 'filters by participant with or, and, not' do+ expect(titles(list(filter: { participant: [anna] }))).to eq(['Beta Retro', 'Alpha Kickoff'])+ expect(titles(list(filter: { participant: [anna, clara] }, filter_op: { participant: 'and' }))).to eq(['Alpha Kickoff'])+ expect(titles(list(filter: { participant: [anna] }, filter_op: { participant: 'not' }))).to eq(['Gamma Sync'])end- it 'does not let a forged project_id filter reach into an unreadable project (no bypass)' do- get overview_path, params: { project_id: project_b.id }- expect(response.body).not_to include('Beta Retro')+ it 'combines project, participant and the search' do+ expect(titles(list(filter: { project: [project_a.id], participant: [anna] }))).to eq(['Alpha Kickoff'])+ expect(titles(list(filter: { participant: [anna] }, search: 'Retro'))).to eq(['Beta Retro'])end- end- describe 'cross-tenant isolation' do- let(:other_org) { create(:organisation) }- let(:other_project) { ActsAsTenant.with_tenant(other_org) { create(:project, organisation: other_org, name: 'Fremd Projekt') } }+ it 'filters by creator and by the meeting date' do+ other = user_with_access('read_write', on: project_a)+ create_meeting(project: project_a, title: 'Other Creator', creator: other, occurred_at: 10.days.ago)- before do- ActsAsTenant.with_tenant(other_org) do- other_creator = create(:user)- create(:meeting, project: other_project, organisation: other_org, creator: other_creator, title: 'Fremd Meeting')- end+ expect(titles(list(filter: { creator: [other.id] }))).to eq(['Other Creator'])+ expect(titles(list(filter: { creator: [other.id] }, filter_op: { creator: 'not' }))).not_to include('Other Creator')+ expect(titles(list(filter: { occurred_at: ['last_7_days'] }))).to eq(['Beta Retro', 'Alpha Kickoff', 'Gamma Sync'])end- it 'never shows meetings from another organisation' do- create_meeting(project: project_a, title: 'Alpha Kickoff')- sign_in reader_a- get overview_path- expect(response.body).to include('Alpha Kickoff')- expect(response.body).not_to include('Fremd Meeting')+ it 'names the project in the chip sentence' do+ page = list(filter: { project: [project_b.id] })+ expect(page.find('#meetings_overview_results_sentence')).to have_text('Projekt Beta')+ end++ it 'searches the title only when the search depth says so' do+ ActsAsTenant.with_tenant(organisation) { alpha.update!(notes: 'Retro im Text') }+ expect(titles(list(search: 'Retro', search_mode: 'title_only'))).to eq(['Beta Retro'])endend- describe 'participant filter (normalized-name equivalence)' do- before { sign_in reader_a }+ describe 'old addresses' do+ before { sign_in reader }- it 'matches across umlaut spellings (Müller filter finds a Mueller participant)' do- # Participant stored with the transliterated spelling; filtering with the- # umlaut spelling must still match (both normalize to "anna mueller").+ it 'turns ?participant= and ?project_id= into the bar conditions' docreate_meeting(project: project_a, title: 'Alpha Kickoff', participants: ['Anna Mueller'])- create_meeting(project: project_a, title: 'Alpha Sync', participants: ['Clara Klein'])+ create_meeting(project: project_b, title: 'Beta Retro', participants: ['Anna Mueller'])+ anna = MeetingParticipant.normalize_name('Anna Müller')- get overview_path, params: { participant: MeetingParticipant.normalize_name('Anna Müller') }- expect(response.body).to include('Alpha Kickoff')- expect(response.body).not_to include('Alpha Sync')+ get overview_path, params: { participant: anna, project_id: project_a.id, search: 'Kick' }+ expect(response).to redirect_to(organisation_meetings_path(organisation, filter: { participant: [anna], project: [project_a.id] }, search: 'Kick'))++ follow_redirect!+ expect(titles).to eq(['Alpha Kickoff'])end- it 'combines the participant filter with the title search' do- create_meeting(project: project_a, title: 'Alpha Kickoff', participants: ['Anna Mueller'])- create_meeting(project: project_a, title: 'Beta Kickoff wording', participants: ['Anna Mueller'])+ it 'drops an old filter that is not a single value instead of failing' do+ get overview_path, params: { project_id: { 'a' => '1' } }+ expect(response).to redirect_to(overview_path)+ end+ end- get overview_path, params: { participant: MeetingParticipant.normalize_name('Anna Mueller'), search: 'Alpha' }- expect(response.body).to include('Alpha Kickoff')- expect(response.body).not_to include('Beta Kickoff wording')+ describe 'columns, sort and pages' do+ before { sign_in reader }++ it 'shows title, project, meeting date, duration and participants' do+ create_meeting(project: project_b, title: 'Beta Retro', participants: ['Bert Berg'], duration_minutes: 45)+ page = list++ expect(page.all('#meetings_overview_results thead th').map { |head| head['data-column'] })+ .to eq(%w[title project occurred_at duration_minutes participants])+ row = page.find('#meetings_overview_results tr[data-meeting-id]')+ expect(row).to have_css('td[data-column="project"]', text: 'Projekt Beta')+ expect(row).to have_css('td[data-column="participants"]', text: 'Bert Berg')+ end++ it 'sorts by a column head, keeping the filters' do+ create_meeting(project: project_a, title: 'Bravo', occurred_at: 1.day.ago)+ create_meeting(project: project_a, title: 'Alpha', occurred_at: 2.days.ago)+ create_meeting(project: project_b, title: 'Charlie', occurred_at: 3.days.ago)++ page = list(filter: { project: [project_a.id] })+ link = page.find('#meetings_overview_results th[data-column="title"] a')+ query = Rack::Utils.parse_nested_query(URI.parse(link[:href]).query)+ expect(URI.parse(link[:href]).path).to eq(overview_path)+ expect(query).to include('sort' => { 'column' => 'title', 'direction' => 'asc' }, 'filter' => { 'project' => [project_a.id] })+ expect(link['data-turbo-frame']).to eq('meetings_overview_results')++ expect(titles(list(filter: { project: [project_a.id] }, sort: { column: 'title', direction: 'asc' }))).to eq(%w[Alpha Bravo])+ end++ it 'pages through the list with the filters kept' do+ Prosopite.pause do+ 3.times { |index| create_meeting(project: project_a, title: "Seite #{index}", occurred_at: index.days.ago) }+ end++ page = list(items: 2, filter: { project: [project_a.id] })+ expect(titles(page).size).to eq(2)+ next_link = page.find("#meetings_overview_results a[title='#{I18n.t('views.shared.pagination_compact.next_page')}']")+ expect(URI.parse(next_link[:href]).path).to eq(overview_path)+ expect(Rack::Utils.parse_nested_query(URI.parse(next_link[:href]).query)).to include('page' => '2', 'filter' => { 'project' => [project_a.id] })++ expect(titles(list(items: 2, page: 2, filter: { project: [project_a.id] }))).to eq(['Seite 2'])end- it 'combines the project filter with the participant filter' do+ it 'answers the list frame alone' do+ create_meeting(project: project_a, title: 'Alpha Kickoff')+ get overview_path, headers: { 'Turbo-Frame' => 'meetings_overview_results' }++ expect(response).to have_http_status(:ok)+ expect(response.body).to include('<turbo-frame id="meetings_overview_results"', 'Alpha Kickoff')+ expect(response.body).not_to include('data-controller="filter-bar"')+ end+ end++ describe 'row navigation' do+ it 'opens a row in the project master-detail with the meeting selected' do+ meeting = create_meeting(project: project_a, title: 'Alpha Kickoff')+ sign_in reader+ page = list++ row = page.find("#meetings_overview_results tr[data-meeting-id='#{meeting.id}']")+ expect(row['data-clickable-row-url-value']).to eq(organisation_project_meetings_path(organisation, project_a, meeting_id: meeting.id))+ end+ end++ describe 'phone' do+ it 'renders the list without the table and without its own filters' docreate_meeting(project: project_a, title: 'Alpha Kickoff', participants: ['Anna Mueller'])- # reader has access to project_a only; passing its id must keep working.- get overview_path, params: { project_id: project_a.id, participant: MeetingParticipant.normalize_name('Anna Mueller') }- expect(response.body).to include('Alpha Kickoff')+ sign_in reader+ page = list(viewport: 'mobile')++ expect(page).to have_css('[data-controller="filter-bar"]')+ expect(page).not_to have_css('#meetings_overview_results table')+ expect(page).to have_css('#meetings_overview_results [data-meeting-id]', text: 'Alpha Kickoff')+ expect(page.find('#meetings_overview_results [data-meeting-id]')).to have_text('Projekt Alpha')endend- describe 'project filter options scoping' do- # The project <select> renders only with 2+ readable projects; a third same-org- # project the user cannot read must never appear as an option (the OPTIONS- # channel the guarantee names). Regressing project_filter_options to- # Project.all / organisation.projects would leak "Projekt Gamma" and fail here.- let(:reader_ab) { user_with_access('read_only', on: [project_a, project_b]) }- let!(:project_c) { ActsAsTenant.with_tenant(organisation) { create(:project, organisation: organisation, name: 'Projekt Gamma') } }-- it 'lists only readable projects in the dropdown, never an unreadable one' do- create_meeting(project: project_a, title: 'Alpha Kickoff') # give the page a row- sign_in reader_ab+ describe 'performance (no N+1 across rows)' do+ it 'renders meetings from several projects without an N+1 on project, creator or participants' do+ Prosopite.pause do+ create_meeting(project: project_a, title: 'Alpha One', participants: ['Anna Mueller'])+ create_meeting(project: project_a, title: 'Alpha Two', participants: ['Bob Builder'])+ create_meeting(project: project_b, title: 'Beta One', participants: ['Clara Klein'])+ end++ sign_in readerget overview_path- expect(response.body).to include('name="project_id"') # dropdown rendered- # "Projekt Beta" has no meeting row, so its only surface is the option list.- expect(response.body).to include('Projekt Alpha', 'Projekt Beta')- expect(response.body).not_to include('Projekt Gamma') # unreadable → never an option+ expect(response).to have_http_status(:ok)+ expect(titles).to contain_exactly('Alpha One', 'Alpha Two', 'Beta One')+ end+ end++ describe 'empty states' do+ before { sign_in reader }++ it 'shows the first-time empty state when there are no meetings at all' do+ list+ expect(response.body).to include(I18n.t('views.organisations.meetings_overview.index.empty_first_time_title'))+ end++ it 'shows the no-results empty state when a filter matches nothing' do+ create_meeting(project: project_a, title: 'Alpha Kickoff')+ list(search: 'zzz-nothing-matches')+ expect(response.body).to include(I18n.t('views.organisations.meetings.index.empty_no_results'))endenddescribe 'navigation entry visibility (can_view_meetings gate)' do- # Same user, same sidebar page, ONLY meetings access toggled — isolates- # can_view_meetings from the outer nav gate (the user always passes it via- # tickets read) and from the page. The tickets index renders the org sidebar.let(:tickets_permission) douser = create(:user)permission = nil@@ -188,14 +302,14 @@ RSpec.describe 'Organisations::MeetingsOverview', type: :request dolet(:tickets_user) { tickets_permission.user }let(:sidebar_path) { organisation_project_tickets_path(organisation, project_a) }- it 'hides "Alle Gespräche" from a sidebar user without meetings access' do+ it 'hides "Alle Meetings" from a sidebar user without meetings access' dosign_in tickets_userget sidebar_pathexpect(response).to have_http_status(:ok)expect(response.body).not_to include(I18n.t('navigation.all_meetings'))end- it 'shows "Alle Gespräche" once the same user gains meetings read access' do+ it 'shows "Alle Meetings" once the same user gains meetings read access' doActsAsTenant.with_tenant(organisation) { tickets_permission.update!(meetings_access: 'read_only') }sign_in tickets_userget sidebar_path@@ -205,12 +319,6 @@ RSpec.describe 'Organisations::MeetingsOverview', type: :request doenddescribe 'navigation collapsible group ("Zeiten" / "Alle Meetings")' do- # The org sidebar hides "Zeiten" + "Alle Meetings" behind a one-way- # "mehr …" reveal ONLY when BOTH are present (would push the base nav past 4- # items); a single extra entry stays inline. Reached via the tickets index so- # the same user renders the sidebar while we toggle time/meetings access- # independently. On the extra entries' own pages the group renders expanded so- # the active location never hides behind "mehr …".let(:base_permission) douser = create(:user)permission = nil@@ -224,11 +332,7 @@ RSpec.describe 'Organisations::MeetingsOverview', type: :request dolet(:sidebar_user) { base_permission.user }let(:sidebar_path) { organisation_project_tickets_path(organisation, project_a) }let(:times_path) { organisation_time_sessions_path(organisation) }- let(:meetings_nav_path) { organisation_meetings_path(organisation) }- # An org nav entry rendered hidden behind the "mehr …" reveal: its <li> carries- # data-more-item and wraps the link to the given path. Scoped to the org path so- # a project's own "mehr …" group can never make this match.def more_item_wrapping(path)/data-more-item[^>]*>\s*<a[^>]*#{Regexp.escape(path)}/mend@@ -243,104 +347,17 @@ RSpec.describe 'Organisations::MeetingsOverview', type: :request doActsAsTenant.with_tenant(organisation) { base_permission.update!(meetings_access: 'read_only') }end- # "Zeiten" is a fixed entry of the org navigation now (user, 01.09.2026:- # the times entry must always be visible). With it out of the collapsible- # group, "Alle Meetings" would be the group's only member, and a single extra- # entry stays inline by the rule the group had, so the "mehr …" reveal has no- # case left in the org navigation and is gone.- it 'shows "Zeiten" AND "Alle Meetings" inline when both are present, no "mehr …" reveal' do+ it 'shows "Zeiten" AND "Alle Meetings" inline, "Zeiten" first, no "mehr …" reveal' dogrant_time_access!grant_meetings_access!sign_in sidebar_userget sidebar_pathexpect(response).to have_http_status(:ok)- expect(response.body).to include(I18n.t('navigation.times'))- expect(response.body).to include(I18n.t('navigation.all_meetings'))- expect(response.body).not_to match(more_item_wrapping(times_path))- expect(response.body).not_to match(more_item_wrapping(meetings_nav_path))- # The project sidebar keeps its own "mehr …" group; the org block must not- # render one. Scoped to the org entries: no reveal wraps either of them.- expect(response.body).not_to match(/reveal-more[^<]*<[^>]*>\s*(?:<[^>]*>\s*)*#{Regexp.escape(times_path)}/m)- end-- it 'shows "Zeiten" inline when it is the only extra entry' do- grant_time_access! # meetings access withheld- sign_in sidebar_user- get sidebar_path-- expect(response).to have_http_status(:ok)- expect(response.body).to include(I18n.t('navigation.times'))+ expect(response.body).to include(I18n.t('navigation.times'), I18n.t('navigation.all_meetings'))expect(response.body).not_to match(more_item_wrapping(times_path))- end-- it 'shows "Alle Meetings" inline when it is the only extra entry' do- grant_meetings_access! # time access withheld- sign_in sidebar_user- get sidebar_path-- expect(response).to have_http_status(:ok)- expect(response.body).to include(I18n.t('navigation.all_meetings'))- expect(response.body).not_to match(more_item_wrapping(meetings_nav_path))- end-- it 'lists "Zeiten" before "Alle Meetings"' do- grant_time_access!- grant_meetings_access!- sign_in sidebar_user- get sidebar_path-+ expect(response.body).not_to match(more_item_wrapping(overview_path))expect(response.body.index(I18n.t('navigation.times'))).to be < response.body.index(I18n.t('navigation.all_meetings'))endend-- describe 'performance (no N+1 across rows)' do- # reader_all reads meetings in both projects, so several rows from different- # projects render together — Prosopite (scanning every example) fails here if- # project name or participants are not preloaded via includes (Eng-Review D10).- let(:reader_all) { user_with_access('read_only', on: [project_a, project_b]) }-- it 'renders meetings from several projects without an N+1 on project/participants' do- # Pause during setup (participant creates re-read the tenant org — benign- # setup noise); the GET below is what must be N+1-free.- Prosopite.pause do- create_meeting(project: project_a, title: 'Alpha One', participants: ['Anna Mueller'])- create_meeting(project: project_a, title: 'Alpha Two', participants: ['Bob Builder'])- create_meeting(project: project_b, title: 'Beta One', participants: ['Clara Klein'])- end-- sign_in reader_all- get overview_path- expect(response).to have_http_status(:ok)- expect(response.body).to include('Alpha One', 'Alpha Two', 'Beta One')- expect(response.body).to include('Projekt Alpha', 'Projekt Beta')- end- end-- describe 'row navigation' do- it 'links each row into the project master-detail with the meeting selected' do- meeting = create_meeting(project: project_a, title: 'Alpha Kickoff')- sign_in reader_a- get overview_path- expect(response.body).to include(- organisation_project_meetings_path(organisation, project_a, meeting_id: meeting.id)- )- end- end-- describe 'empty states' do- before { sign_in reader_a }-- it 'shows the first-time empty state when there are no meetings at all' do- get overview_path- expect(response.body).to include(I18n.t('views.organisations.meetings_overview.index.empty_first_time_title'))- end-- it 'shows the no-results empty state (with reset) when a filter matches nothing' do- create_meeting(project: project_a, title: 'Alpha Kickoff')- get overview_path, params: { search: 'zzz-nothing-matches' }- expect(response.body).to include(I18n.t('views.organisations.meetings_overview.index.empty_no_results'))- expect(response.body).to include(I18n.t('views.organisations.meetings_overview.index.empty_reset'))- end- endenddiff --git a/spec/requests/organisations/meetings_overview_views_spec.rb b/spec/requests/organisations/meetings_overview_views_spec.rbnew file mode 100644index 0000000..5b98f30--- /dev/null+++ b/spec/requests/organisations/meetings_overview_views_spec.rb@@ -0,0 +1,229 @@+# frozen_string_literal: true++require 'rails_helper'++# Saved views on "Alle Meetings" (doc/meetings_uebersicht_vereinheitlichen_plan.md,+# PR 1, decision 3). A meeting view without a project belongs to the overview and+# shows only there; a meeting view with a project shows only on that project's+# page. The shared parts (filter bar, save, rename, share, duplicate, delete,+# expert filter) take `project: nil` as "organisation-wide".+RSpec.describe 'Organisations::MeetingsOverview saved views', :ci_guard, type: :request do+ before { Prosopite.pause } # several requests per example+ after { Prosopite.resume }++ %i[get post patch delete].each do |verb|+ define_method(verb) do |*args, **options|+ super(*args, **options).tap { ActsAsTenant.current_tenant = organisation }+ end+ end++ let(:organisation) { create(:organisation) }+ let(:user) { create(:user) }+ let(:project_a) { create(:project, organisation: organisation, name: 'Projekt Alpha') }+ let(:project_b) { create(:project, organisation: organisation, name: 'Projekt Beta') }+ let(:project_hidden) { create(:project, organisation: organisation, name: 'Projekt Geheim') }+ let(:overview_path) { organisation_meetings_path(organisation) }++ before do+ ActsAsTenant.current_tenant = organisation+ create(:membership, organisation: organisation, user: user, role: create(:role, organisation: organisation), active: true)+ create(:project_permission, project: project_a, user: user, meetings_access: 'read_write')+ create(:project_permission, project: project_b, user: user, meetings_access: 'read_only')+ project_hidden+ sign_in user+ end+ after { ActsAsTenant.current_tenant = nil }++ def record(title, project:, names: [])+ create(:meeting, project: project, organisation: organisation, creator: user, title: title).tap do |meeting|+ names.each { |name| create(:meeting_participant, meeting: meeting, organisation: organisation, display_name: name) }+ end+ end++ def folder(name, project: nil, owner: user, **attributes)+ create(:smart_folder, name: name, user: owner, organisation: organisation, project: project,+ target_object_type: 'Meeting', **attributes)+ end++ def page_at(path, **params)+ get path, params: params+ expect(response).to have_http_status(:ok)+ Capybara.string(response.body)+ end++ def tabs(page)+ page.all('[role="tab"]').map { |tab| tab.text.strip }+ end++ def overview_titles(page)+ page.all('#meetings_overview_results tr[data-meeting-id] h5').map { |title| title.text.strip }+ end++ def save_from_filters(**params)+ post create_from_filters_organisation_smart_folders_path(organisation, target_object_type: 'Meeting', return_to: 'meetings'),+ params: params+ end++ describe 'saving a new view on the overview' do+ it 'stores it without a project and opens it on the overview with the list state' do+ record('Alpha Kickoff', project: project_a)+ record('Beta Retro', project: project_b)++ expect do+ save_from_filters(smart_folder_name: 'Nur Alpha', filter: { project: [project_a.id] },+ list_context: { search: 'Kick', search_mode: 'title_only' })+ end.to change(SmartFolder, :count).by(1)++ saved = SmartFolder.find_by!(name: 'Nur Alpha')+ expect(saved.project_id).to be_nil+ expect(saved.organisation_id).to eq(organisation.id)+ expect(response).to redirect_to(organisation_meetings_path(organisation, search: 'Kick', search_mode: 'title_only', smart_folder_id: saved.id))++ page = page_at(overview_path, smart_folder_id: saved.id)+ expect(overview_titles(page)).to eq(['Alpha Kickoff'])+ expect(page.find('[data-controller="filter-bar"]')['data-filter-bar-smart-folder-id-value']).to eq(saved.id)+ expect(JSON.parse(page.find('[data-controller="filter-bar"]')['data-filter-bar-dissolver-value']))+ .to include('dissolvable' => true, 'filters' => { 'project' => [project_a.id] })+ end++ it 'reads back "not" and several projects the way it was saved' do+ save_from_filters(smart_folder_name: 'Ohne Alpha', filter: { project: [project_a.id] }, filter_op: { project: 'not' })+ not_alpha = SmartFolder.find_by!(name: 'Ohne Alpha')+ save_from_filters(smart_folder_name: 'Beide', filter: { project: [project_a.id, project_b.id] })+ both = SmartFolder.find_by!(name: 'Beide')++ expect(SmartFolderDissolver.new(not_alpha, user).call)+ .to have_attributes(dissolvable?: true, ad_hoc_filters: { 'project' => [project_a.id] }, ad_hoc_operators: { 'project' => 'not' })+ expect(SmartFolderDissolver.new(both, user).call)+ .to have_attributes(dissolvable?: true, ad_hoc_filters: { 'project' => [project_a.id, project_b.id] })++ record('Alpha Kickoff', project: project_a)+ record('Beta Retro', project: project_b)+ expect(overview_titles(page_at(overview_path, smart_folder_id: not_alpha.id))).to eq(['Beta Retro'])+ expect(overview_titles(page_at(overview_path, smart_folder_id: both.id))).to contain_exactly('Alpha Kickoff', 'Beta Retro')+ end++ it 'refuses a project the reader cannot read, without a folder' do+ expect { save_from_filters(smart_folder_name: 'Geheim', filter: { project: [project_hidden.id] }) }+ .not_to change(SmartFolder, :count)+ expect(response).to redirect_to(overview_path)+ end+ end++ describe 'which list shows which view' do+ let!(:overview_view) { folder('Übersichtsansicht') }+ let!(:project_view) { folder('Projektansicht', project: project_a) }++ it 'shows a view without a project only on the overview' do+ record('Alpha Kickoff', project: project_a)++ expect(tabs(page_at(overview_path))).to include('Übersichtsansicht')+ expect(tabs(page_at(overview_path))).not_to include('Projektansicht')++ project_page = page_at(organisation_project_meetings_path(organisation, project_a))+ expect(tabs(project_page)).to include('Projektansicht')+ expect(tabs(project_page)).not_to include('Übersichtsansicht')+ end++ it 'opens neither view on the other list by address' do+ record('Alpha Kickoff', project: project_a)++ on_overview = page_at(overview_path, smart_folder_id: project_view.id)+ expect(on_overview.find('[data-controller="filter-bar"]')['data-filter-bar-smart-folder-id-value']).to be_blank++ on_project = page_at(organisation_project_meetings_path(organisation, project_a), smart_folder_id: overview_view.id)+ expect(on_project.find('[data-controller="filter-bar"]')['data-filter-bar-smart-folder-id-value']).to be_blank+ end+ end++ describe 'changing, renaming, duplicating, sharing and deleting' do+ # The bar stands only once there is a meeting to filter.+ before { record('Alpha Kickoff', project: project_a) }++ let!(:saved) do+ folder('Alpha').tap do |view|+ view.smart_folder_rule_groups.create!(position: 1)+ .smart_folder_rules.create!(field: 'project', operator: 'equals', value: project_a.id, position: 1)+ end+ end++ it 'saves changed conditions into the view without a project' do+ patch update_from_filters_organisation_smart_folder_path(organisation, saved),+ params: { filter: { project: [project_b.id] } }, as: :json++ expect(response).to have_http_status(:ok)+ expect(SmartFolderDissolver.new(saved.reload, user).call.ad_hoc_filters).to eq('project' => [project_b.id])+ expect(saved.project_id).to be_nil+ end++ it 'refuses a change to a project the reader cannot read' do+ patch update_from_filters_organisation_smart_folder_path(organisation, saved),+ params: { filter: { project: [project_hidden.id] } }, as: :json++ expect(response).to have_http_status(:unprocessable_content)+ expect(SmartFolderDissolver.new(saved.reload, user).call.ad_hoc_filters).to eq('project' => [project_a.id])+ end++ it 'renames, duplicates and deletes it, and deleting returns to the overview' do+ patch rename_organisation_smart_folder_path(organisation, saved), params: { name: 'Alpha neu' }, as: :json+ expect(response.parsed_body).to include('success' => true, 'name' => 'Alpha neu')++ post clone_organisation_smart_folder_path(organisation, saved), params: { new_folder_name: 'Alpha Kopie' }, as: :json+ copy = SmartFolder.find(response.parsed_body.fetch('id'))+ expect(copy.project_id).to be_nil+ expect(tabs(page_at(overview_path))).to include('Alpha neu', 'Alpha Kopie')++ delete organisation_smart_folder_path(organisation, saved, return_to: 'meetings')+ expect(response).to redirect_to(overview_path)+ expect(SmartFolder.exists?(saved.id)).to be(false)+ end++ it 'offers the menu entries of the active view' do+ page = page_at(overview_path, smart_folder_id: saved.id)+ menu = page.find('[data-filter-bar-target="viewMenu"]', visible: :all)++ expect(menu).to have_link(I18n.t('components.filter_bar.share'), visible: :all)+ expect(menu).to have_button(I18n.t('components.filter_bar.duplicate_view'), visible: :all)+ expert = menu.find_link(I18n.t('components.filter_bar.open_expert_filter'), visible: :all)[:href]+ expect(expert).to include("/smart_folders/#{saved.id}/edit")+ expect(expert).not_to include('project_id')++ get share_organisation_smart_folder_path(organisation, saved)+ expect(response).to have_http_status(:ok)+ end+ end++ describe 'the expert filter from the overview' do+ it 'starts a view without a project and returns to the overview' do+ get new_organisation_smart_folder_path(organisation, context_type: 'Meeting', modal: true, return_to: 'meetings')+ expect(response).to have_http_status(:ok)+ expect(Capybara.string(response.body)).to have_css('select option[value="project"]', visible: :all)++ post organisation_smart_folders_path(organisation),+ params: { return_to: 'meetings',+ smart_folder: { name: 'Experte', target_object_type: 'Meeting',+ smart_folder_rule_groups_attributes: { '0' => { position: 1, smart_folder_rules_attributes: {+ '0' => { field: 'project', operator: 'equals', value: project_a.id, position: 1 }+ } } } } }+ saved = SmartFolder.find_by!(name: 'Experte')+ expect(saved.project_id).to be_nil+ expect(response).to redirect_to(organisation_meetings_path(organisation, smart_folder_id: saved.id))+ end++ it 'offers only readable projects as values of the project field' do+ get organisation_reference_options_path(organisation, field: 'project'), params: { context_type: 'Meeting' }++ expect(response).to have_http_status(:ok)+ expect(response.parsed_body.fetch('options').map { |option| option['label'] }).to eq(['Projekt Alpha', 'Projekt Beta'])+ end++ it 'does not offer the project field on a view of one project' do+ get new_organisation_smart_folder_path(organisation, context_type: 'Meeting', project_id: project_a.id, modal: true, return_to: 'meetings')++ expect(response).to have_http_status(:ok)+ form = Capybara.string(response.body)+ expect(form).to have_css('select option[value="participant"]', visible: :all)+ expect(form).not_to have_css('select option[value="project"]', visible: :all)+ end+ end+enddiff --git a/spec/services/meetings/overview_list_spec.rb b/spec/services/meetings/overview_list_spec.rbdeleted file mode 100644index e93558b..0000000--- a/spec/services/meetings/overview_list_spec.rb+++ /dev/null@@ -1,216 +0,0 @@-# frozen_string_literal: true--require 'rails_helper'--# The org-wide meetings list, extracted so the overview page and the save coming-# from its modal render the SAME list. The load-bearing property is that this-# object only ever NARROWS the scope it is handed: the Pundit scope stays with the-# caller, and a filter value must never be able to reach past it.-RSpec.describe Meetings::OverviewList do- let(:organisation) { create(:organisation) }- let(:project_a) { ActsAsTenant.with_tenant(organisation) { create(:project, organisation: organisation, name: 'Alpha') } }- let(:project_b) { ActsAsTenant.with_tenant(organisation) { create(:project, organisation: organisation, name: 'Beta') } }- let(:creator) { create(:user) }-- def meeting(project:, title:, occurred_at: Time.current, participants: [])- ActsAsTenant.with_tenant(organisation) do- record = create(:meeting, project: project, organisation: organisation, creator: creator,- title: title, occurred_at: occurred_at)- participants.each { |name| create(:meeting_participant, meeting: record, display_name: name) }- record- end- end-- # The scope is built INSIDE the tenant block: Meeting.all outside one raises- # NoTenantSet, and the default has to be lazy for the same reason.- def results(scope: nil, **filters)- ActsAsTenant.with_tenant(organisation) do- described_class.new(scope: scope || Meeting.all, **filters).fetch_results.to_a- end- end-- describe '#fetch_results' do- it 'never reaches past the scope it was given, not even with no filters' do- inside = meeting(project: project_a, title: 'Alpha Kickoff')- meeting(project: project_b, title: 'Beta Retro')-- scope = ActsAsTenant.with_tenant(organisation) { Meeting.where(project_id: project_a.id) }- expect(results(scope: scope)).to eq([inside])- end-- it 'cannot be widened by a project_id outside the given scope' do- meeting(project: project_a, title: 'Alpha Kickoff')- meeting(project: project_b, title: 'Beta Retro')-- scope = ActsAsTenant.with_tenant(organisation) { Meeting.where(project_id: project_a.id) }- expect(results(scope: scope, project_id: project_b.id)).to be_empty- end-- it 'narrows to one project when the project filter is set' do- alpha = meeting(project: project_a, title: 'Alpha Kickoff')- meeting(project: project_b, title: 'Beta Retro')-- expect(results(project_id: project_a.id)).to eq([alpha])- end-- it 'filters by participant' do- with_anna = meeting(project: project_a, title: 'Alpha Kickoff', participants: ['Anna Müller'])- meeting(project: project_a, title: 'Beta Sync', participants: ['Bert Berg'])-- # The select's option VALUE is the normalized name, so that is what the page- # sends. Feeding the display form here would pin a shape nothing produces.- expect(results(participant: MeetingParticipant.normalize_name('Anna Müller'))).to eq([with_anna])- end-- it 'treats blank filter values as no filter (an empty select must not empty the list)' do- alpha = meeting(project: project_a, title: 'Alpha Kickoff')-- expect(results(search: '', participant: '', project_id: '')).to eq([alpha])- expect(results(search: ' ', participant: ' ', project_id: ' ')).to eq([alpha])- end-- it 'answers a project_id that is not a uuid with nothing instead of raising' do- # The "a forged project_id cannot leak" claim rests on Rails casting an- # unparseable uuid to NULL. project_id is NOT NULL, so nothing matches.- meeting(project: project_a, title: 'Alpha Kickoff')-- expect { results(project_id: 'not-a-uuid') }.not_to raise_error- expect(results(project_id: 'not-a-uuid')).to be_empty- end-- it 'treats a non-scalar filter value as no filter at all' do- # ?project_id[a]=1 arrives as ActionController::Parameters. That shape hurts- # twice: `where` reads it as a condition on a table called project_id, and the- # modal's route helper refuses to build an address from unpermitted parameters- # (a 500 on a page anyone can call — the request-level probe for that lives in- # meetings_overview_create_spec.rb). A value that is not a scalar is not a- # filter, so the list stays unfiltered rather than raising or silently emptying.- alpha = meeting(project: project_a, title: 'Alpha Kickoff')-- nested = ActionController::Parameters.new(a: '1')- expect { results(project_id: nested) }.not_to raise_error- expect(results(project_id: nested)).to eq([alpha])- expect(results(search: nested, participant: ['x'], project_id: { 'a' => '1' })).to eq([alpha])- end-- it 'loads only the list columns, never the ~1 MB text bodies' do- # The whole reason this object narrows the SELECT. Dropping it has no symptom- # a normal example would notice, only a slow page.- meeting(project: project_a, title: 'Alpha Kickoff')-- row = results.first- expect(row.title).to eq('Alpha Kickoff')- expect { row.notes }.to raise_error(ActiveModel::MissingAttributeError)- expect { row.transcript }.to raise_error(ActiveModel::MissingAttributeError)- end-- it 'filters by search text' do- kickoff = meeting(project: project_a, title: 'Alpha Kickoff')- meeting(project: project_a, title: 'Beta Retro')-- expect(results(search: 'Kickoff')).to eq([kickoff])- end-- it 'orders newest first' do- older = meeting(project: project_a, title: 'Older', occurred_at: 3.days.ago)- newer = meeting(project: project_a, title: 'Newer', occurred_at: 1.hour.ago)-- expect(results).to eq([newer, older])- end-- it 'breaks an occurred_at tie by creation, so the newest entry is on top' do- # occurred_at comes from a minute-resolution form field and defaults to "now",- # so two meetings entered back to back tie. Without a second key the modal's- # promise ("the new one is at the top") holds only by luck.- same_moment = 2.hours.ago.change(sec: 0)- first = meeting(project: project_a, title: 'Entered first', occurred_at: same_moment)- second = meeting(project: project_a, title: 'Entered second', occurred_at: same_moment)-- expect(first.occurred_at).to eq(second.occurred_at)- expect(results).to eq([second, first])- end-- it 'combines filters instead of letting the last one win' do- meeting(project: project_a, title: 'Alpha Kickoff', participants: ['Anna Müller'])- meeting(project: project_b, title: 'Alpha Kickoff', participants: ['Anna Müller'])-- expect(results(search: 'Kickoff', participant: 'Anna Müller', project_id: project_a.id).size).to eq(1)- end- end-- describe '.from_params' do- # The builder exists so the parameter NAMES live in one place: the overview- # sends project_id, the save comes through the project-nested route where that- # name is taken and the filter travels as overview_project_id.- def from_params(params, **options)- ActsAsTenant.with_tenant(organisation) do- described_class.from_params(scope: Meeting.all, params: params.with_indifferent_access, **options)- .fetch_results.to_a- end- end-- it 'reads search, participant and project_id from the params' do- alpha = meeting(project: project_a, title: 'Alpha Kickoff', participants: ['Anna Müller'])- meeting(project: project_b, title: 'Beta Retro')-- expect(from_params({ search: 'Kickoff',- participant: MeetingParticipant.normalize_name('Anna Müller'),- project_id: project_a.id })).to eq([alpha])- end-- it 'reads the project filter from overview_project_id for the nested route' do- alpha = meeting(project: project_a, title: 'Alpha Kickoff')- beta = meeting(project: project_b, title: 'Beta Retro')-- nested = { overview_project_id: project_a.id, project_id: project_b.id }- # project_id is the nested route's own parameter and must be ignored here,- # or a save would refresh the list filtered to the project it saved into.- expect(from_params(nested, project_id_key: described_class::NESTED_PROJECT_ID_KEY)).to eq([alpha])- expect(from_params(nested)).to eq([beta])- end-- it 'defaults to the plain project_id key' do- expect(described_class::DEFAULT_PROJECT_ID_KEY).to eq(:project_id)- expect(described_class::NESTED_PROJECT_ID_KEY).to eq(:overview_project_id)- end- end-- describe '#filters_active?' do- def active?(**filters)- ActsAsTenant.with_tenant(organisation) do- described_class.new(scope: Meeting.all, **filters).filters_active?- end- end-- it 'is false with no filters' do- expect(active?).to be(false)- end-- it 'is false for blank filter values (an empty select is not a filter)' do- expect(active?(search: '', participant: '', project_id: '')).to be(false)- expect(active?(search: ' ', participant: ' ', project_id: ' ')).to be(false)- end-- it 'is false for a non-scalar value, so the empty state stays coherent' do- # Otherwise the page would claim "your filter matched nothing" about a value- # it never applied.- expect(active?(project_id: ActionController::Parameters.new(a: '1'))).to be(false)- expect(active?(search: { 'a' => '1' }, participant: ['x'])).to be(false)- end-- it 'exposes exactly the filters it applied, ready for a URL' do- list = ActsAsTenant.with_tenant(organisation) do- described_class.new(scope: Meeting.all, search: 'Kickoff', participant: ' ',- project_id: ActionController::Parameters.new(a: '1'))- end-- expect(list.active_filters).to eq(search: 'Kickoff')- end-- it 'is true for each filter on its own' do- expect(active?(search: 'x')).to be(true)- expect(active?(participant: 'Anna')).to be(true)- expect(active?(project_id: SecureRandom.uuid)).to be(true)- end- end-enddiff --git a/spec/system/meetings_overview_spec.rb b/spec/system/meetings_overview_spec.rbnew file mode 100644index 0000000..4f27446--- /dev/null+++ b/spec/system/meetings_overview_spec.rb@@ -0,0 +1,97 @@+# frozen_string_literal: true++require 'rails_helper'++# "Alle Meetings" in the browser (doc/meetings_uebersicht_vereinheitlichen_plan.md,+# PR 1): the shared filter bar with the condition "Projekt", a view saved on+# this page and opened again, and the "+" modal, whose save must leave the list+# with the conditions it had. The request specs cannot see the last one: the+# modal reads the list state from the list frame in JavaScript.+RSpec.describe 'Meetings overview', type: :system do+ before { Prosopite.pause }+ after do+ Prosopite.resume+ page.driver.browser.manage.window.resize_to(1920, 1080)+ end++ let(:organisation) { create(:organisation) }+ let(:user) { create(:user) }+ let(:alpha) { create(:project, organisation: organisation, name: 'Projekt Alpha') }+ let(:beta) { create(:project, organisation: organisation, name: 'Projekt Beta') }+ let!(:membership) do+ ActsAsTenant.with_tenant(organisation) do+ create(:membership, user: user, organisation: organisation, role: create(:admin_role, organisation: organisation))+ end+ end++ before do+ ActsAsTenant.with_tenant(organisation) do+ create(:meeting, project: alpha, organisation: organisation, creator: user, title: 'Alpha Kickoff', occurred_at: 2.days.ago)+ create(:meeting, project: beta, organisation: organisation, creator: user, title: 'Beta Retro', occurred_at: 1.day.ago)+ end+ ActsAsTenant.current_tenant = organisation+ sign_in user+ end++ def expect_titles(*titles)+ titles.each { |title| expect(page).to have_css('#meetings_overview_results tr[data-meeting-id]', text: title, wait: 5) }+ expect(page).to have_css('#meetings_overview_results tr[data-meeting-id]', count: titles.size, wait: 5)+ end++ it 'filters by project through "+ Filter", saves the view and opens it again' do+ page.driver.browser.manage.window.resize_to(1440, 1000)+ visit organisation_meetings_path(organisation)+ expect_titles('Alpha Kickoff', 'Beta Retro')++ find('[data-filter-bar-target="filterButton"]').click+ find('[role="menuitem"][data-category="project"]').click+ within('[data-filter-bar-target="valueMenu"]') { find("input[type='checkbox'][data-filter-value='#{alpha.id}']").click }+ expect_titles('Alpha Kickoff')+ page.send_keys(:escape)+ page.send_keys(:escape)++ click_button 'Als Ansicht sichern'+ fill_in 'smart_folder_name', with: 'Nur Alpha'+ click_button 'Sichern'+ expect(page).to have_css('[role="tab"][aria-selected="true"]', text: 'Nur Alpha', wait: 5)+ expect_titles('Alpha Kickoff')+ saved = SmartFolder.find_by!(name: 'Nur Alpha')+ expect(saved.project_id).to be_nil++ visit organisation_meetings_path(organisation)+ expect_titles('Alpha Kickoff', 'Beta Retro')+ find('[role="tab"]', text: 'Nur Alpha').click+ expect_titles('Alpha Kickoff')++ visit organisation_project_meetings_path(organisation, alpha)+ expect(page).to have_css('[role="tab"]', text: I18n.t('smart_folders.all_meetings'))+ expect(page).to have_no_css('[role="tab"]', text: 'Nur Alpha')+ end++ it 'keeps the conditions of the list after a save from the "+" modal' do+ page.driver.browser.manage.window.resize_to(1440, 1000)+ visit organisation_meetings_path(organisation, filter: { project: [alpha.id] })+ expect_titles('Alpha Kickoff')++ find("button[title='#{I18n.t('views.organisations.meetings_overview.index.new_meeting')}']").click+ select 'Projekt Alpha', from: 'meeting-modal-project'+ within('#meeting_modal_form') do+ fill_in 'meeting[title]', with: 'Alpha Planung'+ click_button I18n.t('views.organisations.meetings.form.save')+ end++ expect(page).to have_no_css('[data-meeting-modal-target="modal"]:not(.hidden)', wait: 5)+ expect_titles('Alpha Planung', 'Alpha Kickoff')+ expect(page).to have_current_path(/filter%5Bproject%5D/)+ end++ it 'fits a phone of 390 px without scrolling sideways' do+ page.driver.browser.manage.window.resize_to(390, 844)+ visit organisation_meetings_path(organisation)++ expect(page).to have_css('#meetings_overview_results li[data-meeting-id]', count: 2, wait: 10)+ expect(page).to have_css('[data-controller="filter-bar"]')+ overflow = page.evaluate_script('document.documentElement.scrollWidth - document.documentElement.clientWidth')+ expect(overflow).to be <= 0+ end+end