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

Rubocop fix all valdiations in Meeting and RecurringMeeting

Klaus Zanders02b3a71b345c
diff --git a/modules/meeting/app/models/meeting.rb b/modules/meeting/app/models/meeting.rb
index 84960c3d173..39c9d75689d 100644
--- a/modules/meeting/app/models/meeting.rb
+++ b/modules/meeting/app/models/meeting.rb
@@ -115,9 +115,9 @@ class Meeting < ApplicationRecord
accepts_nested_attributes_for :participants, allow_destroy: true
- validates_presence_of :title, :project_id
+ validates :title, :project_id, presence: true
- validates_numericality_of :duration, greater_than: 0
+ validates :duration, numericality: { greater_than: 0 }
before_save :add_new_participants_as_watcher
diff --git a/modules/meeting/app/models/recurring_meeting.rb b/modules/meeting/app/models/recurring_meeting.rb
index 1fa158e6f84..394b9b9547c 100644
--- a/modules/meeting/app/models/recurring_meeting.rb
+++ b/modules/meeting/app/models/recurring_meeting.rb
@@ -40,18 +40,18 @@ class RecurringMeeting < ApplicationRecord
belongs_to :project
belongs_to :author, class_name: "User"
- validates_presence_of :start_time, :title, :frequency, :end_after, :time_zone
- validates_presence_of :end_date, if: -> { end_after_specific_date? }
- validates_numericality_of :iterations,
- only_integer: true,
+ validates :start_time, :title, :frequency, :end_after, :time_zone, presence: true
+ validates :end_date, presence: { if: -> { end_after_specific_date? } }
+ validates :iterations,
+ numericality: { only_integer: true,
greater_than_or_equal_to: 1,
less_than_or_equal_to: MAX_ITERATIONS,
- if: -> { end_after_iterations? }
- validates_numericality_of :interval,
- only_integer: true,
+ if: -> { end_after_iterations? } }
+ validates :interval,
+ numericality: { only_integer: true,
greater_than_or_equal_to: 1,
less_than_or_equal_to: MAX_INTERVAL,
- if: -> { !frequency_working_days? }
+ if: -> { !frequency_working_days? } }
validate :end_date_constraints,
if: -> { end_after_specific_date? }
@@ -61,8 +61,8 @@ class RecurringMeeting < ApplicationRecord
# Unset any previously set schedule before running validations
before_validation :unset_schedule
- after_save :unset_schedule
before_destroy :remove_jobs
+ after_save :unset_schedule
enum :frequency,
{