From 216def9bdcd9f792f31534e5000ab65b52cfba5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20G=C3=BCnther?= Date: Fri, 4 Apr 2025 08:44:06 +0200 Subject: [PATCH] Remove references to StructuredMeeting, Agenda and Minutes --- .../users/replace_mentions_service.rb | 1 - ...6132134_bigint_primary_and_foreign_keys.rb | 2 +- .../hal/resources/meeting-content-resource.ts | 44 -- .../hal/services/hal-resource.config.ts | 4 - .../dynamic/meeting-content.controller.ts | 70 ---- .../dynamic/meetings/form.controller.ts | 10 +- .../spec/features/calendar_widget_spec.rb | 2 +- .../index_sub_header_component.html.erb | 10 +- .../app/components/meetings/row_component.rb | 1 - .../details_form_component.html.erb | 3 +- .../meeting_agenda_items/create_contract.rb | 3 +- .../meeting_contents/base_contract.rb | 54 --- .../meeting_contents/update_contract.rb | 42 -- .../meeting_sections/create_contract.rb | 3 +- .../app/contracts/meetings/create_contract.rb | 9 +- .../controllers/meeting_agendas_controller.rb | 50 --- .../meeting_contents_controller.rb | 109 ----- .../controllers/meeting_minutes_controller.rb | 39 -- .../app/controllers/meetings_controller.rb | 64 +-- .../recurring_meetings_controller.rb | 4 +- .../app/helpers/meeting_contents_helper.rb | 133 ------ .../meeting/app/helpers/meetings_helper.rb | 5 +- .../activities/meeting_activity_provider.rb | 74 +--- modules/meeting/app/models/meeting.rb | 93 +++-- .../meeting/app/models/meeting_agenda_item.rb | 2 +- .../meeting/app/models/structured_meeting.rb | 86 ---- .../demo_data/meeting_series_seeder.rb | 3 +- .../set_attributes_service.rb | 40 -- .../meeting_contents/update_service.rb | 46 --- .../app/services/meetings/copy_service.rb | 31 +- .../app/services/meetings/create_service.rb | 12 +- .../recurring_meetings/create_service.rb | 2 +- .../app/views/meeting_contents/_form.html.erb | 59 --- .../app/views/meeting_contents/_show.html.erb | 76 ---- .../app/views/meeting_contents/diff.html.erb | 55 --- .../views/meeting_contents/history.html.erb | 148 ------- .../app/views/meeting_contents/show.html.erb | 36 -- .../meeting/app/views/meetings/_form.html.erb | 156 ------- .../meeting/app/views/meetings/edit.html.erb | 38 -- .../meeting/app/views/meetings/new.html.erb | 73 ---- .../meeting/app/views/meetings/show.html.erb | 154 ------- modules/meeting/config/locales/en.yml | 7 +- .../20240405131352_create_meeting_sections.rb | 3 +- .../meeting_agenda_representer.rb | 37 -- .../meeting_content_representer.rb | 58 --- .../meeting_minutes_representer.rb | 37 -- .../api/v3/meetings/meeting_representer.rb | 4 - .../meetings/delete_dialog_component_spec.rb | 2 +- .../components/meetings/row_component_spec.rb | 4 +- .../side_panel/details_component_spec.rb | 4 +- .../delete_dialog_component_spec.rb | 2 +- .../delete_scheduled_dialog_component_spec.rb | 2 +- .../create_contract_spec.rb | 2 +- .../delete_contract_spec.rb | 2 +- .../update_contract_spec.rb | 2 +- .../meeting_contents/update_contract_spec.rb | 56 --- .../meeting_outcomes/create_contract_spec.rb | 2 +- .../meeting_outcomes/delete_contract_spec.rb | 2 +- .../meeting_outcomes/update_contract_spec.rb | 2 +- .../meeting_sections/create_contract_spec.rb | 2 +- .../meeting_sections/delete_contract_spec.rb | 2 +- .../meeting_sections/update_contract_spec.rb | 2 +- .../meetings/create_contract_spec.rb | 2 +- .../meetings/update_contract_spec.rb | 2 +- .../controllers/meetings_controller_spec.rb | 221 ---------- .../spec/factories/meeting_agenda_factory.rb | 34 -- .../factories/meeting_agenda_item_factory.rb | 3 +- .../meeting_content_journal_factory.rb | 33 -- .../meeting/spec/factories/meeting_factory.rb | 9 +- .../spec/factories/meeting_minutes_factory.rb | 34 -- .../spec/factories/meeting_section_factory.rb | 3 +- .../factories/recurring_meeting_factory.rb | 3 +- .../spec/features/meetings_activity_spec.rb | 5 - .../features/meetings_attachments_spec.rb | 79 ---- .../spec/features/meetings_close_spec.rb | 97 ----- .../spec/features/meetings_copy_spec.rb | 133 ------ .../spec/features/meetings_delete_spec.rb | 101 ----- .../spec/features/meetings_locking_spec.rb | 66 --- .../spec/features/meetings_new_spec.rb | 349 ---------------- .../features/meetings_participants_spec.rb | 97 ----- .../spec/features/meetings_search_spec.rb | 3 +- .../spec/features/meetings_show_spec.rb | 183 --------- .../recurring_meeting_create_spec.rb | 6 +- .../recurring_meeting_crud_spec.rb | 3 +- .../recurring_meeting_end_series_spec.rb | 3 +- .../recurring_meeting_global_create_spec.rb | 3 +- .../recurring_meeting_global_crud_spec.rb | 3 +- .../recurring_meeting_move_to_next_spec.rb | 22 +- .../attachment_upload_spec.rb | 7 +- .../structured_meetings/history_spec.rb | 12 +- .../meeting_outcomes_crud_spec.rb | 6 +- .../mobile_structure_meeting_spec.rb | 11 +- .../structured_meeting_crud_spec.rb | 22 +- .../structured_meeting_delete_spec.rb | 5 +- .../structured_meeting_global_crud_spec.rb | 10 +- .../structured_meeting_participant_spec.rb | 11 +- .../structured_meeting_update_flash_spec.rb | 13 +- .../structured_meetings/turbo_links_spec.rb | 12 +- .../work_package_meetings_tab_spec.rb | 30 +- .../spec/mailers/meeting_mailer_spec.rb | 3 - .../meeting_acts_as_journalized_spec.rb | 3 +- .../spec/models/meeting_agenda_item_spec.rb | 3 +- .../spec/models/meeting_agenda_spec.rb | 71 ---- .../spec/models/meeting_minutes_spec.rb | 66 --- .../spec/models/meeting_section_spec.rb | 5 +- modules/meeting/spec/models/meeting_spec.rb | 25 +- .../api/v3/attachments/meeting_agenda_spec.rb | 44 -- .../v3/attachments/meeting_minutes_spec.rb | 44 -- .../spec/requests/meetings_index_spec.rb | 14 +- .../meeting/spec/requests/meetings_spec.rb | 54 +-- .../recurring_meetings_end_series_spec.rb | 4 +- .../recurring_meetings_show_spec.rb | 14 +- ...urring_meetings_template_completed_spec.rb | 3 +- .../spec/routing/previews_routing_spec.rb | 44 -- .../meeting_agenda_items_seeder_spec.rb | 3 +- .../meeting_contents/update_service_spec.rb | 37 -- .../meetings/copy_service_integration_spec.rb | 2 +- .../update_service_integration_spec.rb | 4 +- .../create_service_integration_spec.rb | 6 +- .../history.rb | 3 +- .../spec/support/pages/meetings/index.rb | 20 +- .../mobile/show.rb | 5 +- .../spec/support/pages/meetings/new.rb | 98 ----- .../spec/support/pages/meetings/show.rb | 365 +++++++++++++++- .../support/pages/structured_meeting/show.rb | 388 ------------------ .../init_next_occurrence_job_spec.rb | 17 +- .../activity_eager_loading_wrapper_spec.rb | 10 - .../root_seeder_standard_edition_spec.rb | 18 +- ...eferences_service_call_integration_spec.rb | 22 - ...place_mentions_service_integration_spec.rb | 8 - 130 files changed, 652 insertions(+), 4467 deletions(-) delete mode 100644 frontend/src/app/features/hal/resources/meeting-content-resource.ts delete mode 100644 frontend/src/stimulus/controllers/dynamic/meeting-content.controller.ts delete mode 100644 modules/meeting/app/contracts/meeting_contents/base_contract.rb delete mode 100644 modules/meeting/app/contracts/meeting_contents/update_contract.rb delete mode 100644 modules/meeting/app/controllers/meeting_agendas_controller.rb delete mode 100644 modules/meeting/app/controllers/meeting_contents_controller.rb delete mode 100644 modules/meeting/app/controllers/meeting_minutes_controller.rb delete mode 100644 modules/meeting/app/helpers/meeting_contents_helper.rb delete mode 100644 modules/meeting/app/models/structured_meeting.rb delete mode 100644 modules/meeting/app/services/meeting_contents/set_attributes_service.rb delete mode 100644 modules/meeting/app/services/meeting_contents/update_service.rb delete mode 100644 modules/meeting/app/views/meeting_contents/_form.html.erb delete mode 100644 modules/meeting/app/views/meeting_contents/_show.html.erb delete mode 100644 modules/meeting/app/views/meeting_contents/diff.html.erb delete mode 100644 modules/meeting/app/views/meeting_contents/history.html.erb delete mode 100644 modules/meeting/app/views/meeting_contents/show.html.erb delete mode 100644 modules/meeting/app/views/meetings/_form.html.erb delete mode 100644 modules/meeting/app/views/meetings/edit.html.erb delete mode 100644 modules/meeting/app/views/meetings/new.html.erb delete mode 100644 modules/meeting/app/views/meetings/show.html.erb delete mode 100644 modules/meeting/lib/api/v3/meeting_agendas/meeting_agenda_representer.rb delete mode 100644 modules/meeting/lib/api/v3/meeting_contents/meeting_content_representer.rb delete mode 100644 modules/meeting/lib/api/v3/meeting_minutes/meeting_minutes_representer.rb delete mode 100644 modules/meeting/spec/contracts/meeting_contents/update_contract_spec.rb delete mode 100644 modules/meeting/spec/controllers/meetings_controller_spec.rb delete mode 100644 modules/meeting/spec/factories/meeting_agenda_factory.rb delete mode 100644 modules/meeting/spec/factories/meeting_content_journal_factory.rb delete mode 100644 modules/meeting/spec/factories/meeting_minutes_factory.rb delete mode 100644 modules/meeting/spec/features/meetings_attachments_spec.rb delete mode 100644 modules/meeting/spec/features/meetings_close_spec.rb delete mode 100644 modules/meeting/spec/features/meetings_copy_spec.rb delete mode 100644 modules/meeting/spec/features/meetings_delete_spec.rb delete mode 100644 modules/meeting/spec/features/meetings_locking_spec.rb delete mode 100644 modules/meeting/spec/features/meetings_new_spec.rb delete mode 100644 modules/meeting/spec/features/meetings_participants_spec.rb delete mode 100644 modules/meeting/spec/features/meetings_show_spec.rb delete mode 100644 modules/meeting/spec/models/meeting_agenda_spec.rb delete mode 100644 modules/meeting/spec/models/meeting_minutes_spec.rb delete mode 100644 modules/meeting/spec/requests/api/v3/attachments/meeting_agenda_spec.rb delete mode 100644 modules/meeting/spec/requests/api/v3/attachments/meeting_minutes_spec.rb delete mode 100644 modules/meeting/spec/routing/previews_routing_spec.rb delete mode 100644 modules/meeting/spec/services/meeting_contents/update_service_spec.rb rename modules/meeting/spec/support/pages/{structured_meeting => meetings}/history.rb (98%) rename modules/meeting/spec/support/pages/{structured_meeting => meetings}/mobile/show.rb (95%) delete mode 100644 modules/meeting/spec/support/pages/meetings/new.rb delete mode 100644 modules/meeting/spec/support/pages/structured_meeting/show.rb diff --git a/app/services/users/replace_mentions_service.rb b/app/services/users/replace_mentions_service.rb index e4aface0388..b08aecd4cd9 100644 --- a/app/services/users/replace_mentions_service.rb +++ b/app/services/users/replace_mentions_service.rb @@ -61,7 +61,6 @@ module Users ) SQL }, - { class: MeetingContent, column: :text }, { class: Journal::MeetingContentJournal, column: :text }, { class: Message, column: :content }, { class: Journal::MessageJournal, column: :content }, diff --git a/db/migrate/20221026132134_bigint_primary_and_foreign_keys.rb b/db/migrate/20221026132134_bigint_primary_and_foreign_keys.rb index e458ac17c51..b6ba4cef570 100644 --- a/db/migrate/20221026132134_bigint_primary_and_foreign_keys.rb +++ b/db/migrate/20221026132134_bigint_primary_and_foreign_keys.rb @@ -78,7 +78,7 @@ class BigintPrimaryAndForeignKeys < ActiveRecord::Migration[7.0] LdapGroups::SynchronizedGroup => %i[id group_id auth_source_id], MaterialBudgetItem => %i[id budget_id cost_type_id], Journal::MeetingContentJournal => %i[id meeting_id author_id], - MeetingContent => %i[id meeting_id author_id], + :meeting_contents => %i[id meeting_id author_id], Journal::MeetingJournal => %i[id project_id author_id], MeetingParticipant => %i[id user_id meeting_id], Meeting => %i[id author_id project_id], diff --git a/frontend/src/app/features/hal/resources/meeting-content-resource.ts b/frontend/src/app/features/hal/resources/meeting-content-resource.ts deleted file mode 100644 index 00e80326f49..00000000000 --- a/frontend/src/app/features/hal/resources/meeting-content-resource.ts +++ /dev/null @@ -1,44 +0,0 @@ -//-- copyright -// OpenProject is an open source project management software. -// Copyright (C) the OpenProject GmbH -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License version 3. -// -// OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: -// Copyright (C) 2006-2013 Jean-Philippe Lang -// Copyright (C) 2010-2013 the ChiliProject Team -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -// -// See COPYRIGHT and LICENSE files for more details. -//++ - -import { HalResource } from 'core-app/features/hal/resources/hal-resource'; -import { Attachable } from 'core-app/features/hal/resources/mixins/attachable-mixin'; - -export interface MeetingContentResourceLinks { - addAttachment(attachment:HalResource):Promise; -} - -class MeetingContentBaseResource extends HalResource { - public $links:MeetingContentResourceLinks; - - private attachmentsBackend = false; -} - -export const MeetingContentResource = Attachable(MeetingContentBaseResource); - -export type MeetingContentResource = HalResource; diff --git a/frontend/src/app/features/hal/services/hal-resource.config.ts b/frontend/src/app/features/hal/services/hal-resource.config.ts index 9df85e17d68..251ceda7c95 100644 --- a/frontend/src/app/features/hal/services/hal-resource.config.ts +++ b/frontend/src/app/features/hal/services/hal-resource.config.ts @@ -33,7 +33,6 @@ import { QueryResource } from 'core-app/features/hal/resources/query-resource'; import { CustomActionResource } from 'core-app/features/hal/resources/custom-action-resource'; import { HalResource } from 'core-app/features/hal/resources/hal-resource'; import { WikiPageResource } from 'core-app/features/hal/resources/wiki-page-resource'; -import { MeetingContentResource } from 'core-app/features/hal/resources/meeting-content-resource'; import { PostResource } from 'core-app/features/hal/resources/post-resource'; import { StatusResource } from 'core-app/features/hal/resources/status-resource'; import { AttachmentCollectionResource } from 'core-app/features/hal/resources/attachment-collection-resource'; @@ -185,9 +184,6 @@ const halResourceDefaultConfig:{ [typeName:string]:HalResourceFactoryConfigInter Meeting: { cls: MeetingResource, }, - MeetingContent: { - cls: MeetingContentResource, - }, Post: { cls: PostResource, }, diff --git a/frontend/src/stimulus/controllers/dynamic/meeting-content.controller.ts b/frontend/src/stimulus/controllers/dynamic/meeting-content.controller.ts deleted file mode 100644 index a8c1e8c8791..00000000000 --- a/frontend/src/stimulus/controllers/dynamic/meeting-content.controller.ts +++ /dev/null @@ -1,70 +0,0 @@ -/* - * -- copyright - * OpenProject is an open source project management software. - * Copyright (C) the OpenProject GmbH - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License version 3. - * - * OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: - * Copyright (C) 2006-2013 Jean-Philippe Lang - * Copyright (C) 2010-2013 the ChiliProject Team - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * See COPYRIGHT and LICENSE files for more details. - * ++ - */ - -import { Controller } from '@hotwired/stimulus'; - -export default class MeetingContentController extends Controller { - static targets = [ - 'renderedText', - 'editor', - 'attachments', - 'editButton', - ]; - - static values = { - editState: { type: Boolean, default: false }, - }; - - declare editStateValue:boolean; - - declare readonly renderedTextTarget:HTMLElement; - - declare readonly editorTarget:HTMLElement; - - declare readonly attachmentsTarget:HTMLElement; - - declare readonly editButtonTarget:HTMLLinkElement; - - enableEditState() { - this.editStateValue = true; - } - - cancelEditState() { - this.editStateValue = false; - window.OpenProject.pageWasEdited = false; - } - - editStateValueChanged() { - this.renderedTextTarget.hidden = this.editStateValue; - this.attachmentsTarget.hidden = this.editStateValue; - this.editorTarget.hidden = !this.editStateValue; - this.editButtonTarget.classList.toggle('-active', this.editStateValue); - } -} diff --git a/frontend/src/stimulus/controllers/dynamic/meetings/form.controller.ts b/frontend/src/stimulus/controllers/dynamic/meetings/form.controller.ts index 236c0662de0..37dab0e9f47 100644 --- a/frontend/src/stimulus/controllers/dynamic/meetings/form.controller.ts +++ b/frontend/src/stimulus/controllers/dynamic/meetings/form.controller.ts @@ -36,10 +36,6 @@ export default class OpMeetingsFormController extends ApplicationController { private turboRequests:TurboRequestsService; private pathHelper:PathHelperService; - static values = { structured: Boolean }; - - declare structuredValue:boolean; - async connect() { const context = await window.OpenProject.getPluginContext(); this.turboRequests = context.services.turboRequests; @@ -52,11 +48,7 @@ export default class OpMeetingsFormController extends ApplicationController { let key:string; ['start_date', 'start_time_hour'].forEach((name) => { - if (this.structuredValue === true) { - key = `structured_meeting[${name}]`; - } else { - key = `meeting[${name}]`; - } + key = `meeting[${name}]`; urlSearchParams.append(key, data.get(key) as string); }); diff --git a/modules/calendar/spec/features/calendar_widget_spec.rb b/modules/calendar/spec/features/calendar_widget_spec.rb index 99c2731a422..8957ade0dd3 100644 --- a/modules/calendar/spec/features/calendar_widget_spec.rb +++ b/modules/calendar/spec/features/calendar_widget_spec.rb @@ -41,7 +41,7 @@ RSpec.describe "Calendar Widget", :js, with_settings: { start_of_week: 1 } do due_date: Time.zone.today.beginning_of_week.next_occurring(:thursday)) end shared_let(:meeting) do - create(:structured_meeting, title: "Weekly", project:, start_time: Time.zone.tomorrow + 10.hours) + create(:meeting, title: "Weekly", project:, start_time: Time.zone.tomorrow + 10.hours) end let(:overview_page) do diff --git a/modules/meeting/app/components/meetings/index_sub_header_component.html.erb b/modules/meeting/app/components/meetings/index_sub_header_component.html.erb index 9edf4c9cdc8..5c692d06372 100644 --- a/modules/meeting/app/components/meetings/index_sub_header_component.html.erb +++ b/modules/meeting/app/components/meetings/index_sub_header_component.html.erb @@ -31,7 +31,7 @@ menu.with_item( label: I18n.t("meeting.types.one_time"), tag: :a, - href: polymorphic_path([:new_dialog, @project, :meetings], type: :structured), + href: polymorphic_path([:new_dialog, @project, :meetings]), content_arguments: { data: { controller: "async-dialog" } } ) do |item| item.with_description.with_content(t("meeting.types.structured_text")) @@ -45,14 +45,6 @@ ) do |item| item.with_description.with_content(t("meeting.types.recurring_text")) end - - menu.with_item( - label: I18n.t("meeting.types.classic"), - tag: :a, - href: dynamic_path - ) do |item| - item.with_description.with_content(t("meeting.types.classic_text")) - end end end end diff --git a/modules/meeting/app/components/meetings/row_component.rb b/modules/meeting/app/components/meetings/row_component.rb index 3b82fd4e2bf..3ee43460c5c 100644 --- a/modules/meeting/app/components/meetings/row_component.rb +++ b/modules/meeting/app/components/meetings/row_component.rb @@ -122,7 +122,6 @@ module Meetings href: copy_project_meeting_path(project, model), content_arguments: { data: { - turbo: model.is_a?(StructuredMeeting), turbo_stream: true } }) do |item| diff --git a/modules/meeting/app/components/meetings/side_panel/details_form_component.html.erb b/modules/meeting/app/components/meetings/side_panel/details_form_component.html.erb index 12cc5313487..88155e15281 100644 --- a/modules/meeting/app/components/meetings/side_panel/details_form_component.html.erb +++ b/modules/meeting/app/components/meetings/side_panel/details_form_component.html.erb @@ -6,8 +6,7 @@ data: { turbo: true, turbo_stream: true, controller: "meetings--form", - "application-target": "dynamic", - "meetings--form-structured-value": true }, + "application-target": "dynamic" }, url: update_details_project_meeting_path(@project, @meeting) ) do |f| component_collection do |collection| diff --git a/modules/meeting/app/contracts/meeting_agenda_items/create_contract.rb b/modules/meeting/app/contracts/meeting_agenda_items/create_contract.rb index 366e50470f7..3f24fdf397c 100644 --- a/modules/meeting/app/contracts/meeting_agenda_items/create_contract.rb +++ b/modules/meeting/app/contracts/meeting_agenda_items/create_contract.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + #-- copyright # OpenProject is an open source project management software. # Copyright (C) the OpenProject GmbH @@ -34,7 +35,7 @@ module MeetingAgendaItems validate :user_allowed_to_add, :validate_meeting_existence def self.assignable_meetings(user) - StructuredMeeting + Meeting .open .not_templated .not_cancelled diff --git a/modules/meeting/app/contracts/meeting_contents/base_contract.rb b/modules/meeting/app/contracts/meeting_contents/base_contract.rb deleted file mode 100644 index 3948bec28c8..00000000000 --- a/modules/meeting/app/contracts/meeting_contents/base_contract.rb +++ /dev/null @@ -1,54 +0,0 @@ -# frozen_string_literal: true -#-- copyright -# OpenProject is an open source project management software. -# Copyright (C) the OpenProject GmbH -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License version 3. -# -# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: -# Copyright (C) 2006-2013 Jean-Philippe Lang -# Copyright (C) 2010-2013 the ChiliProject Team -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# See COPYRIGHT and LICENSE files for more details. -#++ - -module MeetingContents - class BaseContract < ::ModelContract - include Attachments::ValidateReplacements - - def self.model - MeetingContent - end - - attribute :meeting - attribute :text - attribute :lock_version - attribute :locked - attribute :type - - validate :type_in_allowed - - private - - def type_in_allowed - unless [MeetingAgenda.name, MeetingMinutes.name].include?(model.type) - errors.add(:type, :inclusion) - end - end - end -end diff --git a/modules/meeting/app/contracts/meeting_contents/update_contract.rb b/modules/meeting/app/contracts/meeting_contents/update_contract.rb deleted file mode 100644 index 415f23d82b3..00000000000 --- a/modules/meeting/app/contracts/meeting_contents/update_contract.rb +++ /dev/null @@ -1,42 +0,0 @@ -# frozen_string_literal: true -#-- copyright -# OpenProject is an open source project management software. -# Copyright (C) the OpenProject GmbH -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License version 3. -# -# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: -# Copyright (C) 2006-2013 Jean-Philippe Lang -# Copyright (C) 2010-2013 the ChiliProject Team -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# See COPYRIGHT and LICENSE files for more details. -#++ - -module MeetingContents - class UpdateContract < BaseContract - validate :validate_editable - - private - - def validate_editable - unless model.editable? - errors.add :base, :error_readonly - end - end - end -end diff --git a/modules/meeting/app/contracts/meeting_sections/create_contract.rb b/modules/meeting/app/contracts/meeting_sections/create_contract.rb index 77f4c6e5de4..ec0c7a7bcad 100644 --- a/modules/meeting/app/contracts/meeting_sections/create_contract.rb +++ b/modules/meeting/app/contracts/meeting_sections/create_contract.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + #-- copyright # OpenProject is an open source project management software. # Copyright (C) the OpenProject GmbH @@ -40,7 +41,7 @@ module MeetingSections :validate_meeting_existence def self.assignable_meetings(user) - StructuredMeeting + Meeting .open .visible(user) end diff --git a/modules/meeting/app/contracts/meetings/create_contract.rb b/modules/meeting/app/contracts/meetings/create_contract.rb index 83ab09d5a77..e69e334d292 100644 --- a/modules/meeting/app/contracts/meetings/create_contract.rb +++ b/modules/meeting/app/contracts/meetings/create_contract.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + #-- copyright # OpenProject is an open source project management software. # Copyright (C) the OpenProject GmbH @@ -29,21 +30,13 @@ module Meetings class CreateContract < BaseContract - attribute :type attribute :recurring_meeting_id validate :user_allowed_to_add - validate :type_in_allowed validate :recurring_meeting_visible private - def type_in_allowed - unless [StructuredMeeting.name, Meeting.name].include?(model.type) - errors.add(:type, :inclusion) - end - end - def user_allowed_to_add return if model.project.nil? diff --git a/modules/meeting/app/controllers/meeting_agendas_controller.rb b/modules/meeting/app/controllers/meeting_agendas_controller.rb deleted file mode 100644 index 1c1888126bd..00000000000 --- a/modules/meeting/app/controllers/meeting_agendas_controller.rb +++ /dev/null @@ -1,50 +0,0 @@ -# frozen_string_literal: true -#-- copyright -# OpenProject is an open source project management software. -# Copyright (C) the OpenProject GmbH -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License version 3. -# -# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: -# Copyright (C) 2006-2013 Jean-Philippe Lang -# Copyright (C) 2010-2013 the ChiliProject Team -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# See COPYRIGHT and LICENSE files for more details. -#++ - -class MeetingAgendasController < MeetingContentsController - menu_item :meetings - - def close - @meeting.close_agenda_and_copy_to_minutes! - - redirect_back_or_default({ controller: "/meetings", action: "show", id: @meeting }) - end - - def open - @content.unlock! - redirect_back_or_default({ controller: "/meetings", action: "show", id: @meeting }) - end - - private - - def find_content - @content = @meeting.agenda || @meeting.build_agenda - @content_type = "meeting_agenda" - end -end diff --git a/modules/meeting/app/controllers/meeting_contents_controller.rb b/modules/meeting/app/controllers/meeting_contents_controller.rb deleted file mode 100644 index a40e4e37932..00000000000 --- a/modules/meeting/app/controllers/meeting_contents_controller.rb +++ /dev/null @@ -1,109 +0,0 @@ -# frozen_string_literal: true -#-- copyright -# OpenProject is an open source project management software. -# Copyright (C) the OpenProject GmbH -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License version 3. -# -# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: -# Copyright (C) 2006-2013 Jean-Philippe Lang -# Copyright (C) 2010-2013 the ChiliProject Team -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# See COPYRIGHT and LICENSE files for more details. -#++ - -class MeetingContentsController < ApplicationController - include AttachableServiceCall - include PaginationHelper - - menu_item :meetings - - helper :watchers - helper :wiki - helper :meetings - helper :meeting_contents - helper :watchers - helper :meetings - - before_action :load_and_authorize_in_optional_project - before_action :find_meeting, :find_content - - def show # rubocop:disable Metrics/AbcSize - if params[:id].present? && @content.last_journal.version == params[:id].to_i - # Redirect links to the last version - redirect_to project_meeting_path(@project, @meeting, tab: @content_type.sub(/^meeting_/, "")) - return - end - - # go to an old version if a version id is given - @journaled_version = true - @content = @content.at_version params[:id] if params[:id].present? - render "meeting_contents/show" - end - - def update # rubocop:disable Metrics/AbcSize - call = attachable_update_call ::MeetingContents::UpdateService, - model: @content, - args: content_params - - if call.success? - flash[:notice] = I18n.t(:notice_successful_update) - redirect_back_or_default project_meeting_path(@project, @meeting) - else - flash.now[:error] = call.message - params[:tab] ||= "minutes" if @meeting.agenda.present? && @meeting.agenda.locked? - render "meetings/show", status: :unprocessable_entity - end - end - - def history - # don't load text - @content_versions = @content.journals.select("id, user_id, notes, created_at, version") - .order(Arel.sql("version DESC")) - .page(page_param) - .per_page(per_page_param) - - render "meeting_contents/history", layout: !request.xhr? - end - - def diff - @diff = @content.diff(params[:version_to], params[:version_from]) - render "meeting_contents/diff" - rescue ActiveRecord::RecordNotFound - render_404 - end - - def default_breadcrumb - MeetingsController.new.send(:default_breadcrumb) - end - - private - - def find_meeting - @meeting = Meeting.includes(:project, :author, :participants, :agenda, :minutes) - .find(params[:meeting_id]) - @project = @meeting.project - @author = User.current - rescue ActiveRecord::RecordNotFound - render_404 - end - - def content_params - params.require(@content_type).permit(:text, :lock_version, :journal_notes) - end -end diff --git a/modules/meeting/app/controllers/meeting_minutes_controller.rb b/modules/meeting/app/controllers/meeting_minutes_controller.rb deleted file mode 100644 index 493ab6efcef..00000000000 --- a/modules/meeting/app/controllers/meeting_minutes_controller.rb +++ /dev/null @@ -1,39 +0,0 @@ -# frozen_string_literal: true -#-- copyright -# OpenProject is an open source project management software. -# Copyright (C) the OpenProject GmbH -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License version 3. -# -# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: -# Copyright (C) 2006-2013 Jean-Philippe Lang -# Copyright (C) 2010-2013 the ChiliProject Team -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# See COPYRIGHT and LICENSE files for more details. -#++ - -class MeetingMinutesController < MeetingContentsController - menu_item :meetings - - private - - def find_content - @content = @meeting.minutes || @meeting.build_minutes - @content_type = "meeting_minutes" - end -end diff --git a/modules/meeting/app/controllers/meetings_controller.rb b/modules/meeting/app/controllers/meetings_controller.rb index 3a49a1af0a3..68487cbe237 100644 --- a/modules/meeting/app/controllers/meetings_controller.rb +++ b/modules/meeting/app/controllers/meetings_controller.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + #-- copyright # OpenProject is an open source project management software. # Copyright (C) the OpenProject GmbH @@ -41,7 +42,6 @@ class MeetingsController < ApplicationController before_action :prevent_template_destruction, only: :destroy helper :watchers - helper :meeting_contents include MeetingsHelper include Layout include WatchersHelper @@ -67,18 +67,14 @@ class MeetingsController < ApplicationController :meetings end - def show # rubocop:disable Metrics/AbcSize + def show respond_to do |format| format.html do html_title "#{t(:label_meeting)}: #{@meeting.title}" - if @meeting.is_a?(StructuredMeeting) - if @meeting.state == "cancelled" - render_404 - else - render(Meetings::ShowComponent.new(meeting: @meeting), layout: true) - end - elsif @meeting.agenda.present? && @meeting.agenda.locked? - params[:tab] ||= "minutes" + if @meeting.state == "cancelled" + render_404 + else + render(Meetings::ShowComponent.new(meeting: @meeting), layout: true) end end end @@ -256,7 +252,7 @@ class MeetingsController < ApplicationController end def update_title - @meeting.update(title: structured_meeting_params[:title]) + @meeting.update(title: meeting_params[:title]) if @meeting.errors.any? update_header_component_via_turbo_stream(state: :edit) @@ -270,7 +266,7 @@ class MeetingsController < ApplicationController def update_details call = ::Meetings::UpdateService .new(user: current_user, model: @meeting) - .call(structured_meeting_params) + .call(meeting_params) if call.success? update_header_component_via_turbo_stream @@ -337,9 +333,7 @@ class MeetingsController < ApplicationController @text = friendly_timezone_name(User.current.time_zone, period: meeting.start_time) end - prefix = params[:structured_meeting] ? "structured_" : "" - - add_caption_to_input_element_via_turbo_stream("input[name='#{prefix}meeting[start_time_hour]']", + add_caption_to_input_element_via_turbo_stream("input[name='meeting[start_time_hour]']", caption: @text, clean_other_captions: true) @@ -420,7 +414,12 @@ class MeetingsController < ApplicationController end def build_meeting - meeting = meeting_class.new + meeting = + if params[:type] == "recurring" + RecurringMeeting.new + else + Meeting.new + end service = meeting.is_a?(RecurringMeeting) ? ::RecurringMeetings::SetAttributesService : ::Meetings::SetAttributesService call = service @@ -430,17 +429,6 @@ class MeetingsController < ApplicationController @meeting = call.result end - def meeting_class - case params[:type] - when "recurring" - RecurringMeeting - when "structured" - StructuredMeeting - else - Meeting - end - end - def global_upcoming_meetings projects = Project.allowed_in_project(User.current, :view_meetings) @@ -449,7 +437,7 @@ class MeetingsController < ApplicationController def find_meeting @meeting = Meeting - .includes([:project, :author, { participants: :user }, :agenda, :minutes]) + .includes([:project, :author, { participants: :user }, :sections, { agenda_items: :outcomes }]) .find(params[:id]) rescue ActiveRecord::RecordNotFound render_404 @@ -466,7 +454,7 @@ class MeetingsController < ApplicationController # Handle participants separately for each meeting type @converted_params[:participants_attributes] ||= {} - if copy_structured_meeting_participants? + if copy_meeting_participants? create_participants else force_defaults @@ -481,19 +469,11 @@ class MeetingsController < ApplicationController params .require(:meeting) .permit(:title, :location, :start_time, :project_id, - :duration, :start_date, :start_time_hour, :type, + :duration, :start_date, :start_time_hour, participants_attributes: %i[email name invited attended user user_id meeting id]) end end - def structured_meeting_params - if params[:structured_meeting].present? - params - .require(:structured_meeting) - .permit(:title, :location, :start_time_hour, :duration, :start_date, :state, :lock_version) - end - end - def set_activity @activity = Activities::Fetcher.new(User.current, project: @project, @@ -559,12 +539,6 @@ class MeetingsController < ApplicationController end def timezone_params - meeting_params = if params[:meeting] - params.require(:meeting) - else - params.require(:structured_meeting) - end - - @timezone_params ||= meeting_params.permit(:start_date, :start_time_hour).compact_blank + @timezone_params ||= params.require(:meeting).permit(:start_date, :start_time_hour).compact_blank end end diff --git a/modules/meeting/app/controllers/recurring_meetings_controller.rb b/modules/meeting/app/controllers/recurring_meetings_controller.rb index 5d32f654607..a7cbf82bd7d 100644 --- a/modules/meeting/app/controllers/recurring_meetings_controller.rb +++ b/modules/meeting/app/controllers/recurring_meetings_controller.rb @@ -346,9 +346,9 @@ class RecurringMeetingsController < ApplicationController end def structured_meeting_params - if params[:structured_meeting].present? + if params[:meeting].present? params - .require(:structured_meeting) + .require(:meeting) end end diff --git a/modules/meeting/app/helpers/meeting_contents_helper.rb b/modules/meeting/app/helpers/meeting_contents_helper.rb deleted file mode 100644 index 9f049ca8617..00000000000 --- a/modules/meeting/app/helpers/meeting_contents_helper.rb +++ /dev/null @@ -1,133 +0,0 @@ -# frozen_string_literal: true -#-- copyright -# OpenProject is an open source project management software. -# Copyright (C) the OpenProject GmbH -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License version 3. -# -# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: -# Copyright (C) 2006-2013 Jean-Philippe Lang -# Copyright (C) 2010-2013 the ChiliProject Team -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# See COPYRIGHT and LICENSE files for more details. -#++ - -module MeetingContentsHelper - def can_edit_meeting_content?(content, content_type) - authorize_for(content_type.pluralize, "update") && content.editable? - end - - def saved_meeting_content_text_present?(content) - !content.new_record? && content.text.present? && !content.text.empty? - end - - def show_meeting_content_editor?(content, content_type) - can_edit_meeting_content?(content, content_type) && (!saved_meeting_content_text_present?(content) || content.changed?) - end - - def meeting_content_context_menu(content, content_type) - menu = [] - menu << meeting_agenda_toggle_status_link(content, content_type) - menu << meeting_content_edit_link(content_type) if can_edit_meeting_content?(content, content_type) - menu << meeting_content_history_link(content_type, content.meeting) - - menu.join(" ") - end - - def meeting_agenda_toggle_status_link(content, content_type) - if content.meeting.agenda.present? && content.meeting.agenda.locked? - open_meeting_agenda_link(content_type, content.meeting) - else - close_meeting_agenda_link(content_type, content.meeting) - end - end - - def close_meeting_agenda_link(content_type, meeting) - case content_type - when "meeting_agenda" - content_tag :li, "", class: "toolbar-item" do - link_to_if_authorized({ controller: "/meeting_agendas", - action: "close", - meeting_id: meeting }, - method: :put, - data: { confirm: I18n.t(:text_meeting_closing_are_you_sure) }, - class: "meetings--close-meeting-button button") do - text_with_icon(I18n.t(:label_meeting_close), "icon-locked") - end - end - when "meeting_minutes" - content_tag :li, "", class: "toolbar-item" do - link_to_if_authorized({ controller: "/meeting_agendas", - action: "close", - meeting_id: meeting }, - method: :put, - class: "button") do - text_with_icon(I18n.t(:label_meeting_agenda_close), "icon-locked") - end - end - end - end - - def open_meeting_agenda_link(content_type, meeting) - return unless content_type == "meeting_agenda" - - content_tag :li, "", class: "toolbar-item" do - link_to_if_authorized({ controller: "/meeting_agendas", - action: "open", - meeting_id: meeting }, - method: :put, - class: "button", - data: { confirm: I18n.t(:text_meeting_agenda_open_are_you_sure) }) do - text_with_icon(I18n.t(:label_meeting_open), "icon-unlocked") - end - end - end - - def meeting_content_edit_link(_content_type) - content_tag :li, "", class: "toolbar-item" do - link_to "", - class: "button button--edit-agenda", - data: { - action: "meeting-content#enableEditState", - "meeting-content-target": "editButton" - }, - accesskey: accesskey(:edit) do - text_with_icon(I18n.t(:label_edit), "icon-edit") - end - end - end - - def meeting_content_history_link(content_type, meeting) - content_tag :li, "", class: "toolbar-item" do - link_to_if_authorized({ controller: "/" + content_type.pluralize, - action: "history", - meeting_id: meeting }, - aria: { label: t(:label_history) }, - title: t(:label_history), - class: "button") do - text_with_icon(I18n.t(:label_history), "icon-activity-history") - end - end - end - - def text_with_icon(text, icon) - op_icon("button--icon #{icon}") + - " " + - content_tag("span", text, class: "button--text") - end -end diff --git a/modules/meeting/app/helpers/meetings_helper.rb b/modules/meeting/app/helpers/meetings_helper.rb index 26431138ead..09cac2c8b78 100644 --- a/modules/meeting/app/helpers/meetings_helper.rb +++ b/modules/meeting/app/helpers/meetings_helper.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + #-- copyright # OpenProject is an open source project management software. # Copyright (C) the OpenProject GmbH @@ -86,8 +87,8 @@ module MeetingsHelper request.path == meetings_path && @project.nil? end - def copy_structured_meeting_participants? - @copy_from.is_a?(StructuredMeeting) && params[:meeting][:copy_participants] == "1" + def copy_meeting_participants? + params[:meeting][:copy_participants] == "1" end def create_participants diff --git a/modules/meeting/app/models/activities/meeting_activity_provider.rb b/modules/meeting/app/models/activities/meeting_activity_provider.rb index 287db51c4bb..ae96497d5e9 100644 --- a/modules/meeting/app/models/activities/meeting_activity_provider.rb +++ b/modules/meeting/app/models/activities/meeting_activity_provider.rb @@ -29,20 +29,9 @@ class Activities::MeetingActivityProvider < Activities::BaseActivityProvider activity_provider_for type: "meetings", - activities: %i[meeting meeting_content], + activities: %i[meeting], permission: :view_meetings - def extend_event_query(query) - case activity - when :meeting_content - query.join(meetings_table).on(activity_journals_table[:meeting_id].eq(meetings_table[:id])) - join_cond = journals_table[:journable_type].eq("MeetingContent") - query.join(meeting_contents_table).on(journals_table[:journable_id].eq(meeting_contents_table[:id]).and(join_cond)) - else - super - end - end - def event_query_projection case activity when :meeting @@ -54,7 +43,6 @@ class Activities::MeetingActivityProvider < Activities::BaseActivityProvider ] else [ - projection_statement(meeting_contents_table, :type, "meeting_content_type"), projection_statement(meetings_table, :id, "meeting_id"), projection_statement(meetings_table, :title, "meeting_title"), projection_statement(meetings_table, :project_id, "project_id") @@ -63,7 +51,7 @@ class Activities::MeetingActivityProvider < Activities::BaseActivityProvider end def activitied_type - activity == :meeting ? Meeting : MeetingContent + Meeting end def projects_reference_table @@ -76,56 +64,30 @@ class Activities::MeetingActivityProvider < Activities::BaseActivityProvider end def activity_journals_table - @activity_journals_table ||= case activity - when :meeting - Meeting.journal_class.arel_table - else - MeetingContent.journal_class.arel_table - end + @activity_journals_table ||= Meeting.journal_class.arel_table end protected - def event_name(event) - case event["event_description"] - when "Agenda closed" - I18n.t("meeting_agenda_closed", scope: "events") - when "Agenda opened" - I18n.t("meeting_agenda_opened", scope: "events") - when "Minutes created" - I18n.t("meeting_minutes_created", scope: "events") - else - super - end - end - def event_title(event) - case activity - when :meeting - start_time = if event["meeting_start_time"].is_a?(String) - DateTime.parse(event["meeting_start_time"]) - else - event["meeting_start_time"] - end - end_time = start_time + event["meeting_duration"].to_f.hours + start_time = + if event["meeting_start_time"].is_a?(String) + DateTime.parse(event["meeting_start_time"]) + else + event["meeting_start_time"] + end - fstart_with = format_date start_time - fstart_without = format_time start_time, include_date: false - fend_without = format_time end_time, include_date: false + end_time = start_time + event["meeting_duration"].to_f.hours - "#{I18n.t(:label_meeting)}: #{event['meeting_title']} (#{fstart_with} #{fstart_without}-#{fend_without})" - else - "#{event['meeting_content_type'].constantize.model_name.human}: #{event['meeting_title']}" - end + fstart_with = format_date start_time + fstart_without = format_time start_time, include_date: false + fend_without = format_time end_time, include_date: false + + "#{I18n.t(:label_meeting)}: #{event['meeting_title']} (#{fstart_with} #{fstart_without}-#{fend_without})" end def event_type(event) - case activity - when :meeting - "meeting" - else - event["meeting_content_type"].include?("Agenda") ? "meeting-agenda" : "meeting-minutes" - end + "meeting" end def event_path(event) @@ -160,10 +122,6 @@ class Activities::MeetingActivityProvider < Activities::BaseActivityProvider @meetings_table ||= Meeting.arel_table end - def meeting_contents_table - @meeting_contents_table ||= MeetingContent.arel_table - end - def activity_id(event) activity == :meeting ? event["journable_id"] : event["meeting_id"] end diff --git a/modules/meeting/app/models/meeting.rb b/modules/meeting/app/models/meeting.rb index 8a939351f8e..1d1b77d3c44 100644 --- a/modules/meeting/app/models/meeting.rb +++ b/modules/meeting/app/models/meeting.rb @@ -41,17 +41,17 @@ class Meeting < ApplicationRecord belongs_to :recurring_meeting, optional: true has_one :scheduled_meeting, inverse_of: :meeting - has_one :agenda, dependent: :destroy, class_name: "MeetingAgenda" - has_one :minutes, dependent: :destroy, class_name: "MeetingMinutes" - has_many :contents, -> { readonly }, class_name: "MeetingContent" - has_many :participants, dependent: :destroy, class_name: "MeetingParticipant", after_add: :send_participant_added_mail has_many :sections, dependent: :destroy, class_name: "MeetingSection" - has_many :agenda_items, dependent: :destroy, class_name: "MeetingAgendaItem" + has_many :agenda_items, + class_name: "MeetingAgendaItem", + inverse_of: :meeting + + accepts_nested_attributes_for :agenda_items scope :templated, -> { where(template: true) } scope :not_templated, -> { where(template: false) } @@ -91,12 +91,12 @@ class Meeting < ApplicationRecord acts_as_searchable columns: [ "#{table_name}.title", - "#{MeetingContent.table_name}.text", "#{MeetingAgendaItem.table_name}.title", - "#{MeetingAgendaItem.table_name}.notes" + "#{MeetingAgendaItem.table_name}.notes", + "#{MeetingOutcome.table_name}.notes" ], - include: %i[contents project agenda_items], - references: %i[meeting_contents agenda_items], + include: [:project, { agenda_items: :outcomes }], + references: %i[agenda_items outcomes], date_column: "#{table_name}.created_at" include Meeting::Journalized @@ -157,10 +157,6 @@ class Meeting < ApplicationRecord title end - def text - agenda.text if agenda.present? - end - def templated? !!template end @@ -207,28 +203,6 @@ class Meeting < ApplicationRecord by_start_year_month_date end - def close_agenda_and_copy_to_minutes! - Meeting.transaction do - agenda.lock! - - attachments = agenda.attachments.map { |a| [a, a.copy] } - original_text = String(agenda.text) - minutes = create_minutes(text: original_text, - journal_notes: I18n.t("events.meeting_minutes_created"), - attachments: attachments.map(&:last)) - - # substitute attachment references in text to use the respective copied attachments - updated_text = original_text.gsub(/(?<=\(\/api\/v3\/attachments\/)\d+(?=\/content\))/) do |id| - old_id = id.to_i - new_id = attachments.select { |a, _| a.id == old_id }.map { |_, a| a.id }.first - - new_id || -1 - end - - minutes.update text: updated_text if updated_text != original_text - end - end - alias :original_participants_attributes= :participants_attributes= def participants_attributes=(attrs) @@ -249,6 +223,55 @@ class Meeting < ApplicationRecord .where(user_id: available_members) end + # triggered by MeetingAgendaItem#after_create/after_destroy/after_save + def calculate_agenda_item_time_slots + current_time = start_time + MeetingAgendaItem.transaction do + changed_items = agenda_items.includes(:meeting_section).order("meeting_sections.position", :position).map do |top| + start_time = current_time + current_time += top.duration_in_minutes&.minutes || 0.minutes + end_time = current_time + top.assign_attributes(start_time:, end_time:) + top + end + + # Disable optimistic locking in order to avoid causing `StaleObjectError`. + MeetingAgendaItem.skip_optimistic_locking do + MeetingAgendaItem.import( + changed_items, + on_duplicate_key_update: { + conflict_target: [:id], + columns: %i[meeting_id + author_id + title + notes + position + duration_in_minutes + start_time + end_time + created_at + updated_at + work_package_id + item_type + lock_version] + } + ) + end + end + end + + def agenda_items_sum_duration_in_minutes + agenda_items.sum(:duration_in_minutes) + end + + def duration_exceeded_by_agenda_items? + agenda_items_sum_duration_in_minutes > (duration * 60) + end + + def duration_exceeded_by_agenda_items_in_minutes + agenda_items_sum_duration_in_minutes - (duration * 60) + end + private def add_new_participants_as_watcher diff --git a/modules/meeting/app/models/meeting_agenda_item.rb b/modules/meeting/app/models/meeting_agenda_item.rb index 41ecf554866..8b525f100e3 100644 --- a/modules/meeting/app/models/meeting_agenda_item.rb +++ b/modules/meeting/app/models/meeting_agenda_item.rb @@ -37,7 +37,7 @@ class MeetingAgendaItem < ApplicationRecord enum :item_type, ITEM_TYPES - belongs_to :meeting, class_name: "StructuredMeeting" + belongs_to :meeting belongs_to :meeting_section, optional: false belongs_to :work_package, class_name: "::WorkPackage" has_one :project, through: :meeting diff --git a/modules/meeting/app/models/structured_meeting.rb b/modules/meeting/app/models/structured_meeting.rb deleted file mode 100644 index 27bb9af5029..00000000000 --- a/modules/meeting/app/models/structured_meeting.rb +++ /dev/null @@ -1,86 +0,0 @@ -# frozen_string_literal: true -#-- copyright -# OpenProject is an open source project management software. -# Copyright (C) the OpenProject GmbH -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License version 3. -# -# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: -# Copyright (C) 2006-2013 Jean-Philippe Lang -# Copyright (C) 2010-2013 the ChiliProject Team -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# See COPYRIGHT and LICENSE files for more details. -#++ - -class StructuredMeeting < Meeting - has_many :agenda_items, - dependent: :destroy, - foreign_key: "meeting_id", - class_name: "MeetingAgendaItem", - inverse_of: :meeting - accepts_nested_attributes_for :agenda_items - - # triggered by MeetingAgendaItem#after_create/after_destroy/after_save - def calculate_agenda_item_time_slots - current_time = start_time - MeetingAgendaItem.transaction do - changed_items = agenda_items.includes(:meeting_section).order("meeting_sections.position", :position).map do |top| - start_time = current_time - current_time += top.duration_in_minutes&.minutes || 0.minutes - end_time = current_time - top.assign_attributes(start_time:, end_time:) - top - end - - # Disable optimistic locking in order to avoid causing `StaleObjectError`. - MeetingAgendaItem.skip_optimistic_locking do - MeetingAgendaItem.import( - changed_items, - on_duplicate_key_update: { - conflict_target: [:id], - columns: %i[meeting_id - author_id - title - notes - position - duration_in_minutes - start_time - end_time - created_at - updated_at - work_package_id - item_type - lock_version] - } - ) - end - end - end - - def agenda_items_sum_duration_in_minutes - agenda_items.sum(:duration_in_minutes) - end - - def duration_exceeded_by_agenda_items? - agenda_items_sum_duration_in_minutes > (duration * 60) - end - - def duration_exceeded_by_agenda_items_in_minutes - agenda_items_sum_duration_in_minutes - (duration * 60) - end -end diff --git a/modules/meeting/app/seeders/meetings/demo_data/meeting_series_seeder.rb b/modules/meeting/app/seeders/meetings/demo_data/meeting_series_seeder.rb index c740bf50352..8a6ad74d00a 100644 --- a/modules/meeting/app/seeders/meetings/demo_data/meeting_series_seeder.rb +++ b/modules/meeting/app/seeders/meetings/demo_data/meeting_series_seeder.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + #-- copyright # OpenProject is an open source project management software. # Copyright (C) the OpenProject GmbH @@ -51,7 +52,7 @@ module Meetings end def create_meeting_template!(series, model_data) - template = StructuredMeeting.new(template_attributes(model_data)) + template = Meeting.new(template_attributes(model_data)) template.template = true template.recurring_meeting = series diff --git a/modules/meeting/app/services/meeting_contents/set_attributes_service.rb b/modules/meeting/app/services/meeting_contents/set_attributes_service.rb deleted file mode 100644 index 67fbe5cddc2..00000000000 --- a/modules/meeting/app/services/meeting_contents/set_attributes_service.rb +++ /dev/null @@ -1,40 +0,0 @@ -# frozen_string_literal: true -#-- copyright -# OpenProject is an open source project management software. -# Copyright (C) the OpenProject GmbH -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License version 3. -# -# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: -# Copyright (C) 2006-2013 Jean-Philippe Lang -# Copyright (C) 2010-2013 the ChiliProject Team -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# See COPYRIGHT and LICENSE files for more details. -#++ - -module MeetingContents - class SetAttributesService < ::BaseServices::SetAttributes - include Attachments::SetReplacements - - def set_default_attributes(_params) - model.change_by_system do - model.author = user if model.author.nil? - end - end - end -end diff --git a/modules/meeting/app/services/meeting_contents/update_service.rb b/modules/meeting/app/services/meeting_contents/update_service.rb deleted file mode 100644 index 0436452db9f..00000000000 --- a/modules/meeting/app/services/meeting_contents/update_service.rb +++ /dev/null @@ -1,46 +0,0 @@ -# frozen_string_literal: true -#-- copyright -# OpenProject is an open source project management software. -# Copyright (C) the OpenProject GmbH -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License version 3. -# -# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: -# Copyright (C) 2006-2013 Jean-Philippe Lang -# Copyright (C) 2010-2013 the ChiliProject Team -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# See COPYRIGHT and LICENSE files for more details. -#++ - -module MeetingContents - class UpdateService < ::BaseServices::Update - include Attachments::ReplaceAttachments - - def persist(call) - content = call.result - - if content.lock_version_changed? - call.errors.add(:base, I18n.t(:notice_locking_conflict)) - call.success = false - return call - end - - super - end - end -end diff --git a/modules/meeting/app/services/meetings/copy_service.rb b/modules/meeting/app/services/meetings/copy_service.rb index 544530ecb5a..dd06a393a32 100644 --- a/modules/meeting/app/services/meetings/copy_service.rb +++ b/modules/meeting/app/services/meetings/copy_service.rb @@ -114,31 +114,14 @@ module Meetings end def copy_meeting_agenda(copy) - if meeting.is_a?(StructuredMeeting) - meeting.sections.each do |section| - copy.sections << section.dup - copied_section = copy.reload.sections.last - section.agenda_items.each do |agenda_item| - copied_agenda_item = agenda_item.dup - copied_agenda_item.meeting_id = copy.id - copied_section.agenda_items << copied_agenda_item - end + meeting.sections.each do |section| + copy.sections << section.dup + copied_section = copy.reload.sections.last + section.agenda_items.each do |agenda_item| + copied_agenda_item = agenda_item.dup + copied_agenda_item.meeting_id = copy.id + copied_section.agenda_items << copied_agenda_item end - else - MeetingAgenda.create!( - meeting: copy, - author: user, - text: meeting.agenda&.text, - journal_notes: I18n.t("meeting.copied", id: meeting.id) - ) - end - end - - def copy_structured_meeting_participants(copy) - meeting.participants.each do |participant| - copied_participant = participant.dup - copied_participant.meeting_id = copy.id - copy.participants << copied_participant end end end diff --git a/modules/meeting/app/services/meetings/create_service.rb b/modules/meeting/app/services/meetings/create_service.rb index b617d8eab90..ca377ee673f 100644 --- a/modules/meeting/app/services/meetings/create_service.rb +++ b/modules/meeting/app/services/meetings/create_service.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + #-- copyright # OpenProject is an open source project management software. # Copyright (C) the OpenProject GmbH @@ -31,17 +32,6 @@ module Meetings class CreateService < ::BaseServices::Create protected - def instance(params) - # Setting the #type as attributes will not work - # as the STI instance is not changed without using e.g., +becomes!+ - case params.delete(:type) - when "StructuredMeeting" - StructuredMeeting.new - else - Meeting.new - end - end - def after_perform(call) if call.success? && Journal::NotificationConfiguration.active? meeting = call.result diff --git a/modules/meeting/app/services/recurring_meetings/create_service.rb b/modules/meeting/app/services/recurring_meetings/create_service.rb index 6cf2b3d0831..19cd50bdb82 100644 --- a/modules/meeting/app/services/recurring_meetings/create_service.rb +++ b/modules/meeting/app/services/recurring_meetings/create_service.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + #-- copyright # OpenProject is an open source project management software. # Copyright (C) the OpenProject GmbH @@ -44,7 +45,6 @@ module RecurringMeetings def create_meeting_template(recurring_meeting) params = @template_params.merge( - type: "StructuredMeeting", template: true, recurring_meeting:, project: recurring_meeting.project diff --git a/modules/meeting/app/views/meeting_contents/_form.html.erb b/modules/meeting/app/views/meeting_contents/_form.html.erb deleted file mode 100644 index a38011010ea..00000000000 --- a/modules/meeting/app/views/meeting_contents/_form.html.erb +++ /dev/null @@ -1,59 +0,0 @@ -<%#-- copyright -OpenProject is an open source project management software. -Copyright (C) the OpenProject GmbH - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License version 3. - -OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: -Copyright (C) 2006-2013 Jean-Philippe Lang -Copyright (C) 2010-2013 the ChiliProject Team - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - -See COPYRIGHT and LICENSE files for more details. - -++#%> - -<%= labelled_tabular_form_for content, :url => {:controller => '/' + content_type.pluralize, :action => 'update', :meeting_id => content.meeting}, :html => {:id => "#{content_type}_form", :method => :put} do |f| %> - <%= error_messages_for content_type %> - - <% resource = ::API::V3::MeetingContents::MeetingContentRepresenter.new(content, current_user: current_user, embed_links: true) %> - -
- <%= - f.text_area( - :text, - class: 'wiki-edit wiki-toolbar', - no_label: true, - resource: resource, - label_options: { class: 'hidden-for-sighted' }, - with_text_formatting: true - ) - %> -
- <%= f.hidden_field :lock_version %> - -

