Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

[#53660] Show meeting state in meeting history (#15190)

Mir Bhatiaecba6b467ac7
diff --git a/app/models/journal.rb b/app/models/journal.rb
index e69b828c234..5fc0a467435 100644
--- a/app/models/journal.rb
+++ b/app/models/journal.rb
@@ -58,6 +58,7 @@ class Journal < ApplicationRecord
register_journal_formatter :agenda_item_diff, OpenProject::JournalFormatter::AgendaItemDiff
register_journal_formatter :agenda_item_title, OpenProject::JournalFormatter::AgendaItemTitle
register_journal_formatter :meeting_work_package_id, OpenProject::JournalFormatter::MeetingWorkPackageId
+ register_journal_formatter :meeting_state, OpenProject::JournalFormatter::MeetingState
register_journal_formatter :agenda_item_diff, OpenProject::JournalFormatter::AgendaItemDiff
register_journal_formatter :agenda_item_title, OpenProject::JournalFormatter::AgendaItemTitle
diff --git a/modules/meeting/app/models/meeting/journalized.rb b/modules/meeting/app/models/meeting/journalized.rb
index 4086a4d6dd7..72d54d847ac 100644
--- a/modules/meeting/app/models/meeting/journalized.rb
+++ b/modules/meeting/app/models/meeting/journalized.rb
@@ -46,6 +46,7 @@ module Meeting::Journalized
register_journal_formatted_fields(:datetime, "start_date")
register_journal_formatted_fields(:meeting_start_time, "start_time")
register_journal_formatted_fields(:plaintext, "location")
+ register_journal_formatted_fields(:meeting_state, "state")
register_journal_formatted_fields(:agenda_item_duration, "duration")
register_journal_formatted_fields(:agenda_item_diff, /agenda_items_\d+_notes/)
diff --git a/modules/meeting/config/locales/en.yml b/modules/meeting/config/locales/en.yml
index da641b277dd..391b21d11d3 100644
--- a/modules/meeting/config/locales/en.yml
+++ b/modules/meeting/config/locales/en.yml
@@ -114,7 +114,7 @@ en:
meeting:
attachments:
- text: "Attached files are available to all meeting participants. You can also drag and drop tehse into agenda item notes."
+ text: "Attached files are available to all meeting participants. You can also drag and drop these into agenda item notes."
copy:
title: "Copy meeting %{title}"
attachments: "Copy attachments"
@@ -202,8 +202,11 @@ en:
label_meeting_details: "Meeting details"
label_meeting_details_edit: "Edit meeting details"
+ label_meeting_state: "Meeting state"
label_meeting_state_open: "Open"
+ label_meeting_state_open_html: "<i>Open</i>"
label_meeting_state_closed: "Closed"
+ label_meeting_state_closed_html: "<i>Closed</i>"
label_meeting_reopen_action: "Reopen meeting"
label_meeting_close_action: "Close meeting"
text_meeting_open_description: "This meeting is open. You can add/remove agenda items and edit them as you please. After the meeting is over, close it to lock it."
diff --git a/modules/meeting/db/migrate/20240408161233_add_state_to_meeting_journal.rb b/modules/meeting/db/migrate/20240408161233_add_state_to_meeting_journal.rb
new file mode 100644
index 00000000000..65165c9cc79
--- /dev/null
+++ b/modules/meeting/db/migrate/20240408161233_add_state_to_meeting_journal.rb
@@ -0,0 +1,5 @@
+class AddStateToMeetingJournal < ActiveRecord::Migration[7.1]
+ def change
+ add_column :meeting_journals, :state, :integer, default: 0, null: false
+ end
+end
diff --git a/modules/meeting/lib/open_project/journal_formatter/meeting_state.rb b/modules/meeting/lib/open_project/journal_formatter/meeting_state.rb
new file mode 100644
index 00000000000..af6140b7c08
--- /dev/null
+++ b/modules/meeting/lib/open_project/journal_formatter/meeting_state.rb
@@ -0,0 +1,48 @@
+#-- copyright
+# OpenProject is an open source project management software.
+# Copyright (C) 2012-2024 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 OpenProject::JournalFormatter::MeetingState < JournalFormatter::Base
+ def render(_key, values, options = { html: true })
+ label_text = I18n.t(:label_meeting_state)
+ label_text = content_tag(:strong, label_text) if options[:html]
+
+ I18n.t(:text_journal_set_to, label: label_text, value: value(options[:html], values.last))
+ end
+
+ private
+
+ def state_key(value)
+ Meeting.states.key(value)
+ end
+
+ def value(html, state)
+ html = html ? "_html" : ""
+
+ I18n.t(:"label_meeting_state_#{state_key(state)}#{html}")
+ end
+end
diff --git a/modules/meeting/spec/features/structured_meetings/history_spec.rb b/modules/meeting/spec/features/structured_meetings/history_spec.rb
index 6c36a2f8025..cb772df335b 100644
--- a/modules/meeting/spec/features/structured_meetings/history_spec.rb
+++ b/modules/meeting/spec/features/structured_meetings/history_spec.rb
@@ -104,7 +104,8 @@ RSpec.describe "history",
meeting.update!(start_time: DateTime.parse("2024-03-29T14:00:00Z"),
duration: 1,
title: "Updated",
- location: "Wakanda")
+ location: "Wakanda",
+ state: 5)
login_as(view_only_user)
show_page.visit!
@@ -121,8 +122,11 @@ RSpec.describe "history",
expect(page).to have_css("li", text: "Location changed from https://some-url.com to Wakanda")
expect(page).to have_css("li", text: "Start time changed from 03/28/2024 01:30 PM to 03/29/2024 02:00 PM")
expect(page).to have_css("li", text: "Duration changed from 1 hr, 30 mins to 1 hr")
+ expect(page).to have_css("li", text: "Meeting state set to Closed")
end
+ meeting.update!(state: 0)
+
login_as(user)
show_page.visit!