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
Hide "send invite" action conditionally
Mir Bhatia2c66af839a49
diff --git a/modules/meeting/app/components/meetings/header_component.rb b/modules/meeting/app/components/meetings/header_component.rbindex fb3aa044720..1368320d544 100644--- a/modules/meeting/app/components/meetings/header_component.rb+++ b/modules/meeting/app/components/meetings/header_component.rb@@ -75,7 +75,7 @@ module Meetingsdef send_emails?- @meeting.notify &&+ @meeting.notify? &&User.current.allowed_in_project?(:send_meeting_invites_and_outcomes, @meeting.project)enddiff --git a/modules/meeting/app/components/recurring_meetings/show_page_header_component.html.erb b/modules/meeting/app/components/recurring_meetings/show_page_header_component.html.erbindex 44f493935f3..958977cfccf 100644--- a/modules/meeting/app/components/recurring_meetings/show_page_header_component.html.erb+++ b/modules/meeting/app/components/recurring_meetings/show_page_header_component.html.erb@@ -39,12 +39,14 @@item.with_leading_visual_icon(icon: :calendar)end- menu.with_item(- label: t("meeting.label_mail_all_participants"),- href: notify_project_recurring_meeting_path(@project, @meeting),- form_arguments: { method: :post }- ) do |item|- item.with_leading_visual_icon(icon: :mail)+ if send_emails?+ menu.with_item(+ label: t("meeting.label_mail_all_participants"),+ href: notify_project_recurring_meeting_path(@project, @meeting),+ form_arguments: { method: :post }+ ) do |item|+ item.with_leading_visual_icon(icon: :mail)+ endendif [email protected]_ended? && @meeting.start_time.to_date < Time.zone.todaydiff --git a/modules/meeting/app/components/recurring_meetings/show_page_header_component.rb b/modules/meeting/app/components/recurring_meetings/show_page_header_component.rbindex 5813be8ffc1..69f10958854 100644--- a/modules/meeting/app/components/recurring_meetings/show_page_header_component.rb+++ b/modules/meeting/app/components/recurring_meetings/show_page_header_component.rb@@ -49,6 +49,11 @@ module RecurringMeetingsendend+ def send_emails?+ @meeting.notify? &&+ User.current.allowed_in_project?(:send_meeting_invites_and_outcomes, @meeting.project)+ end+def dynamic_pathpolymorphic_path([:new, @project, :recurring_meeting])enddiff --git a/modules/meeting/app/controllers/recurring_meetings_controller.rb b/modules/meeting/app/controllers/recurring_meetings_controller.rbindex 150e5014297..03c73358a52 100644--- a/modules/meeting/app/controllers/recurring_meetings_controller.rb+++ b/modules/meeting/app/controllers/recurring_meetings_controller.rb@@ -222,8 +222,12 @@ class RecurringMeetingsController < ApplicationControllerenddef notify- deliver_invitation_mails- flash[:notice] = I18n.t(:notice_successful_notification)+ if deliver_invitation_mails == false+ flash[:error] = I18n.t(:error_notification)+ else+ flash[:notice] = I18n.t(:notice_successful_notification)+ end+redirect_to action: :showend@@ -246,7 +250,7 @@ class RecurringMeetingsController < ApplicationControllerenddef deliver_invitation_mails- return unless @recurring_meeting.template.notify?+ return false unless @recurring_meeting.template.notify?@recurring_meeting.templatediff --git a/modules/meeting/config/locales/en.yml b/modules/meeting/config/locales/en.ymlindex cf47223a922..1471edf0be6 100644--- a/modules/meeting/config/locales/en.yml+++ b/modules/meeting/config/locales/en.yml@@ -115,6 +115,7 @@ en:meeting_minutes: Meeting minutes editedmeeting_minutes_created: Meeting minutes created+ error_notification: "Failed to send notification."error_notification_with_errors: "Failed to send notification. The following recipients could not be notified: %{recipients}"label_meeting: "Meeting"