<%= f.text_field :journal_notes, label: :comments %>

- <%= styled_button_tag t(:button_save), - class: '-primary -with-icon icon-checkmark button--save-agenda', - data: { disable_with: I18n.t(:label_loading) } %> - <%= link_to t(:button_cancel), - "#", - data: { - action: 'meeting-content#cancelEditState' - }, - class: 'button -with-icon icon-cancel button--cancel-agenda' %> -<% end %> diff --git a/modules/meeting/app/views/meeting_contents/_show.html.erb b/modules/meeting/app/views/meeting_contents/_show.html.erb deleted file mode 100644 index 36a229c7fc3..00000000000 --- a/modules/meeting/app/views/meeting_contents/_show.html.erb +++ /dev/null @@ -1,76 +0,0 @@ -<%#-- copyright -OpenProject is an open source project management software. -Copyright (C) the OpenProject GmbH - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License version 3. - -OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: -Copyright (C) 2006-2013 Jean-Philippe Lang -Copyright (C) 2010-2013 the ChiliProject Team - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - -See COPYRIGHT and LICENSE files for more details. - -++#%> - -<% - tab ||= locals[:tab_contents] if defined? locals - if tab.present? - content = tab[:content] - content_type = tab[:content_type] - end --%> - -
-
- <%= toolbar title: t(:"label_#{content_type}") do %> - <%= raw meeting_content_context_menu content, content_type %> - <% end %> -
- - <% if can_edit_meeting_content?(content, content_type) -%> - - <% end -%> - - - -<%# We cannot render attachments for journaled content %> - <% unless local_assigns[:journaled_version] %> - <% resource = ::API::V3::MeetingContents::MeetingContentRepresenter.new(content, current_user: current_user, embed_links: true) %> - <%= list_attachments( - resource, - data: { - "meeting-content-target": "attachments" - } - ) %> - <% end %> -
diff --git a/modules/meeting/app/views/meeting_contents/diff.html.erb b/modules/meeting/app/views/meeting_contents/diff.html.erb deleted file mode 100644 index 693e3d92b45..00000000000 --- a/modules/meeting/app/views/meeting_contents/diff.html.erb +++ /dev/null @@ -1,55 +0,0 @@ -<%#-- copyright -OpenProject is an open source project management software. -Copyright (C) the OpenProject GmbH - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License version 3. - -OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: -Copyright (C) 2006-2013 Jean-Philippe Lang -Copyright (C) 2010-2013 the ChiliProject Team - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - -See COPYRIGHT and LICENSE files for more details. - -++#%> - -<% html_title "#{t(:label_meeting_diff)}: #{@meeting.title}" %> -<%= toolbar title: t(:"label_#{@content_type}"), - link_to: link_to(@meeting, @meeting) do %> - <% if authorize_for(@content_type.pluralize, :history) %> -
  • - <%= link_to({ controller: "/#{@content_type.pluralize}", action: "history", meeting_id: @meeting }, class: "button") do %> - <%= op_icon("button--icon icon-wiki") %> - <%= t(:label_history) %> - <% end %> -
  • - <% end %> -<% end %> - -

    -<%= t(:label_version) %> <%= link_to @diff.content_from.version, send(:"#{@content_type}_version_path", @meeting, @diff.content_from.version) %> -(<%= link_to_user(@diff.content_from.user) %>, <%= format_time(@diff.content_from.created_at) %>) -→ -<%= t(:label_version) %> <%= link_to @diff.content_to.version, send(:"#{@content_type}_version_path", @meeting, @diff.content_to.version) %>/<%= @content.last_journal&.version || 0 %> -(<%= link_to_user(@diff.content_to.user) %>, <%= format_time(@diff.content_to.created_at) %>) -

    - -
    - -
    -<%= simple_format_without_paragraph @diff.to_html %> -
    diff --git a/modules/meeting/app/views/meeting_contents/history.html.erb b/modules/meeting/app/views/meeting_contents/history.html.erb deleted file mode 100644 index 261849c3f42..00000000000 --- a/modules/meeting/app/views/meeting_contents/history.html.erb +++ /dev/null @@ -1,148 +0,0 @@ -<%#-- copyright -OpenProject is an open source project management software. -Copyright (C) the OpenProject GmbH - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License version 3. - -OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: -Copyright (C) 2006-2013 Jean-Philippe Lang -Copyright (C) 2010-2013 the ChiliProject Team - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - -See COPYRIGHT and LICENSE files for more details. - -++#%> - -<% html_title "#{t(:label_history)}: #{@meeting.title}" %> - -<%= toolbar title: t(:"label_#{@content_type}"), - link_to: link_to(@meeting, @meeting) %> - -

    <%= t(:label_history) %>

    - -<%= form_tag({ action: "diff" }, method: :get) do %> -
    -
    - - - - - - - - - - - - - - - - - - - - - <% show_diff = @content_versions.size > 1 %> - <% @content_versions.each_with_index do |content_version,index| %> - - - - - - - - - <% end %> - -
    -
    -
    - # - -
    -
    -
    -
    -
    -
    -
    -
    -
    - - <%= Meeting.human_attribute_name(:updated_at) %> - -
    -
    -
    -
    -
    - - <%= Meeting.human_attribute_name(:author) %> - -
    -
    -
    -
    -
    - - <%= Meeting.human_attribute_name(:comments) %> - -
    -
    -
    - <%= if content_version.version == @content.last_journal.version - link_to(content_version.version, tab_meeting_path(@meeting, tab: @content_type.sub(/^meeting_/, "")), id: "version-#{content_version.version}") - else - link_to(content_version.version, send(:"#{@content_type}_version_path", @meeting, content_version.version), id: "version-#{content_version.version}") - end %> - - <% if show_diff && (index < @content_versions.size-1) %> - <%= radio_button_tag( - "version_from", - content_version.version, - (index == 0), - class: "meetings--checkbox-version-to", - data: { - "journal-history-target": "fromVersion", - action: "journal-history#selectToVersion" - } - ) %> - - <% end %> - - <% if show_diff && (index > 0) %> - <%= radio_button_tag( - "version_to", - content_version.version, - (index == 1), - data: { - "journal-history-target": "toVersion", - action: "journal-history#selectFromVersion" - } - ) %> - - <% end %> - <%= format_time(content_version.created_at) %><%= User.find content_version.user_id %><%= h content_version.notes %>
    - -
    -
    -<%= styled_button_tag t(:label_view_diff), class: "-small -primary" if show_diff %> -<%= pagination_links_full @content_versions %> -<% end %> diff --git a/modules/meeting/app/views/meeting_contents/show.html.erb b/modules/meeting/app/views/meeting_contents/show.html.erb deleted file mode 100644 index 785b51b1236..00000000000 --- a/modules/meeting/app/views/meeting_contents/show.html.erb +++ /dev/null @@ -1,36 +0,0 @@ -<%#-- copyright -OpenProject is an open source project management software. -Copyright (C) the OpenProject GmbH - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License version 3. - -OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: -Copyright (C) 2006-2013 Jean-Philippe Lang -Copyright (C) 2010-2013 the ChiliProject Team - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - -See COPYRIGHT and LICENSE files for more details. - -++#%> - -<%= render partial: "meeting_contents/show", - locals: { - content: @content, - journaled_version: @journaled_version, - content_type: @content_type, - title: "#{t(:"label_#{@content_type}")}: #{link_to @meeting, @meeting}" - } %> diff --git a/modules/meeting/app/views/meetings/_form.html.erb b/modules/meeting/app/views/meetings/_form.html.erb deleted file mode 100644 index 687604e9aeb..00000000000 --- a/modules/meeting/app/views/meetings/_form.html.erb +++ /dev/null @@ -1,156 +0,0 @@ -<%#-- copyright -OpenProject is an open source project management software. -Copyright (C) the OpenProject GmbH - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License version 3. - -OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: -Copyright (C) 2006-2013 Jean-Philippe Lang -Copyright (C) 2010-2013 the ChiliProject Team - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - -See COPYRIGHT and LICENSE files for more details. - -++#%> - -<%= error_messages_for "meeting" %> - -
    - -
    - <%= f.text_field :title, required: true, size: 60, container_class: "-wide" %> -
    - - <% copy_from = local_assigns[:copy_from] %> - <% if copy_from.present? %> - <%= f.hidden_field :type, value: copy_from.type %> - <%= hidden_field_tag "copied_from_meeting_id", copy_from.id %> -
    - <%= styled_label_tag "copy_agenda", t("meeting.copy.agenda") %> -
    - <%= styled_check_box_tag "copy_agenda", - 1, - true, - no_label: true, - class: "radio-button" %> -
    -
    - <%= t("meeting.copy.agenda_text") %> -
    -
    -
    - <%= styled_label_tag "copy_attachments", t("meeting.copy.attachments") %> -
    - <%= styled_check_box_tag "copy_attachments", - 1, - false, - no_label: true, - class: "radio-button" %> -
    -
    - <%= t("meeting.copy.attachments_text") %> -
    -
    - <% elsif @meeting.new_record? %> - <%= f.hidden_field :type, value: "Meeting" %> - <% end %> - - <% if global_meeting_create_context? %> -
    - -
    - <%= angular_component_tag "opce-project-autocompleter", - inputs: { - filters: [{ name: "user_action", operator: "=", values: ["meetings/create"] }], - inputName: "project_id", - inputValue: @project&.id, - appendTo: "body", - hiddenFieldAction: "change->refresh-on-form-changes#triggerTurboStream" - }, - id: "project_id", - class: "form--select-container -wide remote-field--input", - data: { - "test-selector": "project_id" - } %> -
    -
    - <% end %> - -
    - <%= f.text_field :location, size: 60, container_class: "-wide" %> -
    - -
    - - -
    - <%= f.date_picker :start_date, - id: "meeting-form-start-date", - required: true, - no_label: true %> - - <%= f.text_field :start_time_hour, - id: "meeting-form-start-time", - required: true, - type: "time", - no_label: true, - step: 5.minutes, - suffix: formatted_time_zone_offset, - container_class: "-xslim" %> -
    -
    - -
    - -
    - <%= f.number_field :duration, - id: "meeting-form-duration", - required: true, - size: 5, - no_label: true, - min: 0.00, - step: 0.25, - max: 168, - suffix: t(:text_in_hours), - container_class: "-xslim" %> -
    -
    - - <%= render partial: "meetings/participants_section" %> - -
    - <%= styled_label_tag "send_notfications", t(:"meeting.email.send_emails") %> -
    - <%= styled_check_box_tag "send_notifications", - 1, - false %> -
    -
    - <%= t(:"meeting.email.send_invitation_emails") %> -
    -
    -
    diff --git a/modules/meeting/app/views/meetings/edit.html.erb b/modules/meeting/app/views/meetings/edit.html.erb deleted file mode 100644 index b83959c2f38..00000000000 --- a/modules/meeting/app/views/meetings/edit.html.erb +++ /dev/null @@ -1,38 +0,0 @@ -<%#-- copyright -OpenProject is an open source project management software. -Copyright (C) the OpenProject GmbH - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License version 3. - -OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: -Copyright (C) 2006-2013 Jean-Philippe Lang -Copyright (C) 2010-2013 the ChiliProject Team - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - -See COPYRIGHT and LICENSE files for more details. - -++#%> - -<% html_title "#{t(:label_meeting_edit)}: #{@meeting.title}" %> - -<%= toolbar title: "#{t(:label_meeting)} ##{@meeting.id}" %> -<%= labelled_tabular_form_for @meeting, url: { controller: "/meetings", action: "update" }, html: { id: "meeting-form", method: :put } do |f| -%> - <%= render partial: "form", locals: { f: f } %> -<%= styled_button_tag t(:button_save), class: "-primary -with-icon icon-checkmark" %> -<%= link_to t(:button_cancel), { action: "show", id: @meeting }, - class: "button -with-icon icon-cancel" %> -<% end if @project %> diff --git a/modules/meeting/app/views/meetings/new.html.erb b/modules/meeting/app/views/meetings/new.html.erb deleted file mode 100644 index 1ea14428b71..00000000000 --- a/modules/meeting/app/views/meetings/new.html.erb +++ /dev/null @@ -1,73 +0,0 @@ -<%#-- copyright -OpenProject is an open source project management software. -Copyright (C) the OpenProject GmbH - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License version 3. - -OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: -Copyright (C) 2006-2013 Jean-Philippe Lang -Copyright (C) 2010-2013 the ChiliProject Team - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - -See COPYRIGHT and LICENSE files for more details. - -++#%> -<% copy_from = local_assigns[:copy_from] %> -<% if copy_from - page_title = t("meeting.copy.title", title: copy_from.title) - breadcrumb_element = t("meeting.copy.title", title: "#{copy_from.title}") - else - page_title = t(:label_meeting_new) - breadcrumb_element = t(:label_meeting_new) - end %> - -<% html_title page_title %> - -<%= - render(Primer::OpenProject::PageHeader.new) do |header| - header.with_title { page_title } - header.with_breadcrumbs( - [if @project.present? - { href: project_overview_path(@project.id), text: @project.name } - else - { href: home_path, text: organization_name } - end, - { href: @project.present? ? project_meetings_path(@project.id) : meetings_path, - text: I18n.t(:label_meeting_plural) }, - breadcrumb_element.html_safe] - ) - end -%> - -<%= labelled_tabular_form_for @meeting, - as: :meeting, - url: { controller: "/meetings", action: "create", project_id: @project }, - html: { - id: "meeting-form", - target: "_top", - data: { - turbo: false, - controller: "refresh-on-form-changes", - "refresh-on-form-changes-target": "form", - "refresh-on-form-changes-turbo-stream-url-value": new_meeting_url - } - } do |f| -%> - <%= render partial: "form", locals: { f:, copy_from: } %> - <%= styled_button_tag t(:button_create), class: "-primary" %> - <%= link_to t(:button_cancel), { action: "index", project_id: @project }, - class: "button" %> -<% end %> diff --git a/modules/meeting/app/views/meetings/show.html.erb b/modules/meeting/app/views/meetings/show.html.erb deleted file mode 100644 index 85880071451..00000000000 --- a/modules/meeting/app/views/meetings/show.html.erb +++ /dev/null @@ -1,154 +0,0 @@ -<%#-- copyright -OpenProject is an open source project management software. -Copyright (C) the OpenProject GmbH - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License version 3. - -OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: -Copyright (C) 2006-2013 Jean-Philippe Lang -Copyright (C) 2010-2013 the ChiliProject Team - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - -See COPYRIGHT and LICENSE files for more details. - -++#%> - -<%= toolbar title: t(:label_meeting), - link_to: link_to(@meeting), - html: { class: "meeting--main-toolbar -with-dropdown" } do %> - <% unless User.current.anonymous? %> -
  • -
    - <%= watcher_link @meeting, User.current %> -
    -
  • - <% end %> - <% if authorize_for(:meetings, :edit) %> -
  • - <%= link_to(edit_project_meeting_path(@project, @meeting), class: "button", accesskey: accesskey(:edit)) do %> - <%= op_icon("button--icon icon-edit") %> - <%= t(:button_edit) %> - <% end %> -
  • - <% end %> - - -<% end %> - -
    -
    -
    - <%= avatar(@meeting.author) %> -

    <%= authoring @meeting.created_at, @meeting.author %>

    -
    -
    -

    - <%= Meeting.human_attribute_name(:start_time) %>: <%= format_date @meeting.start_time %> <%= format_time @meeting.start_time, include_date: false %> - - <%= format_time @meeting.end_time, include_date: false %> <%= formatted_time_zone_offset %>

    -
    -
    -

    - <%= Meeting.human_attribute_name(:location) %>: <%= auto_link(h(@meeting.location), link: :all, html: { target: "_blank" }) %> -

    -
    -
    -

    - <%= Meeting.human_attribute_name(:participants_invited) %>: <%= format_participant_list @meeting.participants.invited %> -

    -
    -
    -

    - <%= Meeting.human_attribute_name(:participants_attended) %>: <%= format_participant_list @meeting.participants.attended %> -

    -
    -
    -
    - -<%= render_tabs( - [ - { name: "agenda", - action: :create_meeting_agendas, - partial: "meeting_contents/show", - path: meeting_agenda_path(@meeting), - label: :label_meeting_agenda, - content: @meeting.agenda || @meeting.build_agenda, - content_type: "meeting_agenda" }, - { - name: "minutes", - action: :create_meeting_minutes, - partial: "meeting_contents/show", - path: meeting_minutes_path(@meeting), - label: :label_meeting_minutes, content: @meeting.minutes || @meeting.build_minutes, - content_type: "meeting_minutes" - } - ] - ) %> - -<% if @meeting.journals.changing.present? %> -
    -

    <%= t(:label_history) %>

    - <% @meeting.journals.each do |journal| %> - <%= render_meeting_journal @meeting, journal %> - <% end %> -
    -<% end %> diff --git a/modules/meeting/config/locales/en.yml b/modules/meeting/config/locales/en.yml index c6adaa50775..57d9086bc13 100644 --- a/modules/meeting/config/locales/en.yml +++ b/modules/meeting/config/locales/en.yml @@ -82,11 +82,9 @@ en: invalid_time_format: "is not a valid time. Required format: HH:MM" models: recurring_meeting: "Recurring meeting" - structured_meeting: "One-time meeting" - meeting: "Meeting" + meeting: "One-time meeting" meeting_agenda_item: "Agenda item" meeting_agenda: "Agenda" - meeting_minutes: "Minutes" meeting_section: "Section" activity: @@ -234,9 +232,6 @@ en: new_date_time: "New date/time" label_mail_all_participants: "Send email to all participants" types: - classic: "Classic (unsupported)" - classic_text: "Note: Classic meetings will be removed in the next version of OpenProject." - structured: "Structured" one_time: "One-time" recurring: "Recurring" recurring_text: "Create meeting series with dynamic template for each occurrence." diff --git a/modules/meeting/db/migrate/20240405131352_create_meeting_sections.rb b/modules/meeting/db/migrate/20240405131352_create_meeting_sections.rb index 0bf6a12d535..60e5145d6ca 100644 --- a/modules/meeting/db/migrate/20240405131352_create_meeting_sections.rb +++ b/modules/meeting/db/migrate/20240405131352_create_meeting_sections.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + class CreateMeetingSections < ActiveRecord::Migration[7.1] def up create_table :meeting_sections do |t| @@ -24,7 +25,7 @@ class CreateMeetingSections < ActiveRecord::Migration[7.1] private def create_and_assign_default_section - StructuredMeeting.includes(:agenda_items).find_each do |meeting| + Meeting.includes(:agenda_items).find_each do |meeting| section = MeetingSection.create!( meeting:, title: "Untitled" diff --git a/modules/meeting/lib/api/v3/meeting_agendas/meeting_agenda_representer.rb b/modules/meeting/lib/api/v3/meeting_agendas/meeting_agenda_representer.rb deleted file mode 100644 index f0d6571db92..00000000000 --- a/modules/meeting/lib/api/v3/meeting_agendas/meeting_agenda_representer.rb +++ /dev/null @@ -1,37 +0,0 @@ -# frozen_string_literal: true -#-- copyright -# OpenProject is an open source project management software. -# Copyright (C) the OpenProject GmbH -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License version 3. -# -# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: -# Copyright (C) 2006-2013 Jean-Philippe Lang -# Copyright (C) 2010-2013 the ChiliProject Team -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# See COPYRIGHT and LICENSE files for more details. -#++ - -module API - module V3 - module MeetingAgendas - class MeetingAgendaRepresenter < API::V3::MeetingContents::MeetingContentRepresenter - end - end - end -end diff --git a/modules/meeting/lib/api/v3/meeting_contents/meeting_content_representer.rb b/modules/meeting/lib/api/v3/meeting_contents/meeting_content_representer.rb deleted file mode 100644 index 02d7341e290..00000000000 --- a/modules/meeting/lib/api/v3/meeting_contents/meeting_content_representer.rb +++ /dev/null @@ -1,58 +0,0 @@ -# frozen_string_literal: true -#-- copyright -# OpenProject is an open source project management software. -# Copyright (C) the OpenProject GmbH -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License version 3. -# -# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: -# Copyright (C) 2006-2013 Jean-Philippe Lang -# Copyright (C) 2010-2013 the ChiliProject Team -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# See COPYRIGHT and LICENSE files for more details. -#++ - -module API - module V3 - module MeetingContents - class MeetingContentRepresenter < ::API::Decorators::Single - include API::Decorators::LinkedResource - include API::Caching::CachedRepresenter - include ::API::V3::Attachments::AttachableRepresenterMixin - - self_link title_getter: ->(*) {} - - property :id - - associated_resource :project, - link: ->(*) do - next unless represented.project.present? - - { - href: api_v3_paths.project(represented.project.id), - title: represented.project.name - } - end - - def _type - "MeetingContent" - end - end - end - end -end diff --git a/modules/meeting/lib/api/v3/meeting_minutes/meeting_minutes_representer.rb b/modules/meeting/lib/api/v3/meeting_minutes/meeting_minutes_representer.rb deleted file mode 100644 index 6d2f9bf580c..00000000000 --- a/modules/meeting/lib/api/v3/meeting_minutes/meeting_minutes_representer.rb +++ /dev/null @@ -1,37 +0,0 @@ -# frozen_string_literal: true -#-- copyright -# OpenProject is an open source project management software. -# Copyright (C) the OpenProject GmbH -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License version 3. -# -# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: -# Copyright (C) 2006-2013 Jean-Philippe Lang -# Copyright (C) 2010-2013 the ChiliProject Team -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# See COPYRIGHT and LICENSE files for more details. -#++ - -module API - module V3 - module MeetingMinutes - class MeetingMinutesRepresenter < API::V3::MeetingContents::MeetingContentRepresenter - end - end - end -end diff --git a/modules/meeting/lib/api/v3/meetings/meeting_representer.rb b/modules/meeting/lib/api/v3/meetings/meeting_representer.rb index e7528766f4b..21426d113e9 100644 --- a/modules/meeting/lib/api/v3/meetings/meeting_representer.rb +++ b/modules/meeting/lib/api/v3/meetings/meeting_representer.rb @@ -48,10 +48,6 @@ module API lock_version.to_i } - property :type, - as: :meeting_type, - getter: ->(*) { type } - date_time_property :start_time date_time_property :end_time diff --git a/modules/meeting/spec/components/meetings/delete_dialog_component_spec.rb b/modules/meeting/spec/components/meetings/delete_dialog_component_spec.rb index dd74e691069..31b721aea03 100644 --- a/modules/meeting/spec/components/meetings/delete_dialog_component_spec.rb +++ b/modules/meeting/spec/components/meetings/delete_dialog_component_spec.rb @@ -69,7 +69,7 @@ RSpec.describe Meetings::DeleteDialogComponent, type: :component do context "with an associated recurring/templated meeting" do let(:series) { build_stubbed(:recurring_meeting) } - let(:meeting) { build_stubbed(:structured_meeting_template, recurring_meeting: series) } + let(:meeting) { build_stubbed(:meeting_template, recurring_meeting: series) } it "shows a heading" do expect(subject).to have_text "Cancel this meeting occurrence?" diff --git a/modules/meeting/spec/components/meetings/row_component_spec.rb b/modules/meeting/spec/components/meetings/row_component_spec.rb index 5fb0fd9088c..fc39200c080 100644 --- a/modules/meeting/spec/components/meetings/row_component_spec.rb +++ b/modules/meeting/spec/components/meetings/row_component_spec.rb @@ -61,7 +61,7 @@ RSpec.describe Meetings::RowComponent, type: :component do context "with an associated recurring/templated meeting" do let(:series) { build_stubbed(:recurring_meeting, project:) } - let(:meeting) { build_stubbed(:structured_meeting_template, recurring_meeting: series, project:) } + let(:meeting) { build_stubbed(:meeting_template, recurring_meeting: series, project:) } it "shows default menu items" do expect(subject).to have_link "View meeting series" @@ -99,7 +99,7 @@ RSpec.describe Meetings::RowComponent, type: :component do context "with an associated recurring/templated meeting" do let(:series) { build_stubbed(:recurring_meeting, project:) } - let(:meeting) { build_stubbed(:structured_meeting_template, recurring_meeting: series, project:) } + let(:meeting) { build_stubbed(:meeting_template, recurring_meeting: series, project:) } context "without a current project" do it "shows delete menu item with a back url" do diff --git a/modules/meeting/spec/components/meetings/side_panel/details_component_spec.rb b/modules/meeting/spec/components/meetings/side_panel/details_component_spec.rb index 709db948fd1..72fef088563 100644 --- a/modules/meeting/spec/components/meetings/side_panel/details_component_spec.rb +++ b/modules/meeting/spec/components/meetings/side_panel/details_component_spec.rb @@ -49,7 +49,7 @@ RSpec.describe Meetings::SidePanel::DetailsComponent, type: :component do frequency: "working_days") end let(:meeting) do - build_stubbed(:structured_meeting_template, + build_stubbed(:meeting_template, recurring_meeting: series) end @@ -65,7 +65,7 @@ RSpec.describe Meetings::SidePanel::DetailsComponent, type: :component do frequency: "weekly") end let(:meeting) do - build_stubbed(:structured_meeting_template, + build_stubbed(:meeting_template, recurring_meeting: series) end diff --git a/modules/meeting/spec/components/recurring_meetings/delete_dialog_component_spec.rb b/modules/meeting/spec/components/recurring_meetings/delete_dialog_component_spec.rb index 20614f6c262..a0d2ffb046b 100644 --- a/modules/meeting/spec/components/recurring_meetings/delete_dialog_component_spec.rb +++ b/modules/meeting/spec/components/recurring_meetings/delete_dialog_component_spec.rb @@ -35,7 +35,7 @@ RSpec.describe RecurringMeetings::DeleteDialogComponent, type: :component do let(:project) { build_stubbed(:project) } let(:recurring_meeting) { build_stubbed(:recurring_meeting, project:, end_after: :iterations, iterations: 6) } - let(:meeting) { build_stubbed(:structured_meeting_template, recurring_meeting:) } + let(:meeting) { build_stubbed(:meeting_template, recurring_meeting:) } let(:user) { build_stubbed(:user) } subject do diff --git a/modules/meeting/spec/components/recurring_meetings/delete_scheduled_dialog_component_spec.rb b/modules/meeting/spec/components/recurring_meetings/delete_scheduled_dialog_component_spec.rb index 1f47a657909..e595609bc07 100644 --- a/modules/meeting/spec/components/recurring_meetings/delete_scheduled_dialog_component_spec.rb +++ b/modules/meeting/spec/components/recurring_meetings/delete_scheduled_dialog_component_spec.rb @@ -37,7 +37,7 @@ RSpec.describe RecurringMeetings::DeleteScheduledDialogComponent, type: :compone let(:recurring_meeting) { build_stubbed(:recurring_meeting, project:, end_after: :iterations, iterations: 6) } let(:start_time) { 1.day.from_now } let(:scheduled_meeting) { recurring_meeting.scheduled_meetings.find_or_initialize_by(start_time: start_time) } - let(:meeting) { build_stubbed(:structured_meeting_template, recurring_meeting:) } + let(:meeting) { build_stubbed(:meeting_template, recurring_meeting:) } let(:user) { build_stubbed(:user) } subject do diff --git a/modules/meeting/spec/contracts/meeting_agenda_items/create_contract_spec.rb b/modules/meeting/spec/contracts/meeting_agenda_items/create_contract_spec.rb index e09213d85bc..cb5006e0feb 100644 --- a/modules/meeting/spec/contracts/meeting_agenda_items/create_contract_spec.rb +++ b/modules/meeting/spec/contracts/meeting_agenda_items/create_contract_spec.rb @@ -35,7 +35,7 @@ RSpec.describe MeetingAgendaItems::CreateContract do include_context "ModelContract shared context" shared_let(:project) { create(:project) } - let(:meeting) { create(:structured_meeting, project:) } + let(:meeting) { create(:meeting, project:) } let(:item) { build(:meeting_agenda_item, meeting:) } let(:contract) { described_class.new(item, user) } diff --git a/modules/meeting/spec/contracts/meeting_agenda_items/delete_contract_spec.rb b/modules/meeting/spec/contracts/meeting_agenda_items/delete_contract_spec.rb index 5afda8bd64e..ebe061d8aa5 100644 --- a/modules/meeting/spec/contracts/meeting_agenda_items/delete_contract_spec.rb +++ b/modules/meeting/spec/contracts/meeting_agenda_items/delete_contract_spec.rb @@ -35,7 +35,7 @@ RSpec.describe MeetingAgendaItems::DeleteContract do include_context "ModelContract shared context" shared_let(:project) { create(:project) } - shared_let(:meeting) { create(:structured_meeting, project:) } + shared_let(:meeting) { create(:meeting, project:) } shared_let(:item) { create(:meeting_agenda_item, meeting:) } let(:contract) { described_class.new(item, user) } diff --git a/modules/meeting/spec/contracts/meeting_agenda_items/update_contract_spec.rb b/modules/meeting/spec/contracts/meeting_agenda_items/update_contract_spec.rb index fec471e6c51..43a85865509 100644 --- a/modules/meeting/spec/contracts/meeting_agenda_items/update_contract_spec.rb +++ b/modules/meeting/spec/contracts/meeting_agenda_items/update_contract_spec.rb @@ -35,7 +35,7 @@ RSpec.describe MeetingAgendaItems::UpdateContract do include_context "ModelContract shared context" shared_let(:project) { create(:project) } - shared_let(:meeting) { create(:structured_meeting, project:) } + shared_let(:meeting) { create(:meeting, project:) } shared_let(:item) { create(:meeting_agenda_item, meeting:) } let(:contract) { described_class.new(item, user) } diff --git a/modules/meeting/spec/contracts/meeting_contents/update_contract_spec.rb b/modules/meeting/spec/contracts/meeting_contents/update_contract_spec.rb deleted file mode 100644 index 0bfbaaa38fd..00000000000 --- a/modules/meeting/spec/contracts/meeting_contents/update_contract_spec.rb +++ /dev/null @@ -1,56 +0,0 @@ -# frozen_string_literal: true -#-- copyright -# OpenProject is an open source project management software. -# Copyright (C) the OpenProject GmbH -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License version 3. -# -# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: -# Copyright (C) 2006-2013 Jean-Philippe Lang -# Copyright (C) 2010-2013 the ChiliProject Team -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# See COPYRIGHT and LICENSE files for more details. -#++ - -require "spec_helper" -require "contracts/shared/model_contract_shared_context" - -RSpec.describe MeetingContents::UpdateContract do - include_context "ModelContract shared context" - let(:agenda) { build_stubbed(:meeting_agenda) } - let(:current_user) { build_stubbed(:user) } - let(:contract) { described_class.new(agenda, current_user) } - - context "when not editable" do - before do - allow(agenda).to receive(:editable?).and_return false - end - - it_behaves_like "contract is invalid", base: :error_readonly - end - - context "when editable" do - before do - allow(agenda).to receive(:editable?).and_return true - end - - it_behaves_like "contract is valid" - end - - include_examples "contract reuses the model errors" -end diff --git a/modules/meeting/spec/contracts/meeting_outcomes/create_contract_spec.rb b/modules/meeting/spec/contracts/meeting_outcomes/create_contract_spec.rb index c85321449e9..e07e30c5243 100644 --- a/modules/meeting/spec/contracts/meeting_outcomes/create_contract_spec.rb +++ b/modules/meeting/spec/contracts/meeting_outcomes/create_contract_spec.rb @@ -35,7 +35,7 @@ RSpec.describe MeetingOutcomes::CreateContract do include_context "ModelContract shared context" shared_let(:project) { create(:project) } - let(:meeting) { create(:structured_meeting, project:) } + let(:meeting) { create(:meeting, project:) } let(:meeting_agenda_item) { create(:meeting_agenda_item, meeting:) } let(:outcome) { build(:meeting_outcome, meeting_agenda_item:) } let(:contract) { described_class.new(outcome, user) } diff --git a/modules/meeting/spec/contracts/meeting_outcomes/delete_contract_spec.rb b/modules/meeting/spec/contracts/meeting_outcomes/delete_contract_spec.rb index 999ce1800de..bcc473f8c3b 100644 --- a/modules/meeting/spec/contracts/meeting_outcomes/delete_contract_spec.rb +++ b/modules/meeting/spec/contracts/meeting_outcomes/delete_contract_spec.rb @@ -35,7 +35,7 @@ RSpec.describe MeetingOutcomes::DeleteContract do include_context "ModelContract shared context" shared_let(:project) { create(:project) } - shared_let(:meeting) { create(:structured_meeting, project:) } + shared_let(:meeting) { create(:meeting, project:) } let(:meeting_agenda_item) { create(:meeting_agenda_item, meeting:) } let(:outcome) { build_stubbed(:meeting_outcome, meeting_agenda_item:) } let(:contract) { described_class.new(outcome, user) } diff --git a/modules/meeting/spec/contracts/meeting_outcomes/update_contract_spec.rb b/modules/meeting/spec/contracts/meeting_outcomes/update_contract_spec.rb index 0b6fd928cc8..a0c61195a8e 100644 --- a/modules/meeting/spec/contracts/meeting_outcomes/update_contract_spec.rb +++ b/modules/meeting/spec/contracts/meeting_outcomes/update_contract_spec.rb @@ -35,7 +35,7 @@ RSpec.describe MeetingOutcomes::UpdateContract do include_context "ModelContract shared context" shared_let(:project) { create(:project) } - let(:meeting) { create(:structured_meeting, project:) } + let(:meeting) { create(:meeting, project:) } let(:meeting_agenda_item) { create(:meeting_agenda_item, meeting:) } let(:outcome) { build(:meeting_outcome, meeting_agenda_item:) } let(:contract) { described_class.new(outcome, user) } diff --git a/modules/meeting/spec/contracts/meeting_sections/create_contract_spec.rb b/modules/meeting/spec/contracts/meeting_sections/create_contract_spec.rb index a702e623cff..e088c011516 100644 --- a/modules/meeting/spec/contracts/meeting_sections/create_contract_spec.rb +++ b/modules/meeting/spec/contracts/meeting_sections/create_contract_spec.rb @@ -35,7 +35,7 @@ RSpec.describe MeetingSections::CreateContract do include_context "ModelContract shared context" shared_let(:project) { create(:project) } - let(:meeting) { create(:structured_meeting, project:) } + let(:meeting) { create(:meeting, project:) } let(:section) { build(:meeting_section, meeting:) } let(:contract) { described_class.new(section, user) } diff --git a/modules/meeting/spec/contracts/meeting_sections/delete_contract_spec.rb b/modules/meeting/spec/contracts/meeting_sections/delete_contract_spec.rb index c5c836c6de0..dfdcbcefa74 100644 --- a/modules/meeting/spec/contracts/meeting_sections/delete_contract_spec.rb +++ b/modules/meeting/spec/contracts/meeting_sections/delete_contract_spec.rb @@ -35,7 +35,7 @@ RSpec.describe MeetingSections::DeleteContract do include_context "ModelContract shared context" shared_let(:project) { create(:project) } - shared_let(:meeting) { create(:structured_meeting, project:) } + shared_let(:meeting) { create(:meeting, project:) } let(:section) { create(:meeting_section, meeting:) } let(:contract) { described_class.new(section, user) } diff --git a/modules/meeting/spec/contracts/meeting_sections/update_contract_spec.rb b/modules/meeting/spec/contracts/meeting_sections/update_contract_spec.rb index 5bbac6a403c..84a3653fbea 100644 --- a/modules/meeting/spec/contracts/meeting_sections/update_contract_spec.rb +++ b/modules/meeting/spec/contracts/meeting_sections/update_contract_spec.rb @@ -35,7 +35,7 @@ RSpec.describe MeetingSections::UpdateContract do include_context "ModelContract shared context" shared_let(:project) { create(:project) } - shared_let(:meeting) { create(:structured_meeting, project:) } + shared_let(:meeting) { create(:meeting, project:) } shared_let(:section) { create(:meeting_section, meeting:) } let(:contract) { described_class.new(section, user) } diff --git a/modules/meeting/spec/contracts/meetings/create_contract_spec.rb b/modules/meeting/spec/contracts/meetings/create_contract_spec.rb index 6360f5a767b..be7a26635ae 100644 --- a/modules/meeting/spec/contracts/meetings/create_contract_spec.rb +++ b/modules/meeting/spec/contracts/meetings/create_contract_spec.rb @@ -35,7 +35,7 @@ RSpec.describe Meetings::CreateContract do include_context "ModelContract shared context" shared_let(:project) { create(:project) } - let(:meeting) { build(:structured_meeting, project:) } + let(:meeting) { build(:meeting, project:) } let(:contract) { described_class.new(meeting, user) } context "with permission" do diff --git a/modules/meeting/spec/contracts/meetings/update_contract_spec.rb b/modules/meeting/spec/contracts/meetings/update_contract_spec.rb index 850cf721181..29d95655bfd 100644 --- a/modules/meeting/spec/contracts/meetings/update_contract_spec.rb +++ b/modules/meeting/spec/contracts/meetings/update_contract_spec.rb @@ -35,7 +35,7 @@ RSpec.describe Meetings::UpdateContract do include_context "ModelContract shared context" shared_let(:project) { create(:project) } - shared_let(:meeting) { create(:structured_meeting, project:) } + shared_let(:meeting) { create(:meeting, project:) } let(:contract) { described_class.new(meeting, user) } context "with permission" do diff --git a/modules/meeting/spec/controllers/meetings_controller_spec.rb b/modules/meeting/spec/controllers/meetings_controller_spec.rb deleted file mode 100644 index dd3c1878ae7..00000000000 --- a/modules/meeting/spec/controllers/meetings_controller_spec.rb +++ /dev/null @@ -1,221 +0,0 @@ -# frozen_string_literal: true -#-- copyright -# OpenProject is an open source project management software. -# Copyright (C) the OpenProject GmbH -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License version 3. -# -# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: -# Copyright (C) 2006-2013 Jean-Philippe Lang -# Copyright (C) 2010-2013 the ChiliProject Team -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# See COPYRIGHT and LICENSE files for more details. -#++ - -require "#{File.dirname(__FILE__)}/../spec_helper" - -RSpec.describe MeetingsController do - shared_let(:user) { create(:admin) } - shared_let(:project) { create(:project) } - shared_let(:other_project) { create(:project) } - - current_user { user } - - describe "GET" do - describe "index" do - let(:meetings) do - [ - create(:meeting, project:), - create(:meeting, author: user, project:), - create(:meeting, author: user, project: other_project) - ] - end - end - - describe "show" do - let(:meeting) { create(:meeting, project:, agenda: nil) } - - describe "html" do - before do - get "show", params: { id: meeting.id } - end - - it { expect(response).to redirect_to(project_meeting_path(project, meeting)) } - it { expect(assigns(:meeting)).to eql meeting } - end - end - - describe "new" do - let(:meeting) { Meeting.new(project:) } - - before do - allow(Project).to receive(:find).and_return(project) - allow(Meeting).to receive(:new).and_return(meeting) - end - - shared_examples_for "new action" do |response_type:| - describe response_type do - context "when requesting the page without a project id" do - before do - get "new" - end - - it { expect(response).to be_successful } - it { expect(assigns(:meeting)).to eql meeting } - it { expect(assigns(:project)).to be_nil } - end - - context "when requesting the page with a project id" do - before do - get "new", params: { project_id: project.id } - end - - it { expect(response).to be_successful } - it { expect(assigns(:meeting)).to eql meeting } - it { expect(assigns(:project)).to eql project } - end - end - end - - it_behaves_like "new action", response_type: "html" - it_behaves_like "new action", response_type: "turbo_stream" - end - - describe "edit" do - let(:meeting) { create(:meeting, project:) } - - describe "html" do - before do - get "edit", params: { project_id: meeting.project_id, id: meeting.id } - end - - it { expect(response).to be_successful } - it { expect(assigns(:meeting)).to eql meeting } - end - end - end - - describe "POST" do - describe "create" do - render_views - - let(:base_params) do - { - project_id: project&.id, - meeting: meeting_params - } - end - - let(:base_meeting_params) do - { - title: "Foobar", - duration: "1.0", - start_date: "2015-06-01", - start_time_hour: "10:00" - } - end - - let(:params) { base_params } - let(:meeting_params) { base_meeting_params } - - before do - post :create, - params: - end - - context "with a project_id" do - context "and an invalid start_date with start_time_hour" do - let(:meeting_params) do - base_meeting_params.merge(start_date: "-") - end - - it "renders an error" do - expect(response).to have_http_status :unprocessable_entity - expect(response).to render_template :new - expect(response.body) - .to have_text("Date #{I18n.t('activerecord.errors.messages.not_an_iso_date')}") - end - end - - context "and an invalid start_time_hour with start_date" do - let(:meeting_params) do - base_meeting_params.merge(start_time_hour: "-") - end - - it "renders an error" do - expect(response).to have_http_status :unprocessable_entity - expect(response).to render_template :new - expect(response.body) - .to have_text("Start time #{I18n.t('activerecord.errors.messages.invalid_time_format')}") - end - end - end - - context "with a nil project_id" do - let(:project) { nil } - - it "renders an error" do - expect(response).to have_http_status :unprocessable_entity - expect(response).to render_template :new - expect(response.body) - .to have_text("Project #{I18n.t('activerecord.errors.messages.blank')}") - end - end - - context "without a project_id" do - let(:params) { base_params.except(:project_id) } - let(:project) { nil } - - it "renders an error" do - expect(response).to have_http_status :unprocessable_entity - expect(response).to render_template :new - expect(response.body) - .to have_text("Project #{I18n.t('activerecord.errors.messages.blank')}") - end - end - end - end - - describe "notify" do - let!(:meeting) { create(:meeting) } - let!(:participant) { create(:meeting_participant, meeting:, attended: true) } - - it "produces a background job for notification" do - post :notify, params: { project_id: meeting.project_id, id: meeting.id } - - perform_enqueued_jobs - expect(ActionMailer::Base.deliveries.count).to eq(1) - end - - context "with an error during deliver" do - before do - allow(MeetingMailer).to receive(:invited).and_raise(Net::SMTPError) - end - - it "produces a flash message containing the mail addresses raising the error" do - expect { post :notify, params: { project_id: meeting.project_id, id: meeting.id } }.not_to raise_error - meeting.participants.each do |participant| - expect(flash[:error]).to include(participant.name) - end - - perform_enqueued_jobs - expect(ActionMailer::Base.deliveries.count).to eq(0) - end - end - end -end diff --git a/modules/meeting/spec/factories/meeting_agenda_factory.rb b/modules/meeting/spec/factories/meeting_agenda_factory.rb deleted file mode 100644 index 22490f8aa58..00000000000 --- a/modules/meeting/spec/factories/meeting_agenda_factory.rb +++ /dev/null @@ -1,34 +0,0 @@ -# frozen_string_literal: true -#-- copyright -# OpenProject is an open source project management software. -# Copyright (C) the OpenProject GmbH -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License version 3. -# -# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: -# Copyright (C) 2006-2013 Jean-Philippe Lang -# Copyright (C) 2010-2013 the ChiliProject Team -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# See COPYRIGHT and LICENSE files for more details. -#++ - -FactoryBot.define do - factory :meeting_agenda do |_a| - meeting - end -end diff --git a/modules/meeting/spec/factories/meeting_agenda_item_factory.rb b/modules/meeting/spec/factories/meeting_agenda_item_factory.rb index de44aec2961..f475af5f455 100644 --- a/modules/meeting/spec/factories/meeting_agenda_item_factory.rb +++ b/modules/meeting/spec/factories/meeting_agenda_item_factory.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + #-- copyright # OpenProject is an open source project management software. # Copyright (C) the OpenProject GmbH @@ -29,7 +30,7 @@ FactoryBot.define do factory :meeting_agenda_item do |m| - meeting factory: :structured_meeting + meeting factory: :meeting work_package { nil } author factory: :user duration_in_minutes { 10 } diff --git a/modules/meeting/spec/factories/meeting_content_journal_factory.rb b/modules/meeting/spec/factories/meeting_content_journal_factory.rb deleted file mode 100644 index 93f50409fe1..00000000000 --- a/modules/meeting/spec/factories/meeting_content_journal_factory.rb +++ /dev/null @@ -1,33 +0,0 @@ -# frozen_string_literal: true -#-- copyright -# OpenProject is an open source project management software. -# Copyright (C) the OpenProject GmbH -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License version 3. -# -# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: -# Copyright (C) 2006-2013 Jean-Philippe Lang -# Copyright (C) 2010-2013 the ChiliProject Team -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# See COPYRIGHT and LICENSE files for more details. -#++ - -FactoryBot.define do - factory :journal_meeting_content_journal, class: "Journal::MeetingContentJournal" do - end -end diff --git a/modules/meeting/spec/factories/meeting_factory.rb b/modules/meeting/spec/factories/meeting_factory.rb index d807b97958f..085f174cee1 100644 --- a/modules/meeting/spec/factories/meeting_factory.rb +++ b/modules/meeting/spec/factories/meeting_factory.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + #-- copyright # OpenProject is an open source project management software. # Copyright (C) the OpenProject GmbH @@ -47,12 +48,8 @@ FactoryBot.define do meeting.project = evaluator.project if evaluator.project end - factory :structured_meeting, class: "StructuredMeeting" do |structured_meeting| - structured_meeting.sequence(:title) { |n| "Structured meeting #{n}" } - end - - factory :structured_meeting_template, class: "StructuredMeeting" do |structured_meeting| - structured_meeting.sequence(:title) { |n| "Structured meeting template #{n}" } + factory :meeting_template do |meeting| + meeting.sequence(:title) { |n| "Meeting template #{n}" } template { true } recurring_meeting diff --git a/modules/meeting/spec/factories/meeting_minutes_factory.rb b/modules/meeting/spec/factories/meeting_minutes_factory.rb deleted file mode 100644 index c9682b447bc..00000000000 --- a/modules/meeting/spec/factories/meeting_minutes_factory.rb +++ /dev/null @@ -1,34 +0,0 @@ -# frozen_string_literal: true -#-- copyright -# OpenProject is an open source project management software. -# Copyright (C) the OpenProject GmbH -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License version 3. -# -# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: -# Copyright (C) 2006-2013 Jean-Philippe Lang -# Copyright (C) 2010-2013 the ChiliProject Team -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# See COPYRIGHT and LICENSE files for more details. -#++ - -FactoryBot.define do - factory :meeting_minutes do |_m| - meeting - end -end diff --git a/modules/meeting/spec/factories/meeting_section_factory.rb b/modules/meeting/spec/factories/meeting_section_factory.rb index 79bf3e3b30f..3c53cb8ec43 100644 --- a/modules/meeting/spec/factories/meeting_section_factory.rb +++ b/modules/meeting/spec/factories/meeting_section_factory.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + #-- copyright # OpenProject is an open source project management software. # Copyright (C) the OpenProject GmbH @@ -29,7 +30,7 @@ FactoryBot.define do factory :meeting_section do |m| - meeting factory: :structured_meeting + meeting factory: :meeting m.sequence(:title) { |n| "Section #{n}" } end diff --git a/modules/meeting/spec/factories/recurring_meeting_factory.rb b/modules/meeting/spec/factories/recurring_meeting_factory.rb index 1bafc93d571..94025c9446a 100644 --- a/modules/meeting/spec/factories/recurring_meeting_factory.rb +++ b/modules/meeting/spec/factories/recurring_meeting_factory.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + #-- copyright # OpenProject is an open source project management software. # Copyright (C) the OpenProject GmbH @@ -48,7 +49,7 @@ FactoryBot.define do recurring_meeting.project = project # create template - template = create(:structured_meeting_template, + template = create(:meeting_template, :author_participates, author: recurring_meeting.author, recurring_meeting:, diff --git a/modules/meeting/spec/features/meetings_activity_spec.rb b/modules/meeting/spec/features/meetings_activity_spec.rb index e2f099644fa..d7ea85968f5 100644 --- a/modules/meeting/spec/features/meetings_activity_spec.rb +++ b/modules/meeting/spec/features/meetings_activity_spec.rb @@ -34,8 +34,6 @@ RSpec.describe "Meetings", :js do let(:user) { create(:admin) } let!(:meeting) { create(:meeting, project:, title: "Awesome meeting!") } - let!(:agenda) { create(:meeting_agenda, meeting:, text: "foo") } - let!(:minutes) { create(:meeting_minutes, meeting:, text: "minutes") } before do login_as(user) @@ -47,9 +45,6 @@ RSpec.describe "Meetings", :js do check "Meetings" click_on "Apply" - - expect(page).to have_css(".op-activity-list--item-title", text: "Minutes: Awesome meeting!") - expect(page).to have_css(".op-activity-list--item-title", text: "Agenda: Awesome meeting!") expect(page).to have_css(".op-activity-list--item-title", text: "Meeting: Awesome meeting!") end end diff --git a/modules/meeting/spec/features/meetings_attachments_spec.rb b/modules/meeting/spec/features/meetings_attachments_spec.rb deleted file mode 100644 index 18289cbbe69..00000000000 --- a/modules/meeting/spec/features/meetings_attachments_spec.rb +++ /dev/null @@ -1,79 +0,0 @@ -# frozen_string_literal: true -require "spec_helper" -require "features/page_objects/notification" - -RSpec.describe "Add an attachment to a meeting (agenda)", :js, :selenium do - let(:role) do - create(:project_role, permissions: %i[view_meetings edit_meetings create_meeting_agendas]) - end - - let(:dev) do - create(:user, member_with_roles: { project => role }) - end - - let(:project) { create(:project) } - - let(:meeting) do - create( - :meeting, - project:, - title: "Versammlung", - agenda: create(:meeting_agenda, text: "Versammlung") - ) - end - - let(:attachments) { Components::Attachments.new } - let(:image_fixture) { UploadedFile.load_from("spec/fixtures/files/image.png") } - let(:editor) { Components::WysiwygEditor.new } - let(:attachments_list) { Components::AttachmentsList.new } - - before do - login_as(dev) - - visit "/meetings/#{meeting.id}" - - within "#tab-content-agenda .toolbar" do - click_on "Edit" - end - end - - describe "wysiwyg editor" do - context "if on an existing page" do - it "can upload an image via drag & drop" do - find(".ck-content") - - editor.expect_button "Upload image from computer" - - editor.drag_attachment image_fixture.path, "Some image caption" - - click_on "Save" - - content = find_test_selector("op-meeting--meeting_agenda") - - expect(content).to have_css("img") - expect(content).to have_content("Some image caption") - end - end - end - - describe "attachment dropzone" do - it "can upload an image via attaching and drag & drop" do - editor.wait_until_loaded - attachments_list.wait_until_visible - - ## - # Attach file manually - editor.attachments_list.expect_empty - attachments.attach_file_on_input(image_fixture.path) - editor.wait_until_upload_progress_toaster_cleared - editor.attachments_list.expect_attached("image.png") - - ## - # and via drag & drop - editor.attachments_list.drag_enter - editor.attachments_list.drop(image_fixture) - editor.wait_until_upload_progress_toaster_cleared - editor.attachments_list.expect_attached("image.png", count: 2) - end - end -end diff --git a/modules/meeting/spec/features/meetings_close_spec.rb b/modules/meeting/spec/features/meetings_close_spec.rb deleted file mode 100644 index 534a51c779c..00000000000 --- a/modules/meeting/spec/features/meetings_close_spec.rb +++ /dev/null @@ -1,97 +0,0 @@ -# frozen_string_literal: true -#-- copyright -# OpenProject is an open source project management software. -# Copyright (C) the OpenProject GmbH -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License version 3. -# -# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: -# Copyright (C) 2006-2013 Jean-Philippe Lang -# Copyright (C) 2010-2013 the ChiliProject Team -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# See COPYRIGHT and LICENSE files for more details. -#++ - -require "spec_helper" - -RSpec.describe "Meetings close" do - let(:project) { create(:project, enabled_module_names: %w[meetings]) } - let(:user) do - create(:user, - member_with_permissions: { project => permissions }) - end - let(:other_user) do - create(:user, - member_with_permissions: { project => permissions }) - end - - let!(:meeting) { create(:meeting, :author_participates, project:, title: "Own awesome meeting!", author: user) } - let!(:meeting_agenda) { create(:meeting_agenda, meeting:, text: "asdf") } - - before do - login_as(user) - end - - context "with permission to close meetings", - :js do - let(:permissions) { %i[view_meetings close_meeting_agendas] } - - it "can delete own and other`s meetings" do - visit project_meetings_path(project) - - click_on meeting.title - - # Go to minutes, expect uneditable - find(".op-tab-row--link", text: "MINUTES").click - wait_for_network_idle - expect(page).to have_css(".button", text: "Close the agenda to begin the Minutes") - - # Close the meeting - find(".op-tab-row--link", text: "AGENDA").click - wait_for_network_idle - - accept_confirm do - find(".button", text: "Close").click - end - - # Expect to be on minutes - expect(page).to have_css(".op-tab-row--link_selected", text: "MINUTES") - - # Copies the text - expect(page).to have_css("#tab-content-minutes", text: "asdf") - - # Go back to agenda, expect we can open it again - find(".op-tab-row--link", text: "AGENDA").click - accept_confirm do - find(".button", text: "Open").click - end - expect(page).to have_css(".button", text: "Close") - end - end - - context "without permission to close meetings" do - let(:permissions) { %i[view_meetings] } - - it "cannot delete own and other`s meetings" do - visit project_meetings_path(project) - - expect(page) - .to have_no_link "Close" - end - end -end diff --git a/modules/meeting/spec/features/meetings_copy_spec.rb b/modules/meeting/spec/features/meetings_copy_spec.rb deleted file mode 100644 index 6d4183a628a..00000000000 --- a/modules/meeting/spec/features/meetings_copy_spec.rb +++ /dev/null @@ -1,133 +0,0 @@ -# frozen_string_literal: true -#-- copyright -# OpenProject is an open source project management software. -# Copyright (C) the OpenProject GmbH -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License version 3. -# -# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: -# Copyright (C) 2006-2013 Jean-Philippe Lang -# Copyright (C) 2010-2013 the ChiliProject Team -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# See COPYRIGHT and LICENSE files for more details. -#++ - -require "spec_helper" - -RSpec.describe "Meetings copy", :js do - shared_let(:project) { create(:project, enabled_module_names: %w[meetings]) } - shared_let(:permissions) { %i[view_meetings create_meetings] } - shared_let(:user) do - create(:user, - member_with_permissions: { project => permissions }).tap do |u| - u.pref[:time_zone] = "Etc/UTC" - - u.save! - end - end - shared_let(:other_user) do - create(:user, - member_with_permissions: { project => permissions }) - end - - shared_let(:start_time) { Time.current.next_day.at_noon } - shared_let(:duration) { 1.5 } - shared_let(:agenda_text) { "We will talk" } - shared_let(:meeting) do - create(:meeting, - :author_participates, - author: user, - project:, - title: "Awesome meeting!", - location: "Meeting room", - duration:, - start_time:).tap do |m| - create(:meeting_agenda, meeting: m, text: agenda_text) - create(:meeting_participant, :attendee, meeting: m, user: other_user) - end - end - - shared_let(:twelve_hour_format) { "%I:%M %p" } - shared_let(:copied_meeting_time_heading) do - date = (start_time + 1.day).strftime("%m/%d/%Y") - start_of_meeting = start_time.strftime(twelve_hour_format) - end_of_meeting = (start_time + meeting.duration.hours).strftime(twelve_hour_format) - - "Start time: #{date} #{start_of_meeting} - #{end_of_meeting} UTC+00:00" - end - - before do - login_as user - end - - it "copying a meeting" do - visit project_meetings_path(project) - - click_on meeting.title - - find_test_selector("meetings-more-dropdown-menu").click - page.within(".menu-drop-down-container") do - click_on "Copy" - end - - expect(page) - .to have_field "Title", with: meeting.title - expect(page) - .to have_field "Location", with: meeting.location - expect(page) - .to have_field "Duration", with: meeting.duration - expect(page) - .to have_field "Start date", with: (start_time + 1.day).strftime("%Y-%m-%d") - expect(page) - .to have_field "Time", with: start_time.strftime("%H:%M") - - click_on "Create" - - # Be on the new meeting's page with copied over attributes - expect(page).to have_no_current_path meeting_path(meeting.id) - - expect(page) - .to have_content("Added by #{user.name}") - expect(page) - .to have_content("Meeting: #{meeting.title}") - expect(page) - .to have_content(copied_meeting_time_heading) - expect(page) - .to have_content("Location: #{meeting.location}") - - # Copies the invitees - expect(page) - .to have_content "Invitees: #{other_user.name}" - - # Does not copy the attendees - expect(page) - .to have_no_content "Attendees: #{other_user.name}" - expect(page) - .to have_content "Attendees:" - - # Copies the agenda - click_on "Agenda" - expect(page) - .to have_content agenda_text - - # Adds an entry to the history - click_on "History" - expect(page) - .to have_content("Copied from Meeting ##{meeting.id}") - end -end diff --git a/modules/meeting/spec/features/meetings_delete_spec.rb b/modules/meeting/spec/features/meetings_delete_spec.rb deleted file mode 100644 index 17943bd6c6d..00000000000 --- a/modules/meeting/spec/features/meetings_delete_spec.rb +++ /dev/null @@ -1,101 +0,0 @@ -# frozen_string_literal: true -#-- copyright -# OpenProject is an open source project management software. -# Copyright (C) the OpenProject GmbH -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License version 3. -# -# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: -# Copyright (C) 2006-2013 Jean-Philippe Lang -# Copyright (C) 2010-2013 the ChiliProject Team -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# See COPYRIGHT and LICENSE files for more details. -#++ - -require "spec_helper" - -RSpec.describe "Meetings deletion" do - let(:project) { create(:project, enabled_module_names: %w[meetings]) } - let(:user) do - create(:user, - member_with_permissions: { project => permissions }) - end - let(:other_user) do - create(:user, - member_with_permissions: { project => permissions }) - end - - let!(:meeting) { create(:meeting, project:, title: "Own awesome meeting!", author: user) } - let!(:other_meeting) { create(:meeting, project:, title: "Other awesome meeting!", author: other_user) } - - let(:index_path) { project_meetings_path(project) } - - before do - create(:meeting_participant, :invitee, user:, meeting:) - create(:meeting_participant, :invitee, user:, meeting: other_meeting) - - login_as(user) - end - - context "with permission to delete meetings", :js do - let(:permissions) { %i[view_meetings delete_meetings] } - - it "can delete own and other's meetings" do - visit index_path - - click_on meeting.title - accept_confirm do - find_test_selector("meetings-more-dropdown-menu").click - click_on "Delete" - end - - expect(page) - .to have_current_path index_path - - click_on other_meeting.title - accept_confirm do - find_test_selector("meetings-more-dropdown-menu").click - click_on "Delete" - end - - expect(page) - .to have_content(I18n.t("meeting.blankslate.title")) - - expect(page) - .to have_current_path index_path - end - end - - context "without permission to delete meetings" do - let(:permissions) { %i[view_meetings] } - - it "cannot delete own and other's meetings" do - visit index_path - - click_on meeting.title - expect(page) - .to have_no_link "Delete" - - visit index_path - - click_on other_meeting.title - expect(page) - .to have_no_link "Delete" - end - end -end diff --git a/modules/meeting/spec/features/meetings_locking_spec.rb b/modules/meeting/spec/features/meetings_locking_spec.rb deleted file mode 100644 index ab1d7f1064c..00000000000 --- a/modules/meeting/spec/features/meetings_locking_spec.rb +++ /dev/null @@ -1,66 +0,0 @@ -# frozen_string_literal: true -#-- copyright -# OpenProject is an open source project management software. -# Copyright (C) the OpenProject GmbH -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License version 3. -# -# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: -# Copyright (C) 2006-2013 Jean-Philippe Lang -# Copyright (C) 2010-2013 the ChiliProject Team -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# See COPYRIGHT and LICENSE files for more details. -#++ - -require "spec_helper" - -RSpec.describe "Meetings locking", :js do - let(:project) { create(:project, enabled_module_names: %w[meetings]) } - let(:user) { create(:admin) } - let!(:meeting) { create(:meeting, project:) } - let!(:agenda) { create(:meeting_agenda, meeting:) } - let(:agenda_field) do - TextEditorField.new(page, - "", - selector: test_selector("op-meeting--meeting_agenda")) - end - - before do - login_as(user) - end - - it "shows an error when trying to update a meeting update while editing" do - visit meeting_path(meeting) - - # Edit agenda - within "#tab-content-agenda" do - find(".button--edit-agenda").click - - agenda_field.set_value("Some new text") - - agenda.text = "blabla" - agenda.save! - - click_on "Save" - end - - expect(page).to have_text "Information has been updated by at least one other user in the meantime." - - agenda_field.expect_value("Some new text") - end -end diff --git a/modules/meeting/spec/features/meetings_new_spec.rb b/modules/meeting/spec/features/meetings_new_spec.rb deleted file mode 100644 index fd6393051d7..00000000000 --- a/modules/meeting/spec/features/meetings_new_spec.rb +++ /dev/null @@ -1,349 +0,0 @@ -# frozen_string_literal: true -#-- copyright -# OpenProject is an open source project management software. -# Copyright (C) the OpenProject GmbH -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License version 3. -# -# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: -# Copyright (C) 2006-2013 Jean-Philippe Lang -# Copyright (C) 2010-2013 the ChiliProject Team -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# See COPYRIGHT and LICENSE files for more details. -#++ - -require "spec_helper" - -require_relative "../support/pages/meetings/index" - -RSpec.describe "Meetings new", :js do - shared_let(:project) { create(:project, enabled_module_names: %w[meetings]) } - shared_let(:admin) { create(:admin) } - let(:time_zone) { "Etc/UTC" } - let(:user) do - create(:user, - lastname: "First", - member_with_permissions: { project => permissions }).tap do |u| - u.pref[:time_zone] = time_zone - - u.save! - end - end - let(:other_user) do - create(:user, - lastname: "Second", - member_with_permissions: { project => permissions }) - end - let(:permissions) { %i[view_meetings create_meetings] } - let(:current_user) { user } - - before do - login_as current_user - end - - context "when creating a meeting from the global page" do - before do - other_user - project - end - - let(:index_page) { Pages::Meetings::Index.new(project: nil) } - let(:new_page) { Pages::Meetings::New.new(nil) } - - context "with permission to create meetings" do - it "does not render menus" do - new_page.visit! - new_page.expect_no_main_menu - end - - describe "clicking on the create new meeting button" do - it "navigates to the global create form" do - index_page.visit! - index_page.click_create_new - expect(page).to have_current_path(new_page.path) - end - end - - ["CET", "UTC", "", "Pacific Time (US & Canada)"].each do |zone| - let(:time_zone) { zone } - - it "allows creating a project and handles errors in time zone #{zone}" do - new_page.visit! - - expect_angular_frontend_initialized # Wait for project dropdown to be ready - - new_page.set_title "Some title" - new_page.set_project project - - new_page.set_start_date "2013-03-28" - new_page.set_start_time "13:30" - new_page.set_duration "1.5" - new_page.invite(other_user) - - show_page = new_page.click_create - - expect_flash(message: "Successful creation.") - - show_page.expect_invited(user, other_user) - - show_page.expect_date_time "03/28/2013 01:30 PM - 03:00 PM" - end - end - - context "without a title set" do - before do - new_page.visit! - - # Wait for project dropdown to be initialized - expect_angular_frontend_initialized - - new_page.set_project project - - new_page.set_start_date "2013-03-28" - new_page.set_start_time "13:30" - new_page.set_duration "1.5" - new_page.invite(other_user) - end - - it "renders a validation error" do - expect do - new_page.click_create - end.not_to change(Query, :count) - - # HTML required attribute validation error - expect(page).to have_current_path(new_page.path) - end - end - - context "without a project set" do - before do - new_page.visit! - new_page.set_title "Some title" - new_page.set_start_date "2013-03-28" - new_page.set_start_time "13:30" - new_page.set_duration "1.5" - end - - it "renders a validation error" do - new_page.click_create - - expect_flash(type: :error, - message: "#{Project.model_name.human} #{I18n.t('activerecord.errors.messages.blank')}") - - new_page.expect_project_dropdown - end - end - end - - context "without permission to create meetings" do - let(:permissions) { %i[view_meetings] } - - it "shows no edit link" do - index_page.visit! - - index_page.expect_no_create_new_button - end - end - - context "as an admin" do - let(:current_user) { admin } - - it "allows creating meeting in a project without members" do - new_page.visit! - - expect_angular_frontend_initialized # Wait for project dropdown to be ready - - new_page.set_title "Some title" - - new_page.set_project project - - wait_for_network_idle # Wait for participant section to be fetched - - show_page = new_page.click_create - - expect_flash(message: "Successful creation.") - - # Not sure if that is then intended behaviour but that is what is currently programmed - show_page.expect_invited(admin) - end - - context "without a project set" do - before do - new_page.visit! - new_page.set_title "Some title" - end - - it "renders a validation error" do - new_page.click_create - - expect(page).to have_text "#{Project.model_name.human} #{I18n.t('activerecord.errors.messages.blank')}" - new_page.expect_project_dropdown - end - end - - context "without a title set" do - before do - new_page.visit! - - # Wait for project dropdown to be initialized - expect_angular_frontend_initialized - - new_page.set_project project - end - - it "renders a validation error" do - expect do - new_page.click_create - end.not_to change(Query, :count) - - # HTML required attribute validation error - expect(page).to have_current_path(new_page.path) - end - end - end - end - - context "when creating a meeting from the project-specific page" do - let(:index_page) { Pages::Meetings::Index.new(project:) } - let(:new_page) { Pages::Meetings::New.new(project) } - - context "with permission to create meetings" do - before do - other_user - end - - describe "clicking on the create new meeting button" do - it "navigates to the project-specific create form" do - index_page.visit! - index_page.click_create_new - expect(page).to have_current_path(new_page.path) - end - end - - ["CET", "UTC", "", "Pacific Time (US & Canada)"].each do |zone| - let(:time_zone) { zone } - - it "allows creating a project and handles errors in time zone #{zone}" do - new_page.visit! - - new_page.set_title "Some title" - new_page.set_start_date "2013-03-28" - new_page.set_start_time "13:30" - new_page.set_duration "1.5" - new_page.invite(other_user) - - show_page = new_page.click_create - - expect_flash(message: "Successful creation.") - - show_page.expect_invited(user, other_user) - - show_page.expect_date_time "03/28/2013 01:30 PM - 03:00 PM" - end - end - - context "without a title set" do - before do - new_page.visit! - new_page.set_start_date "2013-03-28" - new_page.set_start_time "13:30" - new_page.set_duration "1.5" - new_page.invite(other_user) - end - - it "renders a validation error" do - expect do - new_page.click_create - end.not_to change(Query, :count) - - # HTML required attribute validation error - expect(page).to have_current_path(new_page.path) - end - end - end - - context "without permission to create meetings" do - let(:permissions) { %i[view_meetings] } - - it "shows no edit link" do - index_page.visit! - - index_page.expect_no_create_new_button - end - end - - context "as an admin" do - let(:current_user) { admin } - let(:field) do - TextEditorField.new(page, - "", - selector: test_selector("op-meeting--meeting_agenda")) - end - - it "allows creating meeting in a project without members" do - new_page.visit! - - new_page.set_title "Some title" - - show_page = new_page.click_create - - expect_flash(message: "Successful creation.") - - # Not sure if that is then intended behaviour but that is what is currently programmed - show_page.expect_invited(admin) - end - - context "without a title set" do - before do - new_page.visit! - end - - it "renders a validation error" do - expect do - new_page.click_create - end.not_to change(Query, :count) - - # HTML required attribute validation error - expect(page).to have_current_path(new_page.path) - end - end - - it "can save the meeting agenda via cmd+Enter" do - new_page.visit! - - new_page.set_title "Some title" - - new_page.click_create - - expect_flash(message: "Successful creation.") - - meeting = Meeting.last - - field.set_value("My new meeting text") - - field.submit_by_enter - - expect_flash(message: "Successful update") - - meeting.reload - - expect(meeting.agenda.text).to eq "My new meeting text" - end - end - end -end diff --git a/modules/meeting/spec/features/meetings_participants_spec.rb b/modules/meeting/spec/features/meetings_participants_spec.rb deleted file mode 100644 index 16ec0cd6d2d..00000000000 --- a/modules/meeting/spec/features/meetings_participants_spec.rb +++ /dev/null @@ -1,97 +0,0 @@ -# frozen_string_literal: true -#-- copyright -# OpenProject is an open source project management software. -# Copyright (C) the OpenProject GmbH -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License version 3. -# -# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: -# Copyright (C) 2006-2013 Jean-Philippe Lang -# Copyright (C) 2010-2013 the ChiliProject Team -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# See COPYRIGHT and LICENSE files for more details. -#++ - -require "spec_helper" - -require_relative "../support/pages/meetings/edit" - -RSpec.describe "Meetings participants" do - let(:project) { create(:project, enabled_module_names: %w[meetings]) } - let!(:user) do - create(:user, - firstname: "Current", - member_with_permissions: { project => %i[view_meetings edit_meetings] }) - end - let!(:viewer_user) do - create(:user, - firstname: "Viewer", - member_with_permissions: { project => %i[view_meetings] }) - end - let!(:non_viewer_user) do - create(:user, - firstname: "Nonviewer", - member_with_permissions: { project => %i[] }) - end - let(:edit_page) { Pages::Meetings::Edit.new(meeting) } - let!(:meeting) { create(:meeting, project:, title: "Awesome meeting!") } - - before do - login_as(user) - end - - it "allows setting members to participants which are allowed to view the meeting" do - edit_page.visit! - - edit_page.expect_available_participant(user) - edit_page.expect_available_participant(viewer_user) - - edit_page.expect_not_available_participant(non_viewer_user) - - edit_page.invite(viewer_user) - show_page = edit_page.click_save - expect_flash(message: "Successful update") - - show_page.expect_invited(viewer_user) - - show_page.click_edit - - edit_page.uninvite(viewer_user) - show_page = edit_page.click_save - - expect_flash(message: "Successful update") - - show_page.expect_uninvited(viewer_user) - end - - context "with an invalid user reference" do - let(:show_page) { Pages::Meetings::Show.new(meeting) } - let(:meeting_participant) { create(:meeting_participant, user: viewer_user, meeting:) } - - before do - meeting_participant.update_column(:user_id, 12341234) - end - - it "still allows to view the meeting" do - show_page.visit! - - show_page.expect_invited meeting.author - show_page.expect_uninvited viewer_user - end - end -end diff --git a/modules/meeting/spec/features/meetings_search_spec.rb b/modules/meeting/spec/features/meetings_search_spec.rb index 48a9188823d..a8f96b18584 100644 --- a/modules/meeting/spec/features/meetings_search_spec.rb +++ b/modules/meeting/spec/features/meetings_search_spec.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + #-- copyright # OpenProject is an open source project management software. # Copyright (C) the OpenProject GmbH @@ -35,7 +36,7 @@ RSpec.describe "Meeting search", :js do let(:role) { create(:project_role, permissions: %i(view_meetings view_work_packages)) } let(:user) { create(:user, member_with_roles: { project => role }) } - let!(:meeting) { create(:structured_meeting, project:) } + let!(:meeting) { create(:meeting, project:) } let!(:agenda_item) { create(:meeting_agenda_item, meeting:) } before do diff --git a/modules/meeting/spec/features/meetings_show_spec.rb b/modules/meeting/spec/features/meetings_show_spec.rb deleted file mode 100644 index 93ec40796b8..00000000000 --- a/modules/meeting/spec/features/meetings_show_spec.rb +++ /dev/null @@ -1,183 +0,0 @@ -# frozen_string_literal: true -#-- copyright -# OpenProject is an open source project management software. -# Copyright (C) the OpenProject GmbH -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License version 3. -# -# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: -# Copyright (C) 2006-2013 Jean-Philippe Lang -# Copyright (C) 2010-2013 the ChiliProject Team -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# See COPYRIGHT and LICENSE files for more details. -#++ - -require "spec_helper" -require_relative "../support/pages/meetings/show" - -RSpec.describe "Meetings", :js do - let(:project) { create(:project, enabled_module_names: %w[meetings]) } - let(:role) { create(:project_role, permissions:) } - let(:user) do - create(:user, - member_with_roles: { project => role }) - end - - let!(:meeting) { create(:meeting, project:, title: "Awesome meeting!") } - let(:show_page) { Pages::Meetings::Show.new(meeting) } - - current_user { user } - - describe "navigate to meeting page" do - before do - create(:meeting_participant, :invitee, user:, meeting:) - end - - let(:permissions) { %i[view_meetings] } - - it "can visit the meeting" do - visit meetings_path(project) - - find("div.title a", text: "Awesome meeting!", wait: 10).click - expect(page).to have_css("h2", text: "Meeting: Awesome meeting!") - - expect(page).to have_test_selector("op-meeting--meeting_agenda", - text: "There is currently nothing to display") - end - - context "with a location" do - context "as a valid url" do - it "renders a link to the meeting location" do - show_page.visit! - - show_page.expect_link_to_location(meeting.location) - end - end - - context "as an invalid url" do - before do - meeting.update!(location: "badurl") - end - - it "renders the meeting location as plaintext" do - show_page.visit! - - show_page.expect_plaintext_location(meeting.location) - end - end - end - - context "with an open agenda" do - let!(:agenda) { create(:meeting_agenda, meeting:, text: "foo") } - let(:agenda_update) { create(:meeting_agenda, meeting:, text: "bla") } - - it "shows the agenda" do - visit meeting_path(meeting) - expect(page).to have_test_selector("op-meeting--meeting_agenda", - text: "foo") - - # May not edit - expect(page).to have_no_css(".button--edit-agenda") - expect(page).not_to have_test_selector("op-meeting--meeting_agenda", - text: "Edit") - end - - it "can view history" do - agenda_update - - visit meeting_path(meeting) - - click_on "History" - - find_by_id("version-1").click - expect(page).to have_test_selector("op-meeting--meeting_agenda", text: "foo") - end - - context "and edit permissions" do - let(:permissions) { %i[view_meetings create_meeting_agendas] } - let(:field) do - TextEditorField.new(page, - "", - selector: test_selector("op-meeting--meeting_agenda")) - end - - it "can edit the agenda" do - visit meeting_path(meeting) - - find(".toolbar-item", text: "Edit").click - - field.expect_value("foo") - - field.set_value("My new meeting text") - - field.submit_by_enter - - expect_and_dismiss_flash(message: "Successful update") - - meeting.reload - - expect(meeting.agenda.text).to eq "My new meeting text" - end - end - - context "and edit minutes permissions" do - let(:permissions) { %i[view_meetings create_meeting_minutes] } - - it "can not edit the minutes" do - visit meeting_path(meeting) - click_on "Minutes" - expect(page).not_to have_test_selector("op-meeting--meeting_minutes", text: "Edit") - expect(page).to have_test_selector("op-meeting--meeting_minutes", - text: "There is currently nothing to display") - end - end - end - - context "with a locked agenda" do - let!(:agenda) { create(:meeting_agenda, meeting:, text: "foo", locked: true) } - - it "shows the minutes when visiting" do - visit meeting_path(meeting) - expect(page).to have_no_css("h2", text: "Agenda") - expect(page).to have_no_css("#meeting_minutes_text") - expect(page).to have_css("h2", text: "Minutes") - end - - context "and edit permissions" do - let(:permissions) { %i[view_meetings create_meeting_minutes] } - let(:field) do - TextEditorField.new(page, - "", - selector: test_selector("op-meeting--meeting_minutes")) - end - - it "can edit the minutes" do - visit meeting_path(meeting) - - field.set_value("This is what we talked about") - - click_on "Save" - - expect(page) - .to have_css(".op-uc-container", - text: "This is what we talked about") - end - end - end - end -end diff --git a/modules/meeting/spec/features/recurring_meetings/recurring_meeting_create_spec.rb b/modules/meeting/spec/features/recurring_meetings/recurring_meeting_create_spec.rb index 721149f006c..77d87002176 100644 --- a/modules/meeting/spec/features/recurring_meetings/recurring_meeting_create_spec.rb +++ b/modules/meeting/spec/features/recurring_meetings/recurring_meeting_create_spec.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + #-- copyright # OpenProject is an open source project management software. # Copyright (C) the OpenProject GmbH @@ -29,8 +30,7 @@ require "spec_helper" -require_relative "../../support/pages/meetings/new" -require_relative "../../support/pages/structured_meeting/show" +require_relative "../../support/pages/meetings/show" require_relative "../../support/pages/recurring_meeting/show" require_relative "../../support/pages/meetings/index" @@ -61,7 +61,7 @@ RSpec.describe "Recurring meetings creation", let(:current_user) { user } let(:meeting) { RecurringMeeting.last } let(:show_page) { Pages::RecurringMeeting::Show.new(meeting) } - let(:template_page) { Pages::StructuredMeeting::Show.new(meeting.template) } + let(:template_page) { Pages::Meetings::Show.new(meeting.template) } let(:meetings_page) { Pages::Meetings::Index.new(project:) } before do diff --git a/modules/meeting/spec/features/recurring_meetings/recurring_meeting_crud_spec.rb b/modules/meeting/spec/features/recurring_meetings/recurring_meeting_crud_spec.rb index aed1150fd41..362a047985a 100644 --- a/modules/meeting/spec/features/recurring_meetings/recurring_meeting_crud_spec.rb +++ b/modules/meeting/spec/features/recurring_meetings/recurring_meeting_crud_spec.rb @@ -30,8 +30,7 @@ require "spec_helper" -require_relative "../../support/pages/meetings/new" -require_relative "../../support/pages/structured_meeting/show" +require_relative "../../support/pages/meetings/show" require_relative "../../support/pages/recurring_meeting/show" require_relative "../../support/pages/meetings/index" diff --git a/modules/meeting/spec/features/recurring_meetings/recurring_meeting_end_series_spec.rb b/modules/meeting/spec/features/recurring_meetings/recurring_meeting_end_series_spec.rb index a54d08eb525..ca45180dc36 100644 --- a/modules/meeting/spec/features/recurring_meetings/recurring_meeting_end_series_spec.rb +++ b/modules/meeting/spec/features/recurring_meetings/recurring_meeting_end_series_spec.rb @@ -30,8 +30,7 @@ require "spec_helper" -require_relative "../../support/pages/meetings/new" -require_relative "../../support/pages/structured_meeting/show" +require_relative "../../support/pages/meetings/show" require_relative "../../support/pages/recurring_meeting/show" require_relative "../../support/pages/meetings/index" diff --git a/modules/meeting/spec/features/recurring_meetings/recurring_meeting_global_create_spec.rb b/modules/meeting/spec/features/recurring_meetings/recurring_meeting_global_create_spec.rb index 795a56f15c0..cc9d629044f 100644 --- a/modules/meeting/spec/features/recurring_meetings/recurring_meeting_global_create_spec.rb +++ b/modules/meeting/spec/features/recurring_meetings/recurring_meeting_global_create_spec.rb @@ -29,8 +29,7 @@ require "spec_helper" -require_relative "../../support/pages/meetings/new" -require_relative "../../support/pages/structured_meeting/show" +require_relative "../../support/pages/meetings/show" require_relative "../../support/pages/recurring_meeting/show" require_relative "../../support/pages/meetings/index" diff --git a/modules/meeting/spec/features/recurring_meetings/recurring_meeting_global_crud_spec.rb b/modules/meeting/spec/features/recurring_meetings/recurring_meeting_global_crud_spec.rb index da7583bf956..6f03deb0517 100644 --- a/modules/meeting/spec/features/recurring_meetings/recurring_meeting_global_crud_spec.rb +++ b/modules/meeting/spec/features/recurring_meetings/recurring_meeting_global_crud_spec.rb @@ -30,8 +30,7 @@ require "spec_helper" -require_relative "../../support/pages/meetings/new" -require_relative "../../support/pages/structured_meeting/show" +require_relative "../../support/pages/meetings/show" require_relative "../../support/pages/recurring_meeting/show" require_relative "../../support/pages/meetings/index" diff --git a/modules/meeting/spec/features/recurring_meetings/recurring_meeting_move_to_next_spec.rb b/modules/meeting/spec/features/recurring_meetings/recurring_meeting_move_to_next_spec.rb index 860a5808317..8945eb9e748 100644 --- a/modules/meeting/spec/features/recurring_meetings/recurring_meeting_move_to_next_spec.rb +++ b/modules/meeting/spec/features/recurring_meetings/recurring_meeting_move_to_next_spec.rb @@ -30,8 +30,7 @@ require "spec_helper" -require_relative "../../support/pages/meetings/new" -require_relative "../../support/pages/structured_meeting/show" +require_relative "../../support/pages/meetings/show" require_relative "../../support/pages/recurring_meeting/show" require_relative "../../support/pages/meetings/index" @@ -60,8 +59,8 @@ RSpec.describe "Recurring meetings move to next meeting", :js do end_after: "never", author: user_with_manage_permissions end - shared_let(:structured_meeting) do - create :structured_meeting, + shared_let(:meeting) do + create :meeting, project:, start_time: DateTime.parse("2025-01-28T10:30:00Z"), duration: 1, @@ -75,10 +74,8 @@ RSpec.describe "Recurring meetings move to next meeting", :js do series.meetings.not_templated.first end - let!(:agenda_item) { create(:meeting_agenda_item, meeting: structured_meeting, title: "Test notes") } - let!(:series_agenda_item) { create(:meeting_agenda_item, meeting: recurring_meeting, title: "Test notes") } - - let(:meeting_page) { Pages::StructuredMeeting::Show.new(meeting) } + let!(:agenda_item) { create(:meeting_agenda_item, meeting:, title: "Test notes") } + let(:meeting_page) { Pages::Meetings::Show.new(meeting) } before do login_as current_user @@ -94,10 +91,9 @@ RSpec.describe "Recurring meetings move to next meeting", :js do it "shows the move to next meeting option" do meeting_page.expect_agenda_item(title: "Test notes") - meeting_page.expect_agenda_action_menu(series_agenda_item) accept_confirm do - meeting_page.select_action(series_agenda_item, "Move to next meeting") + meeting_page.select_action(agenda_item, "Move to next meeting") end meeting_page.expect_no_agenda_item(title: "Test notes") @@ -115,10 +111,9 @@ RSpec.describe "Recurring meetings move to next meeting", :js do it "shows the move to next meeting option" do meeting_page.expect_agenda_item(title: "Test notes") - meeting_page.expect_agenda_action_menu(series_agenda_item) accept_confirm do - meeting_page.select_action(series_agenda_item, "Move to next meeting") + meeting_page.select_action(agenda_item, "Move to next meeting") end expect(page).to have_text "Unable to move to the next meeting since it has been cancelled." @@ -136,8 +131,7 @@ RSpec.describe "Recurring meetings move to next meeting", :js do end end - context "when viewing a structured meeting" do - let(:meeting) { structured_meeting } + context "when viewing a one-time meeting" do let(:current_user) { user_with_manage_permissions } it "does not show the move to next meeting option" do diff --git a/modules/meeting/spec/features/structured_meetings/attachment_upload_spec.rb b/modules/meeting/spec/features/structured_meetings/attachment_upload_spec.rb index 8e2e41f26c7..5ff6d968bfd 100644 --- a/modules/meeting/spec/features/structured_meetings/attachment_upload_spec.rb +++ b/modules/meeting/spec/features/structured_meetings/attachment_upload_spec.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + #-- copyright # OpenProject is an open source project management software. # Copyright (C) the OpenProject GmbH @@ -29,7 +30,7 @@ require "spec_helper" require "features/page_objects/notification" -require_relative "../../support/pages/structured_meeting/show" +require_relative "../../support/pages/meetings/show" RSpec.describe "Upload attachment to meetings", :js do let(:user) do @@ -43,8 +44,8 @@ RSpec.describe "Upload attachment to meetings", :js do let(:wiki_page_content) { project.wiki.pages.first.text } let(:attachment_list) { Components::AttachmentsList.new("#content") } - let(:meeting) { create(:structured_meeting, project:) } - let(:show_page) { Pages::StructuredMeeting::Show.new(meeting) } + let(:meeting) { create(:meeting, project:) } + let(:show_page) { Pages::Meetings::Show.new(meeting) } before do login_as(user) diff --git a/modules/meeting/spec/features/structured_meetings/history_spec.rb b/modules/meeting/spec/features/structured_meetings/history_spec.rb index feb6a9d28f8..78d9296e73d 100644 --- a/modules/meeting/spec/features/structured_meetings/history_spec.rb +++ b/modules/meeting/spec/features/structured_meetings/history_spec.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + #-- copyright # OpenProject is an open source project management software. # Copyright (C) the OpenProject GmbH @@ -29,9 +30,8 @@ require "spec_helper" -require_relative "../../support/pages/meetings/new" -require_relative "../../support/pages/structured_meeting/show" -require_relative "../../support/pages/structured_meeting/history" +require_relative "../../support/pages/meetings/show" +require_relative "../../support/pages/meetings/history" RSpec.describe "history", :js do @@ -72,7 +72,7 @@ RSpec.describe "history", end shared_let(:meeting) do User.execute_as(user) do - create(:structured_meeting, + create(:meeting, project:, start_time: DateTime.parse("2024-03-28T13:30:00Z"), title: "Some title", @@ -82,8 +82,8 @@ RSpec.describe "history", end end - let(:show_page) { Pages::StructuredMeeting::Show.new(meeting) } - let(:history_page) { Pages::StructuredMeeting::History.new(meeting) } + let(:show_page) { Pages::Meetings::Show.new(meeting) } + let(:history_page) { Pages::Meeting::History.new(meeting) } let(:editor) { Components::WysiwygEditor.new "#content", "opce-ckeditor-augmented-textarea" } it "allows browsing the history", with_settings: { journal_aggregation_time_minutes: 0 } do diff --git a/modules/meeting/spec/features/structured_meetings/meeting_outcomes/meeting_outcomes_crud_spec.rb b/modules/meeting/spec/features/structured_meetings/meeting_outcomes/meeting_outcomes_crud_spec.rb index 5c11ad33be1..0f5eee55cce 100644 --- a/modules/meeting/spec/features/structured_meetings/meeting_outcomes/meeting_outcomes_crud_spec.rb +++ b/modules/meeting/spec/features/structured_meetings/meeting_outcomes/meeting_outcomes_crud_spec.rb @@ -30,7 +30,7 @@ require "spec_helper" -require_relative "../../../support/pages/structured_meeting/show" +require_relative "../../../support/pages/meetings/show" RSpec.describe "Meeting Outcomes CRUD", :js do shared_let(:project) { create(:project, enabled_module_names: %w[meetings]) } @@ -46,7 +46,7 @@ RSpec.describe "Meeting Outcomes CRUD", :js do member_with_permissions: { project => %i[view_meetings manage_agendas close_meeting_agendas] } end shared_let(:meeting) do - create :structured_meeting, + create :meeting, project:, start_time: "2024-12-31T13:30:00Z", duration: 1.5, @@ -59,7 +59,7 @@ RSpec.describe "Meeting Outcomes CRUD", :js do let(:current_user) { user } let(:state) { :in_progress } - let(:show_page) { Pages::StructuredMeeting::Show.new(meeting) } + let(:show_page) { Pages::Meetings::Show.new(meeting) } let(:field) do TextEditorField.new(page, "Outcome", selector: test_selector("meeting-outcome-input")) end diff --git a/modules/meeting/spec/features/structured_meetings/mobile_structure_meeting_spec.rb b/modules/meeting/spec/features/structured_meetings/mobile_structure_meeting_spec.rb index 997873fbc0a..8a758188e16 100644 --- a/modules/meeting/spec/features/structured_meetings/mobile_structure_meeting_spec.rb +++ b/modules/meeting/spec/features/structured_meetings/mobile_structure_meeting_spec.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + #-- copyright # OpenProject is an open source project management software. # Copyright (C) the OpenProject GmbH @@ -29,9 +30,9 @@ require "spec_helper" -require_relative "../../support/pages/structured_meeting//mobile/show" +require_relative "../../support/pages/meetings/mobile/show" -RSpec.describe "Structured meetings CRUD", +RSpec.describe "Meetings CRUD", :js do include Components::Autocompleter::NgSelectAutocompleteHelpers @@ -57,14 +58,14 @@ RSpec.describe "Structured meetings CRUD", end shared_let(:meeting) do - create(:structured_meeting, + create(:meeting, :author_participates, project:, author: user) end let(:current_user) { user } - let(:show_page) { Pages::StructuredMeeting::Mobile::Show.new(StructuredMeeting.last) } + let(:show_page) { Pages::Meetings::Mobile::Show.new(Meeting.last) } include_context "with mobile screen size" @@ -73,7 +74,7 @@ RSpec.describe "Structured meetings CRUD", show_page.visit! end - it "can edit participants of a structured meeting" do + it "can edit participants of a meeting" do expect(page).to have_current_path(show_page.path) show_page.expect_participants(count: 1) diff --git a/modules/meeting/spec/features/structured_meetings/structured_meeting_crud_spec.rb b/modules/meeting/spec/features/structured_meetings/structured_meeting_crud_spec.rb index f9ba5e27b9f..2046909f019 100644 --- a/modules/meeting/spec/features/structured_meetings/structured_meeting_crud_spec.rb +++ b/modules/meeting/spec/features/structured_meetings/structured_meeting_crud_spec.rb @@ -30,11 +30,10 @@ require "spec_helper" -require_relative "../../support/pages/meetings/new" -require_relative "../../support/pages/structured_meeting/show" +require_relative "../../support/pages/meetings/show" require_relative "../../support/pages/meetings/index" -RSpec.describe "Structured meetings CRUD", +RSpec.describe "Meetings CRUD", :js do include Components::Autocompleter::NgSelectAutocompleteHelpers @@ -63,9 +62,8 @@ RSpec.describe "Structured meetings CRUD", end let(:current_user) { user } - let(:new_page) { Pages::Meetings::New.new(project) } - let(:meeting) { StructuredMeeting.last } - let(:show_page) { Pages::StructuredMeeting::Show.new(meeting) } + let(:meeting) { Meeting.last } + let(:show_page) { Pages::Meetings::Show.new(meeting) } let(:meetings_page) { Pages::Meetings::Index.new(project:) } before do |test| @@ -88,7 +86,7 @@ RSpec.describe "Structured meetings CRUD", meetings_page.click_create end - it "can create a structured meeting and add agenda items" do + it "can create a meeting and add agenda items" do expect_and_dismiss_flash(type: :success, message: "Successful creation") # Does not send invitation mails by default @@ -312,7 +310,7 @@ RSpec.describe "Structured meetings CRUD", fill_in "Title", with: "Some title" click_on "Create meeting" - new_meeting = StructuredMeeting.last + new_meeting = Meeting.last expect(page).to have_current_path "/projects/#{project.identifier}/meetings/#{new_meeting.id}" # check for copied agenda items @@ -330,13 +328,13 @@ RSpec.describe "Structured meetings CRUD", end context "with a work package reference to another" do - let!(:meeting) { create(:structured_meeting, project:, author: current_user) } + let!(:meeting) { create(:meeting, project:, author: current_user) } let!(:other_project) { create(:project) } let!(:other_wp) { create(:work_package, project: other_project, author: current_user, subject: "Private task") } let!(:role) { create(:project_role, permissions: %w[view_work_packages]) } let!(:membership) { create(:member, principal: user, project: other_project, roles: [role]) } let!(:agenda_item) { create(:wp_meeting_agenda_item, meeting:, author: current_user, work_package: other_wp) } - let(:show_page) { Pages::StructuredMeeting::Show.new(meeting) } + let(:show_page) { Pages::Meetings::Show.new(meeting) } it "shows correctly for author, but returns an unresolved reference for the second user" do show_page.visit! @@ -352,8 +350,8 @@ RSpec.describe "Structured meetings CRUD", end context "with sections" do - let!(:meeting) { create(:structured_meeting, project:, author: current_user) } - let(:show_page) { Pages::StructuredMeeting::Show.new(meeting) } + let!(:meeting) { create(:meeting, project:, author: current_user) } + let(:show_page) { Pages::Meetings::Show.new(meeting) } context "when starting with empty sections" do it "can add, edit and delete sections" do diff --git a/modules/meeting/spec/features/structured_meetings/structured_meeting_delete_spec.rb b/modules/meeting/spec/features/structured_meetings/structured_meeting_delete_spec.rb index fc8a25344d4..6779b75c08d 100644 --- a/modules/meeting/spec/features/structured_meetings/structured_meeting_delete_spec.rb +++ b/modules/meeting/spec/features/structured_meetings/structured_meeting_delete_spec.rb @@ -30,11 +30,10 @@ require "spec_helper" -require_relative "../../support/pages/meetings/new" -require_relative "../../support/pages/structured_meeting/show" +require_relative "../../support/pages/meetings/show" require_relative "../../support/pages/meetings/index" -RSpec.describe "Structured meetings deletion", +RSpec.describe "Meetings deletion", :js do include Components::Autocompleter::NgSelectAutocompleteHelpers diff --git a/modules/meeting/spec/features/structured_meetings/structured_meeting_global_crud_spec.rb b/modules/meeting/spec/features/structured_meetings/structured_meeting_global_crud_spec.rb index 64cb70ac8e2..78866d68202 100644 --- a/modules/meeting/spec/features/structured_meetings/structured_meeting_global_crud_spec.rb +++ b/modules/meeting/spec/features/structured_meetings/structured_meeting_global_crud_spec.rb @@ -30,11 +30,10 @@ require "spec_helper" -require_relative "../../support/pages/meetings/new" -require_relative "../../support/pages/structured_meeting/show" +require_relative "../../support/pages/meetings/show" require_relative "../../support/pages/meetings/index" -RSpec.describe "Structured meetings global CRUD", :js do +RSpec.describe "Meetings global CRUD", :js do include Components::Autocompleter::NgSelectAutocompleteHelpers shared_let(:project) { create(:project, enabled_module_names: %w[meetings work_package_tracking]) } @@ -62,9 +61,8 @@ RSpec.describe "Structured meetings global CRUD", :js do end let(:current_user) { user } - let(:new_page) { Pages::Meetings::New.new(project) } - let(:meeting) { StructuredMeeting.last } - let(:show_page) { Pages::StructuredMeeting::Show.new(meeting) } + let(:meeting) { Meeting.last } + let(:show_page) { Pages::Meetings::Show.new(meeting) } let(:meetings_page) { Pages::Meetings::Index.new(project: nil) } before do diff --git a/modules/meeting/spec/features/structured_meetings/structured_meeting_participant_spec.rb b/modules/meeting/spec/features/structured_meetings/structured_meeting_participant_spec.rb index 6df140abe18..86091b124c2 100644 --- a/modules/meeting/spec/features/structured_meetings/structured_meeting_participant_spec.rb +++ b/modules/meeting/spec/features/structured_meetings/structured_meeting_participant_spec.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + #-- copyright # OpenProject is an open source project management software. # Copyright (C) the OpenProject GmbH @@ -29,9 +30,9 @@ require "spec_helper" -require_relative "../../support/pages/structured_meeting//mobile/show" +require_relative "../../support/pages/meetings/mobile/show" -RSpec.describe "Structured meetings participants", +RSpec.describe "Meetings participants", :js do include Components::Autocompleter::NgSelectAutocompleteHelpers @@ -57,21 +58,21 @@ RSpec.describe "Structured meetings participants", end shared_let(:meeting) do - create(:structured_meeting, + create(:meeting, :author_participates, project:, author: user) end let(:current_user) { user } - let(:show_page) { Pages::StructuredMeeting::Show.new(StructuredMeeting.last) } + let(:show_page) { Pages::Meetings::Show.new(Meeting.last) } before do login_as current_user show_page.visit! end - it "can edit participants of a structured meeting" do + it "can edit participants of a meeting" do expect(page).to have_current_path(show_page.path) show_page.open_participant_form diff --git a/modules/meeting/spec/features/structured_meetings/structured_meeting_update_flash_spec.rb b/modules/meeting/spec/features/structured_meetings/structured_meeting_update_flash_spec.rb index ed037ac0320..2db7b6b2951 100644 --- a/modules/meeting/spec/features/structured_meetings/structured_meeting_update_flash_spec.rb +++ b/modules/meeting/spec/features/structured_meetings/structured_meeting_update_flash_spec.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + #-- copyright # OpenProject is an open source project management software. # Copyright (C) the OpenProject GmbH @@ -29,10 +30,9 @@ require "spec_helper" -require_relative "../../support/pages/meetings/new" -require_relative "../../support/pages/structured_meeting/show" +require_relative "../../support/pages/meetings/show" -RSpec.describe "Structured meetings CRUD", +RSpec.describe "Meetings CRUD", :js, :selenium do include Components::Autocompleter::NgSelectAutocompleteHelpers @@ -41,9 +41,8 @@ RSpec.describe "Structured meetings CRUD", shared_let(:user) { create(:admin) } current_user { user } - let(:new_page) { Pages::Meetings::New.new(project) } - let(:meeting) { create(:structured_meeting, project:, author: current_user) } - let(:show_page) { Pages::StructuredMeeting::Show.new(meeting) } + let(:meeting) { create(:meeting, project:, author: current_user) } + let(:show_page) { Pages::Meetings::Show.new(meeting) } describe "meeting update flash" do before do @@ -134,7 +133,7 @@ RSpec.describe "Structured meetings CRUD", ## Edit meeting details within_window(first_window) do find_test_selector("edit-meeting-details-button").click - fill_in "structured_meeting_duration", with: "2.5" + fill_in "meeting_duration", with: "2.5" click_link_or_button "Save" # Expect updated duration diff --git a/modules/meeting/spec/features/structured_meetings/turbo_links_spec.rb b/modules/meeting/spec/features/structured_meetings/turbo_links_spec.rb index 935958f11a5..fa027164a9c 100644 --- a/modules/meeting/spec/features/structured_meetings/turbo_links_spec.rb +++ b/modules/meeting/spec/features/structured_meetings/turbo_links_spec.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + #-- copyright # OpenProject is an open source project management software. # Copyright (C) the OpenProject GmbH @@ -29,10 +30,9 @@ require "spec_helper" -require_relative "../../support/pages/meetings/new" -require_relative "../../support/pages/structured_meeting/show" +require_relative "../../support/pages/meetings/show" -RSpec.describe "Structured meetings links caught by turbo", +RSpec.describe "Meetings links caught by turbo", :js do include Rails.application.routes.url_helpers @@ -47,8 +47,8 @@ RSpec.describe "Structured meetings links caught by turbo", u.save! end end - shared_let(:meeting1) { create(:structured_meeting, title: "First meeting", project:) } - shared_let(:meeting2) { create(:structured_meeting, title: "Other meeting", project:) } + shared_let(:meeting1) { create(:meeting, title: "First meeting", project:) } + shared_let(:meeting2) { create(:meeting, title: "Other meeting", project:) } let(:notes) do <<~NOTES @@ -56,7 +56,7 @@ RSpec.describe "Structured meetings links caught by turbo", NOTES end let!(:agenda_item) { create(:meeting_agenda_item, meeting: meeting1, notes:) } - let(:show_page) { Pages::StructuredMeeting::Show.new(meeting1) } + let(:show_page) { Pages::Meetings::Show.new(meeting1) } before do login_as user diff --git a/modules/meeting/spec/features/structured_meetings/work_package_meetings_tab_spec.rb b/modules/meeting/spec/features/structured_meetings/work_package_meetings_tab_spec.rb index 8ce9d2e8deb..510735987ee 100644 --- a/modules/meeting/spec/features/structured_meetings/work_package_meetings_tab_spec.rb +++ b/modules/meeting/spec/features/structured_meetings/work_package_meetings_tab_spec.rb @@ -30,7 +30,7 @@ require "spec_helper" require_relative "../../support/pages/work_package_meetings_tab" -require_relative "../../support/pages/structured_meeting/show" +require_relative "../../support/pages/meetings/show" RSpec.describe "Open the Meetings tab", :js do @@ -98,8 +98,8 @@ RSpec.describe "Open the Meetings tab", context "when the user has the permission to see the tab, but the work package is linked in two projects" do let(:other_project) { create(:project, enabled_module_names: %w[meetings]) } - let!(:visible_meeting) { create(:structured_meeting, project:) } - let!(:invisible_meeting) { create(:structured_meeting, project: other_project) } + let!(:visible_meeting) { create(:meeting, project:) } + let!(:invisible_meeting) { create(:meeting, project: other_project) } let!(:meeting_agenda_item_of_visible_meeting) do create(:meeting_agenda_item, meeting: visible_meeting, work_package:, notes: "Public note!") @@ -131,7 +131,7 @@ RSpec.describe "Open the Meetings tab", end context "with another past meeting" do - let!(:past_meeting) { create(:structured_meeting, project:, start_time: 1.week.ago) } + let!(:past_meeting) { create(:meeting, project:, start_time: 1.week.ago) } let!(:past_agenda_item) do create(:meeting_agenda_item, meeting: past_meeting, work_package:, notes: "Public note!") @@ -225,8 +225,8 @@ RSpec.describe "Open the Meetings tab", end context "when the work_package is already referenced in upcoming meetings" do - let!(:first_meeting) { create(:structured_meeting, project:) } - let!(:second_meeting) { create(:structured_meeting, project:) } + let!(:first_meeting) { create(:meeting, project:) } + let!(:second_meeting) { create(:meeting, project:) } let!(:first_meeting_agenda_item_of_first_meeting) do create(:meeting_agenda_item, meeting: first_meeting, work_package:, notes: "A very important note in first meeting!") @@ -267,7 +267,7 @@ RSpec.describe "Open the Meetings tab", end context "when the work_package is referenced and has an outcome" do - let!(:meeting) { create(:structured_meeting, project:) } + let!(:meeting) { create(:meeting, project:) } let!(:meeting_agenda_item) do create(:meeting_agenda_item, meeting:, work_package:, notes: "A very important note in first meeting!") @@ -291,8 +291,8 @@ RSpec.describe "Open the Meetings tab", end context "when the work_package was already referenced in past meetings" do - let!(:first_past_meeting) { create(:structured_meeting, project:, start_time: Date.yesterday - 11.hours) } - let!(:second_past_meeting) { create(:structured_meeting, project:, start_time: Date.yesterday - 10.hours) } + let!(:first_past_meeting) { create(:meeting, project:, start_time: Date.yesterday - 11.hours) } + let!(:second_past_meeting) { create(:meeting, project:, start_time: Date.yesterday - 10.hours) } let!(:first_meeting_agenda_item_of_first_past_meeting) do create(:meeting_agenda_item, meeting: first_past_meeting, work_package:, notes: "A very important note in first meeting!") @@ -347,15 +347,15 @@ RSpec.describe "Open the Meetings tab", end context "when open, upcoming meetings are visible for the user" do - shared_let(:past_meeting) { create(:structured_meeting, project:, start_time: Date.yesterday - 10.hours) } - shared_let(:first_upcoming_meeting) { create(:structured_meeting, project:) } - shared_let(:second_upcoming_meeting) { create(:structured_meeting, project:) } - shared_let(:closed_upcoming_meeting) { create(:structured_meeting, project:, state: :closed) } + shared_let(:past_meeting) { create(:meeting, project:, start_time: Date.yesterday - 10.hours) } + shared_let(:first_upcoming_meeting) { create(:meeting, project:) } + shared_let(:second_upcoming_meeting) { create(:meeting, project:) } + shared_let(:closed_upcoming_meeting) { create(:meeting, project:, state: :closed) } shared_let(:ongoing_meeting) do - create(:structured_meeting, title: "Ongoing", project:, start_time: 1.hour.ago, duration: 4.0) + create(:meeting, title: "Ongoing", project:, start_time: 1.hour.ago, duration: 4.0) end - let(:meeting_page) { Pages::StructuredMeeting::Show.new(first_upcoming_meeting) } + let(:meeting_page) { Pages::Meetings::Show.new(first_upcoming_meeting) } it "enables the user to add the work package to multiple open, upcoming meetings" do work_package_page.visit! diff --git a/modules/meeting/spec/mailers/meeting_mailer_spec.rb b/modules/meeting/spec/mailers/meeting_mailer_spec.rb index 7a5c058144b..e17ea369ceb 100644 --- a/modules/meeting/spec/mailers/meeting_mailer_spec.rb +++ b/modules/meeting/spec/mailers/meeting_mailer_spec.rb @@ -45,9 +45,6 @@ RSpec.describe MeetingMailer do author:, project:) end - let(:meeting_agenda) do - create(:meeting_agenda, meeting:) - end let(:tokyo_offset) { "UTC#{ActiveSupport::TimeZone['Asia/Tokyo'].now.formatted_offset}" } let(:berlin_offset) { "UTC#{ActiveSupport::TimeZone['Europe/Berlin'].now.formatted_offset}" } diff --git a/modules/meeting/spec/models/meeting_acts_as_journalized_spec.rb b/modules/meeting/spec/models/meeting_acts_as_journalized_spec.rb index 6f834a756e5..5d57eda6008 100644 --- a/modules/meeting/spec/models/meeting_acts_as_journalized_spec.rb +++ b/modules/meeting/spec/models/meeting_acts_as_journalized_spec.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + #-- copyright # OpenProject is an open source project management software. # Copyright (C) the OpenProject GmbH @@ -35,7 +36,7 @@ RSpec.describe Meeting do let!(:meeting) do User.execute_as current_user do - create(:structured_meeting, author: user) + create(:meeting, author: user) end end diff --git a/modules/meeting/spec/models/meeting_agenda_item_spec.rb b/modules/meeting/spec/models/meeting_agenda_item_spec.rb index 00e6651aebc..78183c4cfeb 100644 --- a/modules/meeting/spec/models/meeting_agenda_item_spec.rb +++ b/modules/meeting/spec/models/meeting_agenda_item_spec.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + #-- copyright # OpenProject is an open source project management software. # Copyright (C) the OpenProject GmbH @@ -31,7 +32,7 @@ require_relative "../spec_helper" RSpec.describe MeetingAgendaItem do let(:meeting_attributes) { {} } - let(:meeting) { build_stubbed(:structured_meeting, **meeting_attributes) } + let(:meeting) { build_stubbed(:meeting, **meeting_attributes) } let(:attributes) { {} } let(:meeting_agenda_item) { described_class.new(meeting:, **attributes) } diff --git a/modules/meeting/spec/models/meeting_agenda_spec.rb b/modules/meeting/spec/models/meeting_agenda_spec.rb deleted file mode 100644 index becc0486d6b..00000000000 --- a/modules/meeting/spec/models/meeting_agenda_spec.rb +++ /dev/null @@ -1,71 +0,0 @@ -# frozen_string_literal: true -#-- copyright -# OpenProject is an open source project management software. -# Copyright (C) the OpenProject GmbH -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License version 3. -# -# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: -# Copyright (C) 2006-2013 Jean-Philippe Lang -# Copyright (C) 2010-2013 the ChiliProject Team -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# See COPYRIGHT and LICENSE files for more details. -#++ - -require_relative "../spec_helper" - -RSpec.describe "MeetingAgenda" do - before do - @a = build(:meeting_agenda, text: "Some content...\n\nMore content!\n\nExtraordinary content!!") - end - - # TODO: Test the right user and messages are set in the history - describe "#lock!" do - it "locks the agenda" do - @a.save - @a.reload - @a.lock! - @a.reload - expect(@a.locked).to be_truthy - end - end - - describe "#unlock!" do - it "unlocks the agenda" do - @a.locked = true - @a.save - @a.reload - @a.unlock! - @a.reload - expect(@a.locked).to be_falsey - end - end - - # a meeting agenda is editable when it is not locked - describe "#editable?" do - it "is editable when not locked" do - @a.locked = false - expect(@a.editable?).to be_truthy - end - - it "is not editable when locked" do - @a.locked = true - expect(@a.editable?).to be_falsey - end - end -end diff --git a/modules/meeting/spec/models/meeting_minutes_spec.rb b/modules/meeting/spec/models/meeting_minutes_spec.rb deleted file mode 100644 index 500657d1bf8..00000000000 --- a/modules/meeting/spec/models/meeting_minutes_spec.rb +++ /dev/null @@ -1,66 +0,0 @@ -# frozen_string_literal: true -#-- copyright -# OpenProject is an open source project management software. -# Copyright (C) the OpenProject GmbH -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License version 3. -# -# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: -# Copyright (C) 2006-2013 Jean-Philippe Lang -# Copyright (C) 2010-2013 the ChiliProject Team -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# See COPYRIGHT and LICENSE files for more details. -#++ - -require_relative "../spec_helper" - -RSpec.describe "MeetingMinutes" do - before do - @min = build(:meeting_minutes) - end - - # meeting minutes are editable when the meeting agenda is locked - describe "#editable?" do - before do - @mee = build(:meeting) - @min.meeting = @mee - end - - describe "with no agenda present" do - it "is not editable" do - expect(@min.editable?).to be_falsey - end - end - - describe "with an agenda present" do - before do - @a = build(:meeting_agenda) - @mee.agenda = @a - end - - it "is not editable when the agenda is open" do - expect(@min.editable?).to be_falsey - end - - it "is editable when the agenda is closed" do - @a.lock! - expect(@min.editable?).to be_truthy - end - end - end -end diff --git a/modules/meeting/spec/models/meeting_section_spec.rb b/modules/meeting/spec/models/meeting_section_spec.rb index e34aaddd831..5c3cea18ee0 100644 --- a/modules/meeting/spec/models/meeting_section_spec.rb +++ b/modules/meeting/spec/models/meeting_section_spec.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + #-- copyright # OpenProject is an open source project management software. # Copyright (C) the OpenProject GmbH @@ -31,7 +32,7 @@ require_relative "../spec_helper" RSpec.describe MeetingSection do let(:meeting_attributes) { {} } - let(:meeting) { build_stubbed(:structured_meeting, **meeting_attributes) } + let(:meeting) { build_stubbed(:meeting, **meeting_attributes) } let(:attributes) { {} } let(:meeting_section) { described_class.new(meeting:, **attributes) } @@ -73,7 +74,7 @@ RSpec.describe MeetingSection do describe "#agenda_items_sum_duration_in_minutes" do subject { meeting_section.agenda_items_sum_duration_in_minutes } - let(:meeting) { create(:structured_meeting, **meeting_attributes) } + let(:meeting) { create(:meeting, **meeting_attributes) } let(:meeting_section) { create(:meeting_section, meeting:) } context "when there are no agenda items" do diff --git a/modules/meeting/spec/models/meeting_spec.rb b/modules/meeting/spec/models/meeting_spec.rb index 8e45a28c4eb..c2ebc8d7b30 100644 --- a/modules/meeting/spec/models/meeting_spec.rb +++ b/modules/meeting/spec/models/meeting_spec.rb @@ -32,12 +32,9 @@ require_relative "../spec_helper" RSpec.describe Meeting do shared_let (:user1) { create(:user) } shared_let (:user2) { create(:user) } + let(:project) { create(:project, members: project_members) } let(:meeting) { create(:meeting, :author_participates, project:, author: user1) } - let(:agenda) do - meeting.create_agenda text: "Meeting Agenda text" - meeting.reload_agenda # avoiding stale object errors - end let(:project_members) { {} } let(:role) { create(:project_role, permissions: [:view_meetings]) } @@ -152,22 +149,6 @@ RSpec.describe Meeting do it { expect(meeting.watchers.collect(&:user)).to contain_exactly(user1, user2) } end - describe "#close_agenda_and_copy_to_minutes" do - before do - agenda # creating it - - meeting.close_agenda_and_copy_to_minutes! - end - - it "creates a meeting with the agenda's text" do - expect(meeting.minutes.text).to eq(meeting.agenda.text) - end - - it "closes the agenda" do - expect(meeting.agenda).to be_locked - end - end - describe "Timezones" do shared_examples "uses that zone" do |zone| it do @@ -203,10 +184,6 @@ RSpec.describe Meeting do it "uses the :view_meetings permission" do expect(described_class.acts_as_watchable_permission).to eq(:view_meetings) end - - it "uses the :view_meetings permission in STI classes" do - expect(StructuredMeeting.acts_as_watchable_permission).to eq(:view_meetings) - end end describe "duration" do diff --git a/modules/meeting/spec/requests/api/v3/attachments/meeting_agenda_spec.rb b/modules/meeting/spec/requests/api/v3/attachments/meeting_agenda_spec.rb deleted file mode 100644 index 32cce374d07..00000000000 --- a/modules/meeting/spec/requests/api/v3/attachments/meeting_agenda_spec.rb +++ /dev/null @@ -1,44 +0,0 @@ -# frozen_string_literal: true -#-- copyright -# OpenProject is an open source project management software. -# Copyright (C) the OpenProject GmbH -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License version 3. -# -# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: -# Copyright (C) 2006-2013 Jean-Philippe Lang -# Copyright (C) 2010-2013 the ChiliProject Team -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# See COPYRIGHT and LICENSE files for more details. -#++ - -require "spec_helper" -require "requests/api/v3/attachments/attachment_resource_shared_examples" - -RSpec.describe "meeting agenda attachments" do - it_behaves_like "an APIv3 attachment resource" do - let(:attachment_type) { :meeting_content } - - let(:create_permission) { :create_meetings } - let(:read_permission) { :view_meetings } - let(:update_permission) { :edit_meetings } - - let(:meeting_content) { create(:meeting_agenda, meeting:) } - let(:meeting) { create(:meeting, project:) } - end -end diff --git a/modules/meeting/spec/requests/api/v3/attachments/meeting_minutes_spec.rb b/modules/meeting/spec/requests/api/v3/attachments/meeting_minutes_spec.rb deleted file mode 100644 index 2bc8640fdea..00000000000 --- a/modules/meeting/spec/requests/api/v3/attachments/meeting_minutes_spec.rb +++ /dev/null @@ -1,44 +0,0 @@ -# frozen_string_literal: true -#-- copyright -# OpenProject is an open source project management software. -# Copyright (C) the OpenProject GmbH -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License version 3. -# -# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: -# Copyright (C) 2006-2013 Jean-Philippe Lang -# Copyright (C) 2010-2013 the ChiliProject Team -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# See COPYRIGHT and LICENSE files for more details. -#++ - -require "spec_helper" -require "requests/api/v3/attachments/attachment_resource_shared_examples" - -RSpec.describe "meeting minutes attachments" do - it_behaves_like "an APIv3 attachment resource" do - let(:attachment_type) { :meeting_content } - - let(:create_permission) { :create_meetings } - let(:read_permission) { :view_meetings } - let(:update_permission) { :edit_meetings } - - let(:meeting_content) { create(:meeting_minutes, meeting:) } - let(:meeting) { create(:meeting, project:) } - end -end diff --git a/modules/meeting/spec/requests/meetings_index_spec.rb b/modules/meeting/spec/requests/meetings_index_spec.rb index ed4786a3072..cfedbd2032a 100644 --- a/modules/meeting/spec/requests/meetings_index_spec.rb +++ b/modules/meeting/spec/requests/meetings_index_spec.rb @@ -37,7 +37,7 @@ RSpec.describe "Meeting index", shared_let(:user) { create(:user, member_with_permissions: { project => %i[view_meetings] }) } shared_let(:past) do - create(:structured_meeting, + create(:meeting, :author_participates, title: "an earlier meeting", start_time: DateTime.parse("2025-01-29T06:00:00Z"), @@ -46,7 +46,7 @@ RSpec.describe "Meeting index", end shared_let(:today) do - create(:structured_meeting, + create(:meeting, :author_participates, title: "meeting starting soon", start_time: DateTime.parse("2025-01-29T10:00:00Z"), @@ -55,7 +55,7 @@ RSpec.describe "Meeting index", end shared_let(:tomorrow) do - create(:structured_meeting, + create(:meeting, :author_participates, title: "meeting starting tomorrow", start_time: DateTime.parse("2025-01-30T10:00:00Z"), @@ -64,7 +64,7 @@ RSpec.describe "Meeting index", end shared_let(:saturday) do - create(:structured_meeting, + create(:meeting, :author_participates, title: "weekend meeting on saturday", start_time: DateTime.parse("2025-02-01T10:00:00Z"), @@ -73,7 +73,7 @@ RSpec.describe "Meeting index", end shared_let(:sunday) do - create(:structured_meeting, + create(:meeting, :author_participates, title: "weekend meeting on sunday", start_time: DateTime.parse("2025-02-02T10:00:00Z"), @@ -82,7 +82,7 @@ RSpec.describe "Meeting index", end shared_let(:next_monday) do - create(:structured_meeting, + create(:meeting, :author_participates, title: "meeting on next monday", start_time: DateTime.parse("2025-02-03T10:00:00Z"), @@ -91,7 +91,7 @@ RSpec.describe "Meeting index", end shared_let(:next_friday) do - create(:structured_meeting, + create(:meeting, :author_participates, title: "meeting on next friday", start_time: DateTime.parse("2025-02-07T10:00:00Z"), diff --git a/modules/meeting/spec/requests/meetings_spec.rb b/modules/meeting/spec/requests/meetings_spec.rb index 1fd3a5a4a15..f748a749818 100644 --- a/modules/meeting/spec/requests/meetings_spec.rb +++ b/modules/meeting/spec/requests/meetings_spec.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + #-- copyright # OpenProject is an open source project management software. # Copyright (C) the OpenProject GmbH @@ -34,7 +35,7 @@ RSpec.describe "Meeting requests", type: :rails_request do shared_let(:project) { create(:project, enabled_module_names: %i[meetings]) } shared_let(:user) { create(:user, member_with_permissions: { project => %i[view_meetings create_meetings edit_meetings] }) } - shared_let(:meeting) { create(:structured_meeting, project:, author: user) } + shared_let(:meeting) { create(:meeting, project:, author: user) } before do meeting.participants.delete_all @@ -51,55 +52,6 @@ RSpec.describe "Meeting requests", end end - describe "update with a new particpant" do - let(:other_user) { create(:user, member_with_permissions: { project => %i[view_meetings] }) } - let(:params) do - { - send_notifications:, - title: "Updated meeting", - meeting: { - participants_attributes: [ - { user_id: user.id, invited: true }, - { user_id: other_user.id, invited: true } - ] - } - - } - end - - subject do - meeting.reload - end - - context "with send_notifications" do - let(:send_notifications) { "1" } - - it "sends an invitation mail to the invited users" do - patch(project_meeting_path(project, meeting), params:) - - expect(subject.participants.count).to eq(2) - - perform_enqueued_jobs - - expect(ActionMailer::Base.deliveries.size).to eq(2) - end - end - - context "with send_notifications false" do - let(:send_notifications) { "0" } - - it "sends an invitation mail to the invited users" do - patch(project_meeting_path(project, meeting), params:) - - expect(subject.participants.count).to eq(2) - - perform_enqueued_jobs - - expect(ActionMailer::Base.deliveries.size).to eq(0) - end - end - end - describe "copy" do let(:base_params) do { @@ -107,7 +59,7 @@ RSpec.describe "Meeting requests", project_id: project.id, meeting: { title: "Copied meeting", - type: "StructuredMeeting" + type: "Meeting" } } end diff --git a/modules/meeting/spec/requests/recurring_meetings/recurring_meetings_end_series_spec.rb b/modules/meeting/spec/requests/recurring_meetings/recurring_meetings_end_series_spec.rb index 206f0d2afe5..cc0775a0233 100644 --- a/modules/meeting/spec/requests/recurring_meetings/recurring_meetings_end_series_spec.rb +++ b/modules/meeting/spec/requests/recurring_meetings/recurring_meetings_end_series_spec.rb @@ -62,7 +62,7 @@ RSpec.describe "Recurring meetings complete template", end context "when past occurrence is already created" do - let!(:meeting) { create(:structured_meeting, recurring_meeting:, start_time: recurring_meeting.start_time) } + let!(:meeting) { create(:meeting, recurring_meeting:, start_time: recurring_meeting.start_time) } let!(:schedule) do create :scheduled_meeting, meeting:, @@ -81,7 +81,7 @@ RSpec.describe "Recurring meetings complete template", end context "when start_time < current time" do - let!(:meeting) { create(:structured_meeting, recurring_meeting:, start_time: recurring_meeting.start_time) } + let!(:meeting) { create(:meeting, recurring_meeting:, start_time: recurring_meeting.start_time) } let!(:schedule) do create :scheduled_meeting, meeting:, diff --git a/modules/meeting/spec/requests/recurring_meetings/recurring_meetings_show_spec.rb b/modules/meeting/spec/requests/recurring_meetings/recurring_meetings_show_spec.rb index 10c351e0acb..6e7fc910753 100644 --- a/modules/meeting/spec/requests/recurring_meetings/recurring_meetings_show_spec.rb +++ b/modules/meeting/spec/requests/recurring_meetings/recurring_meetings_show_spec.rb @@ -94,7 +94,7 @@ RSpec.describe "Recurring meetings show", end describe "past quick filter" do - let!(:past_instance) { create(:structured_meeting, recurring_meeting:, start_time: 1.day.ago + 10.hours) } + let!(:past_instance) { create(:meeting, recurring_meeting:, start_time: 1.day.ago + 10.hours) } let!(:past_schedule) do create :scheduled_meeting, meeting: past_instance, @@ -131,7 +131,7 @@ RSpec.describe "Recurring meetings show", describe "upcoming tab" do let!(:upcoming_open_meeting) do - create(:structured_meeting, recurring_meeting:, start_time: Time.zone.today + 1.day + 10.hours, state: :open) + create(:meeting, recurring_meeting:, start_time: Time.zone.today + 1.day + 10.hours, state: :open) end let!(:open_meeting) do create :scheduled_meeting, @@ -179,7 +179,7 @@ RSpec.describe "Recurring meetings show", end let!(:ongoing_meeting) do - create(:structured_meeting, recurring_meeting:, start_time: Time.zone.today + 10.hours, state: :open) + create(:meeting, recurring_meeting:, start_time: Time.zone.today + 10.hours, state: :open) end let!(:ongoing_schedule) do create :scheduled_meeting, @@ -210,7 +210,7 @@ RSpec.describe "Recurring meetings show", describe "upcoming quick filter" do context "with a rescheduled meeting" do let!(:rescheduled_instance) do - create :structured_meeting, + create :meeting, recurring_meeting:, start_time: Time.zone.today + 2.days + 10.hours end @@ -242,7 +242,7 @@ RSpec.describe "Recurring meetings show", iterations: 2 end let!(:first_instance) do - create :structured_meeting, + create :meeting, recurring_meeting:, start_time: Time.zone.today + 2.days + 10.hours, state: :open @@ -254,7 +254,7 @@ RSpec.describe "Recurring meetings show", start_time: Time.zone.today + 2.days + 10.hours end let!(:second_instance) do - create :structured_meeting, + create :meeting, recurring_meeting:, start_time: Time.zone.today + 3.days + 10.hours, state: :open @@ -323,7 +323,7 @@ RSpec.describe "Recurring meetings show", iterations: 5 end let!(:ongoing_instance) do - create :structured_meeting, + create :meeting, recurring_meeting:, start_time: Time.zone.today + 10.hours - 10.minutes end diff --git a/modules/meeting/spec/requests/recurring_meetings/recurring_meetings_template_completed_spec.rb b/modules/meeting/spec/requests/recurring_meetings/recurring_meetings_template_completed_spec.rb index f01a2603d7a..2f3794e7ed5 100644 --- a/modules/meeting/spec/requests/recurring_meetings/recurring_meetings_template_completed_spec.rb +++ b/modules/meeting/spec/requests/recurring_meetings/recurring_meetings_template_completed_spec.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + #-- copyright # OpenProject is an open source project management software. # Copyright (C) the OpenProject GmbH @@ -81,7 +82,7 @@ RSpec.describe "Recurring meetings complete template", end context "when first occurrence is already created" do - let!(:meeting) { create(:structured_meeting, recurring_meeting:, start_time: recurring_meeting.start_time) } + let!(:meeting) { create(:meeting, recurring_meeting:, start_time: recurring_meeting.start_time) } let!(:schedule) do create :scheduled_meeting, meeting:, diff --git a/modules/meeting/spec/routing/previews_routing_spec.rb b/modules/meeting/spec/routing/previews_routing_spec.rb deleted file mode 100644 index 3c8fedad40e..00000000000 --- a/modules/meeting/spec/routing/previews_routing_spec.rb +++ /dev/null @@ -1,44 +0,0 @@ -# frozen_string_literal: true -#-- copyright -# OpenProject is an open source project management software. -# Copyright (C) the OpenProject GmbH -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License version 3. -# -# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: -# Copyright (C) 2006-2013 Jean-Philippe Lang -# Copyright (C) 2010-2013 the ChiliProject Team -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# See COPYRIGHT and LICENSE files for more details. -#++ - -require "spec_helper" - -RSpec.describe "preview" do - it "connects POST /meetings/:meeting_id/agenda/preview to meeting_agendas#preview" do - expect(post("/meetings/1/agenda/preview")).to route_to(controller: "meeting_agendas", - meeting_id: "1", - action: "preview") - end - - it "connects POST /meetings/:meeting_id/agenda/preview to meeting_minutes#preview" do - expect(post("/meetings/1/minutes/preview")).to route_to(controller: "meeting_minutes", - meeting_id: "1", - action: "preview") - end -end diff --git a/modules/meeting/spec/seeders/demo_data/meeting_agenda_items_seeder_spec.rb b/modules/meeting/spec/seeders/demo_data/meeting_agenda_items_seeder_spec.rb index 85d788aebda..b6f67607449 100644 --- a/modules/meeting/spec/seeders/demo_data/meeting_agenda_items_seeder_spec.rb +++ b/modules/meeting/spec/seeders/demo_data/meeting_agenda_items_seeder_spec.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + #-- copyright # OpenProject is an open source project management software. # Copyright (C) the OpenProject GmbH @@ -34,7 +35,7 @@ RSpec.describe Meetings::DemoData::MeetingAgendaItemsSeeder do shared_let(:alice) { create(:user, firstname: "Alice") } shared_let(:bob) { create(:user, firstname: "Bob") } - shared_let(:meeting) { create(:structured_meeting, title: "Weekly meeting") } + shared_let(:meeting) { create(:meeting, title: "Weekly meeting") } shared_let(:work_package) { create(:work_package, subject: "Some important task") } subject(:seeder) { described_class.new("_project", seed_data) } diff --git a/modules/meeting/spec/services/meeting_contents/update_service_spec.rb b/modules/meeting/spec/services/meeting_contents/update_service_spec.rb deleted file mode 100644 index 296e8a4a960..00000000000 --- a/modules/meeting/spec/services/meeting_contents/update_service_spec.rb +++ /dev/null @@ -1,37 +0,0 @@ -# frozen_string_literal: true -#-- copyright -# OpenProject is an open source project management software. -# Copyright (C) the OpenProject GmbH -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License version 3. -# -# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: -# Copyright (C) 2006-2013 Jean-Philippe Lang -# Copyright (C) 2010-2013 the ChiliProject Team -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# See COPYRIGHT and LICENSE files for more details. -#++ - -require "spec_helper" -require "services/base_services/behaves_like_update_service" - -RSpec.describe MeetingContents::UpdateService, type: :model do - it_behaves_like "BaseServices update service" do - let(:factory) { :meeting_agenda } - end -end diff --git a/modules/meeting/spec/services/meetings/copy_service_integration_spec.rb b/modules/meeting/spec/services/meetings/copy_service_integration_spec.rb index 00bddb71226..d71b3a9d7f5 100644 --- a/modules/meeting/spec/services/meetings/copy_service_integration_spec.rb +++ b/modules/meeting/spec/services/meetings/copy_service_integration_spec.rb @@ -35,7 +35,7 @@ RSpec.describe Meetings::CopyService, "integration", type: :model do shared_let(:user) do create(:user, member_with_permissions: { project => %i(view_meetings create_meetings) }) end - shared_let(:meeting) { create(:structured_meeting, project:, start_time: Time.parse("2013-03-27T15:35:00Z")) } + shared_let(:meeting) { create(:meeting, project:, start_time: Time.parse("2013-03-27T15:35:00Z")) } let(:instance) { described_class.new(model: meeting, user:) } let(:attributes) { {} } diff --git a/modules/meeting/spec/services/meetings/update_service_integration_spec.rb b/modules/meeting/spec/services/meetings/update_service_integration_spec.rb index 2197c9f486c..23d13048196 100644 --- a/modules/meeting/spec/services/meetings/update_service_integration_spec.rb +++ b/modules/meeting/spec/services/meetings/update_service_integration_spec.rb @@ -48,7 +48,7 @@ RSpec.describe Meetings::UpdateService, "integration", type: :model do context "when meeting is in a series and scheduled to the future" do shared_let(:recurring_meeting, refind: true) { create(:recurring_meeting, project:, frequency: "daily") } shared_let(:meeting, refind: true) do - create(:structured_meeting, + create(:meeting, recurring_meeting:, project:, start_time: Time.zone.today + 2.days + 10.hours) @@ -140,7 +140,7 @@ RSpec.describe Meetings::UpdateService, "integration", type: :model do context "when previous schedule exists tomorrow at 10:00" do shared_let(:previous_meeting) do - create(:structured_meeting, recurring_meeting:, project:, start_time: Time.zone.tomorrow + 10.hours) + create(:meeting, recurring_meeting:, project:, start_time: Time.zone.tomorrow + 10.hours) end shared_let(:previous_schedule) do create(:scheduled_meeting, diff --git a/modules/meeting/spec/services/recurring_meetings/create_service_integration_spec.rb b/modules/meeting/spec/services/recurring_meetings/create_service_integration_spec.rb index 714c8aea39a..d9707c8db01 100644 --- a/modules/meeting/spec/services/recurring_meetings/create_service_integration_spec.rb +++ b/modules/meeting/spec/services/recurring_meetings/create_service_integration_spec.rb @@ -47,7 +47,7 @@ RSpec.describe RecurringMeetings::CreateService, "integration", type: :model do expect(service_result).to be_success expect(series).to be_persisted - expect(series.template).to be_a(StructuredMeeting) + expect(series.template).to be_a(Meeting) expect(series.template).to be_template expect(series.meetings.count).to eq(1) @@ -84,10 +84,10 @@ RSpec.describe RecurringMeetings::CreateService, "integration", type: :model do it_behaves_like "creates the series" context "when the template cannot be saved" do - let(:template) { StructuredMeeting.new } + let(:template) { Meeting.new } before do - allow(StructuredMeeting).to receive(:new).and_return(template) + allow(Meeting).to receive(:new).and_return(template) allow(template).to receive(:save).and_return(false) end diff --git a/modules/meeting/spec/support/pages/structured_meeting/history.rb b/modules/meeting/spec/support/pages/meetings/history.rb similarity index 98% rename from modules/meeting/spec/support/pages/structured_meeting/history.rb rename to modules/meeting/spec/support/pages/meetings/history.rb index c47ceff18c6..01aafdb3d27 100644 --- a/modules/meeting/spec/support/pages/structured_meeting/history.rb +++ b/modules/meeting/spec/support/pages/meetings/history.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + #-- copyright # OpenProject is an open source project management software. # Copyright (C) the OpenProject GmbH @@ -27,7 +28,7 @@ # See COPYRIGHT and LICENSE files for more details. #++ -module Pages::StructuredMeeting +module Pages::Meeting class History < ::Pages::Page def initialize(meeting) super() diff --git a/modules/meeting/spec/support/pages/meetings/index.rb b/modules/meeting/spec/support/pages/meetings/index.rb index ecd4830e110..e737a97258c 100644 --- a/modules/meeting/spec/support/pages/meetings/index.rb +++ b/modules/meeting/spec/support/pages/meetings/index.rb @@ -28,8 +28,6 @@ # See COPYRIGHT and LICENSE files for more details. #++ -require_relative "new" - module Pages::Meetings class Index < Pages::Page include Components::Common::Filters @@ -43,13 +41,6 @@ module Pages::Meetings self.project = project end - def click_create_new - click_on("add-meeting-button") - click_on("Classic") - - New.new(project) - end - def set_title(text) fill_in "Title", with: text end @@ -88,16 +79,7 @@ module Pages::Meetings def click_create click_on "Create meeting" - wait_for_network_idle - - meeting = Meeting.last - - if meeting - Pages::Meetings::Show.new(meeting) - else - self - end end def expect_no_main_menu @@ -115,7 +97,7 @@ module Pages::Meetings def expect_create_new_types click_on("add-meeting-button") - expect(page).to have_link("Classic") + expect(page).to have_link("Recurring") expect(page).to have_link("One-time") end diff --git a/modules/meeting/spec/support/pages/structured_meeting/mobile/show.rb b/modules/meeting/spec/support/pages/meetings/mobile/show.rb similarity index 95% rename from modules/meeting/spec/support/pages/structured_meeting/mobile/show.rb rename to modules/meeting/spec/support/pages/meetings/mobile/show.rb index a149a2d0a1a..0b81b0f9323 100644 --- a/modules/meeting/spec/support/pages/structured_meeting/mobile/show.rb +++ b/modules/meeting/spec/support/pages/meetings/mobile/show.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + #-- copyright # OpenProject is an open source project management software. # Copyright (C) the OpenProject GmbH @@ -29,8 +30,8 @@ require_relative "../show" -module Pages::StructuredMeeting::Mobile - class Show < ::Pages::StructuredMeeting::Show +module Pages::Meetings::Mobile + class Show < ::Pages::Meetings::Show def expect_participants(count: 1) within(meeting_details_container) do expect(page).to have_text(Meeting.human_attribute_name(:participant, count:)) diff --git a/modules/meeting/spec/support/pages/meetings/new.rb b/modules/meeting/spec/support/pages/meetings/new.rb deleted file mode 100644 index fed8cb47804..00000000000 --- a/modules/meeting/spec/support/pages/meetings/new.rb +++ /dev/null @@ -1,98 +0,0 @@ -# frozen_string_literal: true -#-- copyright -# OpenProject is an open source project management software. -# Copyright (C) the OpenProject GmbH -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License version 3. -# -# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: -# Copyright (C) 2006-2013 Jean-Philippe Lang -# Copyright (C) 2010-2013 the ChiliProject Team -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# See COPYRIGHT and LICENSE files for more details. -#++ - -require_relative "base" -require_relative "show" - -module Pages::Meetings - class New < Base - include Components::Autocompleter::NgSelectAutocompleteHelpers - - def expect_no_main_menu - expect(page).to have_no_css "#main-menu" - end - - def click_create - click_on "Create" - - wait_for_network_idle - - meeting = Meeting.last - - if meeting - Pages::Meetings::Show.new(meeting) - else - self - end - end - - def set_type(type) - choose type, match: :first - end - - def set_title(text) - fill_in "Title", with: text - end - - def expect_project_dropdown - find "[data-test-selector='project_id']" - end - - def set_project(project) - select_autocomplete find("[data-test-selector='project_id']"), - query: project.name, - results_selector: "body" - end - - def set_start_date(date) - if using_cuprite? - fill_in "Start date", with: date - else - fill_in "Start date", with: date, fill_options: { clear: :backspace } - end - end - - def set_start_time(time) - input = page.find_by_id("meeting-form-start-time") - page.execute_script("arguments[0].value = arguments[1]", input.native, time) - end - - def set_duration(duration) - fill_in "Duration", with: duration - end - - def invite(user) - check "#{user.name} invited" - end - - def path - polymorphic_path([:new, project, :meeting]) - end - end -end diff --git a/modules/meeting/spec/support/pages/meetings/show.rb b/modules/meeting/spec/support/pages/meetings/show.rb index 1c50f32f3a8..3e0239e2ac5 100644 --- a/modules/meeting/spec/support/pages/meetings/show.rb +++ b/modules/meeting/spec/support/pages/meetings/show.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + #-- copyright # OpenProject is an open source project management software. # Copyright (C) the OpenProject GmbH @@ -31,10 +32,13 @@ require_relative "base" module Pages::Meetings class Show < Base + include ::Components::Autocompleter::NgSelectAutocompleteHelpers attr_accessor :meeting def initialize(meeting) self.meeting = meeting + + super(meeting.project) end def expect_no_invited @@ -83,18 +87,359 @@ module Pages::Meetings end end - def meeting_details_container - find(".meeting.details") - end - - def click_edit - within ".meeting--main-toolbar .toolbar-items" do - click_on "Edit" - end - end - def path project_meeting_path(meeting.project, meeting) end + + def expect_empty + expect(page).to have_no_css('[id^="meeting-agenda-items-item-component"]') + end + + def trigger_dropdown_menu_item(name) + click_link_or_button "op-meetings-header-action-trigger" + click_link_or_button name + end + + def trigger_change_poll + script = <<~JS + var target = document.querySelector('#content-wrapper'); + var controller = window.Stimulus.getControllerForElementAndIdentifier(target, 'poll-for-changes') + controller.triggerTurboStream(); + JS + + page.execute_script(script) + end + + def add_agenda_item(type: MeetingAgendaItem, save: true, &) + page.within("#meeting-agenda-items-new-button-component") do + click_on I18n.t(:button_add) + click_on type.model_name.human + end + + in_agenda_form do + yield + click_on("Save") if save + end + end + + def expect_modal(...) + expect(page).to have_modal(...) + end + + def expect_no_add_form + expect(page).not_to have_test_selector("#meeting-agenda-items-form-component") + end + + def add_agenda_item_to_section(section:, type: MeetingAgendaItem, save: true, &) + select_section_action(section, type.model_name.human) + + within("#meeting-sections-show-component-#{section.id}") do + in_agenda_form do + yield + click_on("Save") if save + end + end + end + + def cancel_edit_form(item) + in_edit_form(item) do + click_on I18n.t(:button_cancel) + expect(page).to have_no_link I18n.t(:button_cancel) + end + end + + def in_edit_form(item, &) + page.within("#meeting-agenda-items-item-component-#{item.id}", &) + end + + def in_agenda_form(&) + page.within("#meeting-agenda-items-form-component", &) + end + + def assert_agenda_order!(*titles) + retry_block do + found = page.all(:test_id, "op-meeting-agenda-title").map(&:text) + raise "Expected order of agenda items #{titles.inspect}, but found #{found.inspect}" if titles != found + end + end + + def remove_agenda_item(item) + accept_confirm(I18n.t("text_are_you_sure")) do + action = item.work_package ? I18n.t(:label_agenda_item_remove) : I18n.t(:button_delete) + select_action(item, action) + end + + title = item.work_package ? item.work_package.subject : item.title + expect_no_agenda_item(title:) + end + + def expect_agenda_item(title:) + expect(page).to have_test_selector("op-meeting-agenda-title", text: title) + end + + def expect_agenda_item_in_section(title:, section:) + within("#meeting-sections-show-component-#{section.id}") do + expect_agenda_item(title:) + end + end + + def expect_agenda_link(item) + if item.is_a?(WorkPackage) + expect(page).to have_css("[id^='meeting-agenda-items-item-component-']", text: item.subject) + else + expect(page).to have_css("#meeting-agenda-items-item-component-#{item.id}", text: item.work_package.subject) + end + end + + def expect_agenda_author(name) + expect(page).to have_test_selector("op-principal", text: name) + end + + def expect_undisclosed_agenda_link(item) + expect(page).to have_css("#meeting-agenda-items-item-component-#{item.id}", + text: I18n.t(:label_agenda_item_undisclosed_wp, id: item.work_package_id)) + end + + def expect_no_agenda_item(title:) + expect(page).not_to have_test_selector("op-meeting-agenda-title", text: title) + end + + def expect_agenda_action_menu(item) + expect(page) + .to have_css("#meeting-agenda-items-item-component-#{item.id} #{test_selector('op-meeting-agenda-actions')}") + end + + def expect_no_agenda_action_menu(item) + expect(page) + .to have_no_css("#meeting-agenda-items-item-component-#{item.id} #{test_selector('op-meeting-agenda-actions')}") + end + + def select_action(item, action) + open_menu(item) do + click_on action + end + end + + def open_menu(item, &) + retry_block do + page.within("#meeting-agenda-items-item-component-#{item.id}") do + page.find_test_selector("op-meeting-agenda-actions").click + end + page.find(".Overlay") + end + + page.within(".Overlay", &) + end + + def select_outcome_action(action) + retry_block do + page.find_test_selector("op-meeting-outcome-actions").click + page.find(".Overlay") + end + + page.within(".Overlay") do + click_on action + end + end + + def expect_no_outcome_actions + expect(page).to have_no_css("op-meeting-outcome-actions") + end + + def expect_no_outcome_action(item) + retry_block do + page.within("#meeting-agenda-items-item-component-#{item.id}") do + page.find_test_selector("op-meeting-agenda-actions").trigger("click") + end + page.find(".Overlay") + end + + page.within(".Overlay") do + expect(page).to have_no_text("Add outcome") + end + end + + def select_section_action(section, action) + retry_block do + click_on_section_menu(section) + page.find(".Overlay") + end + + page.within(".Overlay") do + click_on action + end + end + + def click_on_section_menu(section) + page.within_test_selector("meeting-section-header-container-#{section.id}") do + page.find_test_selector("meeting-section-action-menu").click + end + end + + def in_outcome_component(item, &) + page.within("#meeting-agenda-items-outcomes-base-component-#{item.id}", &) + end + + def add_outcome(item, &) + page.within("#meeting-agenda-items-outcomes-base-component-#{item.id}") do + click_link_or_button "Outcome" + end + expect_outcome_form(item) + page.within("#meeting-agenda-items-outcomes-input-component-#{item.id}", &) + end + + def add_outcome_from_menu(item, &) + select_action item, "Add outcome" + expect_outcome_form(item) + page.within("#meeting-agenda-items-outcomes-input-component-#{item.id}", &) + end + + def expect_outcome_form(item) + expect(page) + .to have_css("#meeting-agenda-items-outcomes-input-component-#{item.id}") + end + + def expect_outcome(text) + expect(page).to have_css("#meeting-agenda-items-outcomes-show-notes-component", text:) + end + + def expect_no_outcome(text) + expect(page).to have_no_css("#meeting-agenda-items-outcomes-show-notes-component", text:) + end + + def expect_no_outcome_button + expect(page).to have_no_css("op-meeting-outcome--button") + end + + def edit_agenda_item(item, &) + select_action item, "Edit" + expect_item_edit_form(item) + page.within("#meeting-agenda-items-form-component-#{item.id}", &) + end + + def expect_item_edit_form(item, visible: true) + expect(page) + .to have_conditional_selector( + visible, + "#meeting-agenda-items-form-component-#{item.id}" + ) + end + + def expect_item_edit_title(item, value) + page.within("#meeting-agenda-items-form-component-#{item.id}") do + find_field("Title", with: value) + end + end + + def expect_item_edit_field_error(item, text) + page.within("#meeting-agenda-items-form-component-#{item.id}") do + expect(page).to have_css(".FormControl-inlineValidation", text:) + end + end + + def clear_item_edit_work_package_title + ng_select_clear page.find(".op-meeting-agenda-item-form--title") + expect(page).to have_css(".ng-input ", value: nil) + end + + def open_participant_form + page.find_test_selector("manage-participants-button").click + expect_modal("Participants") + end + + def in_participant_form(&) + page.within_modal("Participants", &) + end + + def expect_participant(participant, invited: false, attended: false, editable: true) + expect(page).to have_text(participant.name) + expect(page).to have_field(id: "checkbox_invited_#{participant.id}", checked: invited, disabled: !editable) + expect(page).to have_field(id: "checkbox_attended_#{participant.id}", checked: attended, disabled: !editable) + end + + def expect_participant_invited(participant, invited: true) + expect(page).to have_text(participant.name) + expect(page).to have_field(id: "checkbox_invited_#{participant.id}", checked: invited) + end + + def invite_participant(participant) + id = "checkbox_invited_#{participant.id}" + retry_block do + check(id:) + raise "Expected #{participant.id} to be invited now" unless page.has_checked_field?(id:) + end + end + + def expect_available_participants(count:) + expect(page).to have_link(class: "op-principal--name", count:) + end + + def close_meeting + retry_block do + click_on("Open") + page.find(".Overlay") + end + + page.within(".Overlay") do + click_on("Closed") + end + expect(page).to have_link("Reopen meeting") + end + + def reopen_meeting + click_on("Reopen meeting") + expect(page).to have_link("Start meeting") + end + + def close_dialog + click_on(class: "Overlay-closeButton") + end + + def meeting_details_container + find_by_id("meetings-side-panel-details-component") + end + + def in_latest_section_form(&) + page.within(all(".op-meeting-section-container").last, &) + end + + def add_section(&) + retry_block do + page.within("#meeting-agenda-items-new-button-component") do + click_on I18n.t(:button_add) + click_on "Section" + # wait for the disabled button, indicating the turbo streams are applied + expect(page).to have_css("#meeting-agenda-items-new-button-component button[disabled='disabled']") + end + end + + in_latest_section_form(&) + end + + def expect_section(title:) + expect(page).to have_css(".op-meeting-section-container", text: title) + end + + def expect_no_section(title:) + expect(page).to have_no_css(".op-meeting-section-container", text: title) + end + + def expect_section_duration(section:, duration_text:) + page.within_test_selector("meeting-section-header-container-#{section.id}") do + expect(page).to have_text(duration_text) + end + end + + def edit_section(section, &) + select_section_action(section, "Edit") + + page.within_test_selector("meeting-section-header-container-#{section.id}", &) + end + + def remove_section(section) + accept_confirm do + select_section_action(section, "Delete") + end + end end end diff --git a/modules/meeting/spec/support/pages/structured_meeting/show.rb b/modules/meeting/spec/support/pages/structured_meeting/show.rb deleted file mode 100644 index dbbbe0ef758..00000000000 --- a/modules/meeting/spec/support/pages/structured_meeting/show.rb +++ /dev/null @@ -1,388 +0,0 @@ -# frozen_string_literal: true - -#-- copyright -# OpenProject is an open source project management software. -# Copyright (C) the OpenProject GmbH -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License version 3. -# -# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: -# Copyright (C) 2006-2013 Jean-Philippe Lang -# Copyright (C) 2010-2013 the ChiliProject Team -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# See COPYRIGHT and LICENSE files for more details. -#++ - -require_relative "../meetings/show" - -module Pages::StructuredMeeting - class Show < ::Pages::Meetings::Show - include ::Components::Autocompleter::NgSelectAutocompleteHelpers - - def expect_empty - expect(page).to have_no_css('[id^="meeting-agenda-items-item-component"]') - end - - def trigger_dropdown_menu_item(name) - click_link_or_button "op-meetings-header-action-trigger" - click_link_or_button name - end - - def trigger_change_poll - script = <<~JS - var target = document.querySelector('#content-wrapper'); - var controller = window.Stimulus.getControllerForElementAndIdentifier(target, 'poll-for-changes') - controller.triggerTurboStream(); - JS - - page.execute_script(script) - end - - def add_agenda_item(type: MeetingAgendaItem, save: true, &) - page.within("#meeting-agenda-items-new-button-component") do - click_on I18n.t(:button_add) - click_on type.model_name.human - end - - in_agenda_form do - yield - click_on("Save") if save - end - end - - def expect_modal(...) - expect(page).to have_modal(...) - end - - def expect_no_add_form - expect(page).not_to have_test_selector("#meeting-agenda-items-form-component") - end - - def add_agenda_item_to_section(section:, type: MeetingAgendaItem, save: true, &) - select_section_action(section, type.model_name.human) - - within("#meeting-sections-show-component-#{section.id}") do - in_agenda_form do - yield - click_on("Save") if save - end - end - end - - def cancel_edit_form(item) - in_edit_form(item) do - click_on I18n.t(:button_cancel) - expect(page).to have_no_link I18n.t(:button_cancel) - end - end - - def in_edit_form(item, &) - page.within("#meeting-agenda-items-item-component-#{item.id}", &) - end - - def in_agenda_form(&) - page.within("#meeting-agenda-items-form-component", &) - end - - def assert_agenda_order!(*titles) - retry_block do - found = page.all(:test_id, "op-meeting-agenda-title").map(&:text) - raise "Expected order of agenda items #{titles.inspect}, but found #{found.inspect}" if titles != found - end - end - - def remove_agenda_item(item) - accept_confirm(I18n.t("text_are_you_sure")) do - action = item.work_package ? I18n.t(:label_agenda_item_remove) : I18n.t(:button_delete) - select_action(item, action) - end - - title = item.work_package ? item.work_package.subject : item.title - expect_no_agenda_item(title:) - end - - def expect_agenda_item(title:) - expect(page).to have_test_selector("op-meeting-agenda-title", text: title) - end - - def expect_agenda_item_in_section(title:, section:) - within("#meeting-sections-show-component-#{section.id}") do - expect_agenda_item(title:) - end - end - - def expect_agenda_link(item) - if item.is_a?(WorkPackage) - expect(page).to have_css("[id^='meeting-agenda-items-item-component-']", text: item.subject) - else - expect(page).to have_css("#meeting-agenda-items-item-component-#{item.id}", text: item.work_package.subject) - end - end - - def expect_agenda_author(name) - expect(page).to have_test_selector("op-principal", text: name) - end - - def expect_undisclosed_agenda_link(item) - expect(page).to have_css("#meeting-agenda-items-item-component-#{item.id}", - text: I18n.t(:label_agenda_item_undisclosed_wp, id: item.work_package_id)) - end - - def expect_no_agenda_item(title:) - expect(page).not_to have_test_selector("op-meeting-agenda-title", text: title) - end - - def expect_agenda_action_menu(item) - expect(page) - .to have_css("#meeting-agenda-items-item-component-#{item.id} #{test_selector('op-meeting-agenda-actions')}") - end - - def expect_no_agenda_action_menu(item) - expect(page) - .to have_no_css("#meeting-agenda-items-item-component-#{item.id} #{test_selector('op-meeting-agenda-actions')}") - end - - def select_action(item, action) - open_menu(item) do - click_on action - end - end - - def open_menu(item, &) - retry_block do - page.within("#meeting-agenda-items-item-component-#{item.id}") do - page.find_test_selector("op-meeting-agenda-actions").click - end - page.find(".Overlay") - end - - page.within(".Overlay", &) - end - - def select_outcome_action(action) - retry_block do - page.find_test_selector("op-meeting-outcome-actions").click - page.find(".Overlay") - end - - page.within(".Overlay") do - click_on action - end - end - - def expect_no_outcome_actions - expect(page).to have_no_css("op-meeting-outcome-actions") - end - - def expect_no_outcome_action(item) - retry_block do - page.within("#meeting-agenda-items-item-component-#{item.id}") do - page.find_test_selector("op-meeting-agenda-actions").trigger("click") - end - page.find(".Overlay") - end - - page.within(".Overlay") do - expect(page).to have_no_text("Add outcome") - end - end - - def select_section_action(section, action) - retry_block do - click_on_section_menu(section) - page.find(".Overlay") - end - - page.within(".Overlay") do - click_on action - end - end - - def click_on_section_menu(section) - page.within_test_selector("meeting-section-header-container-#{section.id}") do - page.find_test_selector("meeting-section-action-menu").click - end - end - - def in_outcome_component(item, &) - page.within("#meeting-agenda-items-outcomes-base-component-#{item.id}", &) - end - - def add_outcome(item, &) - page.within("#meeting-agenda-items-outcomes-base-component-#{item.id}") do - click_link_or_button "Outcome" - end - expect_outcome_form(item) - page.within("#meeting-agenda-items-outcomes-input-component-#{item.id}", &) - end - - def add_outcome_from_menu(item, &) - select_action item, "Add outcome" - expect_outcome_form(item) - page.within("#meeting-agenda-items-outcomes-input-component-#{item.id}", &) - end - - def expect_outcome_form(item) - expect(page) - .to have_css("#meeting-agenda-items-outcomes-input-component-#{item.id}") - end - - def expect_outcome(text) - expect(page).to have_css("#meeting-agenda-items-outcomes-show-notes-component", text:) - end - - def expect_no_outcome(text) - expect(page).to have_no_css("#meeting-agenda-items-outcomes-show-notes-component", text:) - end - - def expect_no_outcome_button - expect(page).to have_no_css("op-meeting-outcome--button") - end - - def edit_agenda_item(item, &) - select_action item, "Edit" - expect_item_edit_form(item) - page.within("#meeting-agenda-items-form-component-#{item.id}", &) - end - - def expect_item_edit_form(item, visible: true) - expect(page) - .to have_conditional_selector( - visible, - "#meeting-agenda-items-form-component-#{item.id}" - ) - end - - def expect_item_edit_title(item, value) - page.within("#meeting-agenda-items-form-component-#{item.id}") do - find_field("Title", with: value) - end - end - - def expect_item_edit_field_error(item, text) - page.within("#meeting-agenda-items-form-component-#{item.id}") do - expect(page).to have_css(".FormControl-inlineValidation", text:) - end - end - - def clear_item_edit_work_package_title - ng_select_clear page.find(".op-meeting-agenda-item-form--title") - expect(page).to have_css(".ng-input ", value: nil) - end - - def open_participant_form - page.find_test_selector("manage-participants-button").click - expect_modal("Participants") - end - - def in_participant_form(&) - page.within_modal("Participants", &) - end - - def expect_participant(participant, invited: false, attended: false, editable: true) - expect(page).to have_text(participant.name) - expect(page).to have_field(id: "checkbox_invited_#{participant.id}", checked: invited, disabled: !editable) - expect(page).to have_field(id: "checkbox_attended_#{participant.id}", checked: attended, disabled: !editable) - end - - def expect_participant_invited(participant, invited: true) - expect(page).to have_text(participant.name) - expect(page).to have_field(id: "checkbox_invited_#{participant.id}", checked: invited) - end - - def invite_participant(participant) - id = "checkbox_invited_#{participant.id}" - retry_block do - check(id:) - raise "Expected #{participant.id} to be invited now" unless page.has_checked_field?(id:) - end - end - - def expect_available_participants(count:) - expect(page).to have_link(class: "op-principal--name", count:) - end - - def close_meeting - retry_block do - click_on("Open") - page.find(".Overlay") - end - - page.within(".Overlay") do - click_on("Closed") - end - expect(page).to have_link("Reopen meeting") - end - - def reopen_meeting - click_on("Reopen meeting") - expect(page).to have_link("Start meeting") - end - - def close_dialog - click_on(class: "Overlay-closeButton") - end - - def meeting_details_container - find_by_id("meetings-side-panel-details-component") - end - - def in_latest_section_form(&) - page.within(all(".op-meeting-section-container").last, &) - end - - def add_section(&) - retry_block do - page.within("#meeting-agenda-items-new-button-component") do - click_on I18n.t(:button_add) - click_on "Section" - # wait for the disabled button, indicating the turbo streams are applied - expect(page).to have_css("#meeting-agenda-items-new-button-component button[disabled='disabled']") - end - end - - in_latest_section_form(&) - end - - def expect_section(title:) - expect(page).to have_css(".op-meeting-section-container", text: title) - end - - def expect_no_section(title:) - expect(page).to have_no_css(".op-meeting-section-container", text: title) - end - - def expect_section_duration(section:, duration_text:) - page.within_test_selector("meeting-section-header-container-#{section.id}") do - expect(page).to have_text(duration_text) - end - end - - def edit_section(section, &) - select_section_action(section, "Edit") - - page.within_test_selector("meeting-section-header-container-#{section.id}", &) - end - - def remove_section(section) - accept_confirm do - select_section_action(section, "Delete") - end - end - end -end diff --git a/modules/meeting/spec/workers/recurring_meetings/init_next_occurrence_job_spec.rb b/modules/meeting/spec/workers/recurring_meetings/init_next_occurrence_job_spec.rb index 698b77c1668..59a08813cae 100644 --- a/modules/meeting/spec/workers/recurring_meetings/init_next_occurrence_job_spec.rb +++ b/modules/meeting/spec/workers/recurring_meetings/init_next_occurrence_job_spec.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + #-- copyright # OpenProject is an open source project management software. # Copyright (C) the OpenProject GmbH @@ -46,7 +47,7 @@ RSpec.describe RecurringMeetings::InitNextOccurrenceJob, type: :model do subject { described_class.perform_now(series, scheduled_time) } it "schedules the first occurrence" do - expect { subject }.to change(StructuredMeeting, :count).by(1) + expect { subject }.to change(Meeting, :count).by(1) expect(subject).to be_success created_meeting = subject.result @@ -62,7 +63,7 @@ RSpec.describe RecurringMeetings::InitNextOccurrenceJob, type: :model do end it "does not instantiate anything, but schedules the next job" do - expect { subject }.not_to change(StructuredMeeting, :count) + expect { subject }.not_to change(Meeting, :count) expect(subject).to be_nil expect(described_class) @@ -73,7 +74,7 @@ RSpec.describe RecurringMeetings::InitNextOccurrenceJob, type: :model do context "when next occurrence is already instantiated" do let!(:instance) do - create(:structured_meeting, + create(:meeting, recurring_meeting: series, start_time: Time.zone.tomorrow + 10.hours) end @@ -88,7 +89,7 @@ RSpec.describe RecurringMeetings::InitNextOccurrenceJob, type: :model do let(:next_occurrence) { Time.zone.tomorrow + 1.day + 10.hours } it "does not instantiate anything, but schedules the next job" do - expect { subject }.not_to change(StructuredMeeting, :count) + expect { subject }.not_to change(Meeting, :count) expect(subject).to be_nil expect(described_class) @@ -99,7 +100,7 @@ RSpec.describe RecurringMeetings::InitNextOccurrenceJob, type: :model do context "when next occurrence is already instantiated, and moved" do let!(:instance) do - create(:structured_meeting, + create(:meeting, recurring_meeting: series, start_time: Time.zone.tomorrow + 1.day + 10.hours) end @@ -114,7 +115,7 @@ RSpec.describe RecurringMeetings::InitNextOccurrenceJob, type: :model do let(:next_occurrence) { Time.zone.tomorrow + 1.day + 10.hours } it "does not instantiate anything, but schedules the next one" do - expect { subject }.not_to change(StructuredMeeting, :count) + expect { subject }.not_to change(Meeting, :count) expect(subject).to be_nil expect(described_class) .to have_been_enqueued.with(series, next_occurrence) @@ -124,7 +125,7 @@ RSpec.describe RecurringMeetings::InitNextOccurrenceJob, type: :model do context "when later occurrence is already instantiated" do let!(:instance) do - create(:structured_meeting, + create(:meeting, recurring_meeting: series, start_time: Time.zone.tomorrow + 1.day + 10.hours) end @@ -139,7 +140,7 @@ RSpec.describe RecurringMeetings::InitNextOccurrenceJob, type: :model do let(:next_occurrence) { Time.zone.tomorrow + 1.day + 10.hours } it "schedules the one for tomorrow" do - expect { subject }.to change(StructuredMeeting, :count).by(1) + expect { subject }.to change(Meeting, :count).by(1) expect(subject).to be_success created_meeting = subject.result diff --git a/spec/lib/api/v3/activities/activity_eager_loading_wrapper_spec.rb b/spec/lib/api/v3/activities/activity_eager_loading_wrapper_spec.rb index c8d21fde89e..0b35102cb5b 100644 --- a/spec/lib/api/v3/activities/activity_eager_loading_wrapper_spec.rb +++ b/spec/lib/api/v3/activities/activity_eager_loading_wrapper_spec.rb @@ -70,16 +70,6 @@ RSpec.describe API::V3::Activities::ActivityEagerLoadingWrapper, with_settings: expect(meeting.journals).to be_wrappable end - it "can wrap MeetingAgenda journals" do - meeting_agenda = create(:meeting_agenda, meeting:) - expect(meeting_agenda.journals).to be_wrappable - end - - it "can wrap MeetingMinutes journals" do - meeting_minutes = create(:meeting_minutes, meeting:) - expect(meeting_minutes.journals).to be_wrappable - end - it "can wrap Budget journals" do budget = create(:budget, project:, author: user) expect(budget.journals).to be_wrappable diff --git a/spec/seeders/root_seeder_standard_edition_spec.rb b/spec/seeders/root_seeder_standard_edition_spec.rb index efdf57f0bce..8eec7722960 100644 --- a/spec/seeders/root_seeder_standard_edition_spec.rb +++ b/spec/seeders/root_seeder_standard_edition_spec.rb @@ -92,16 +92,18 @@ RSpec.describe RootSeeder, expect(RecurringMeeting.count).to eq 1 # The template is created. - expect(StructuredMeeting.where(template: true).count).to eq 1 - expect(StructuredMeeting.where(template: true).first.duration).to eq 1.0 - expect(StructuredMeeting.where(template: true).first.agenda_items.count).to eq 9 - expect(StructuredMeeting.where(template: true).first.agenda_items.sum(:duration_in_minutes)).to eq 60 + expect(Meeting.templated.count).to eq 1 + template = Meeting.templated.first + expect(template.duration).to eq 1.0 + expect(template.agenda_items.count).to eq 9 + expect(template.agenda_items.sum(:duration_in_minutes)).to eq 60 # The first instance from that template is also created with the same data. - expect(StructuredMeeting.where(template: false).count).to eq 1 - expect(StructuredMeeting.where(template: false).first.duration).to eq 1.0 - expect(StructuredMeeting.where(template: false).first.agenda_items.count).to eq 9 - expect(StructuredMeeting.where(template: false).first.agenda_items.sum(:duration_in_minutes)).to eq 60 + expect(Meeting.where(template: false).count).to eq 1 + instance = Meeting.not_templated.first + expect(instance.duration).to eq 1.0 + expect(instance.agenda_items.count).to eq 9 + expect(instance.agenda_items.sum(:duration_in_minutes)).to eq 60 end it "creates different types of queries" do diff --git a/spec/services/principals/replace_references_service_call_integration_spec.rb b/spec/services/principals/replace_references_service_call_integration_spec.rb index 5daffad06e5..612e667b35b 100644 --- a/spec/services/principals/replace_references_service_call_integration_spec.rb +++ b/spec/services/principals/replace_references_service_call_integration_spec.rb @@ -195,28 +195,6 @@ RSpec.describe Principals::ReplaceReferencesService, "#call", type: :model do end end - context "with MeetingContent" do - it_behaves_like "rewritten record", - :meeting_agenda, - :author_id do - let(:attributes) do - { type: "'MeetingAgenda'" } - end - end - - it_behaves_like "rewritten record", - :meeting_minutes, - :author_id do - let(:attributes) do - { type: "'MeetingMinutes'" } - end - end - - it_behaves_like "rewritten record", - :journal_meeting_content_journal, - :author_id - end - context "with MeetingParticipant" do it_behaves_like "rewritten record", :meeting_participant, diff --git a/spec/services/users/replace_mentions_service_integration_spec.rb b/spec/services/users/replace_mentions_service_integration_spec.rb index 6256fb25a41..83a5c2e538a 100644 --- a/spec/services/users/replace_mentions_service_integration_spec.rb +++ b/spec/services/users/replace_mentions_service_integration_spec.rb @@ -404,14 +404,6 @@ RSpec.describe Users::ReplaceMentionsService, "integration" do it_behaves_like "rewritten mention", :document, :description end - context "for meeting_contents text" do - it_behaves_like "rewritten mention", :meeting_agenda, :text - end - - context "for meeting_content_journals text" do - it_behaves_like "rewritten mention", :journal_meeting_content_journal, :text - end - context "for messages content" do it_behaves_like "rewritten mention", :message, :content end