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
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Use empty section title as untitled
Oliver Günther134b567ebdec
diff --git a/modules/meeting/app/components/meeting_sections/header_component.html.erb b/modules/meeting/app/components/meeting_sections/header_component.html.erbindex d421dc95986..f15d8c6f5ca 100644--- a/modules/meeting/app/components/meeting_sections/header_component.html.erb+++ b/modules/meeting/app/components/meeting_sections/header_component.html.erb@@ -9,7 +9,7 @@endgrid.with_area(:content, tag: :span) dorender(Primer::Beta::Text.new(font_weight: :bold, mr: 2)) do- @meeting_section.title+ @meeting_section.title.presence || I18n.t("meeting_section.untitled_title")endendif @meeting_section.agenda_items_sum_duration_in_minutes > 0@@ -25,7 +25,7 @@menu.with_show_button(icon: "kebab-horizontal", 'aria-label': t("settings.project_attributes.label_section_actions"), scheme: :invisible)edit_action_item(menu)unless first? && last?- menu.with_divider+ menu.with_dividermove_actions(menu)endmenu.with_dividerdiff --git a/modules/meeting/app/contracts/meeting_sections/create_contract.rb b/modules/meeting/app/contracts/meeting_sections/create_contract.rbindex 7486bf1c1a0..f0b6794cf94 100644--- a/modules/meeting/app/contracts/meeting_sections/create_contract.rb+++ b/modules/meeting/app/contracts/meeting_sections/create_contract.rb@@ -28,7 +28,12 @@module MeetingSectionsclass CreateContract < BaseContract- validate :user_allowed_to_add, :validate_meeting_existence+ validate :user_allowed_to_add,+ :validate_meeting_existence++ # We allow an empty title to mark an untitled/implicit section+ # but users should not be able to create it with an empty title+ validates :title, presence: truedef self.assignable_meetings(user)StructuredMeetingdiff --git a/modules/meeting/app/models/meeting_agenda_item.rb b/modules/meeting/app/models/meeting_agenda_item.rbindex cd52da17a98..3f26a4c8221 100644--- a/modules/meeting/app/models/meeting_agenda_item.rb+++ b/modules/meeting/app/models/meeting_agenda_item.rb@@ -78,7 +78,7 @@ class MeetingAgendaItem < ApplicationRecordmeeting_section = meeting.sections.order(position: :asc).lastif meeting_section.nil?- meeting_section = meeting.sections.build(title: "Untitled")+ meeting_section = meeting.sections.build(title: "")endself.meeting_section = meeting_sectiondiff --git a/modules/meeting/app/models/meeting_section.rb b/modules/meeting/app/models/meeting_section.rbindex 0acb98b6824..21184bc660f 100644--- a/modules/meeting/app/models/meeting_section.rb+++ b/modules/meeting/app/models/meeting_section.rb@@ -34,10 +34,6 @@ class MeetingSection < ApplicationRecordhas_many :agenda_items, dependent: :destroy, class_name: "MeetingAgendaItem"has_one :project, through: :meeting- validates :title, presence: true-- before_validation :set_default_title-after_save :trigger_meeting_agenda_item_time_slots_calculation, if: Proc.new { |section|section.position_previously_changed?}@@ -50,18 +46,12 @@ class MeetingSection < ApplicationRecordmeeting.calculate_agenda_item_time_slotsend- def set_default_title- if title.blank?- self.title = I18n.t("meeting_section.default_title")- end- end-def has_default_title?title == I18n.t("meeting_section.default_title")enddef untitled?- title == I18n.t("meeting_section.untitled_title")+ title.blank?enddef editable?diff --git a/modules/meeting/db/migrate/20240516102219_fix_untitled_meetings.rb b/modules/meeting/db/migrate/20240516102219_fix_untitled_meetings.rbnew file mode 100644index 00000000000..6909ee6af41--- /dev/null+++ b/modules/meeting/db/migrate/20240516102219_fix_untitled_meetings.rb@@ -0,0 +1,9 @@+class FixUntitledMeetings < ActiveRecord::Migration[7.1]+ def up+ MeetingSection.where(title: "Untitled").update_all(title: "")+ end++ def down+ MeetingSection.where(title: "").update_all(title: "Untitled")+ end+end