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

Ensure old meetings work within projects

Oliver Günther9f63d16661c7
diff --git a/modules/meeting/app/controllers/meeting_contents_controller.rb b/modules/meeting/app/controllers/meeting_contents_controller.rb
index 980cf6b3c88..4a7a926248f 100644
--- a/modules/meeting/app/controllers/meeting_contents_controller.rb
+++ b/modules/meeting/app/controllers/meeting_contents_controller.rb
@@ -42,13 +42,10 @@ class MeetingContentsController < ApplicationController
before_action :load_and_authorize_in_optional_project
before_action :find_meeting, :find_content
- def show
+ 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 controller: "/meetings",
- action: :show,
- id: @meeting,
- tab: @content_type.sub(/^meeting_/, "")
+ redirect_to project_meeting_path(@project, @meeting, tab: @content_type.sub(/^meeting_/, ""))
return
end
@@ -65,7 +62,7 @@ class MeetingContentsController < ApplicationController
if call.success?
flash[:notice] = I18n.t(:notice_successful_update)
- redirect_back_or_default controller: "/meetings", action: "show", id: @meeting
+ 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?
@@ -99,6 +96,7 @@ class MeetingContentsController < ApplicationController
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
diff --git a/modules/meeting/app/controllers/meetings_controller.rb b/modules/meeting/app/controllers/meetings_controller.rb
index 5bb20539d7e..8b2bfdf3b7c 100644
--- a/modules/meeting/app/controllers/meetings_controller.rb
+++ b/modules/meeting/app/controllers/meetings_controller.rb
@@ -33,6 +33,7 @@ class MeetingsController < ApplicationController
before_action :determine_author, only: %i[history]
before_action :build_meeting, only: %i[new new_dialog]
before_action :find_meeting, except: %i[index new create new_dialog]
+ before_action :redirect_to_project, only: %i[show]
before_action :set_activity, only: %i[history]
before_action :find_copy_from_meeting, only: %i[create]
before_action :convert_params, only: %i[create update update_participants]
@@ -526,4 +527,10 @@ class MeetingsController < ApplicationController
def prevent_template_destruction
render_400 if @meeting.templated?
end
+
+ def redirect_to_project
+ return if @project
+
+ redirect_to project_meeting_path(@meeting.project, @meeting, tab: params[:tab]), status: :see_other
+ end
end
diff --git a/modules/meeting/app/views/meetings/show.html.erb b/modules/meeting/app/views/meetings/show.html.erb
index 744a84ed041..07304fbe12c 100644
--- a/modules/meeting/app/views/meetings/show.html.erb
+++ b/modules/meeting/app/views/meetings/show.html.erb
@@ -39,7 +39,7 @@ See COPYRIGHT and LICENSE files for more details.
<% end %>
<% if authorize_for(:meetings, :edit) %>
<li class="toolbar-item">
- <%= link_to({ :controller => '/meetings', :action => 'edit', :id => @meeting }, class: 'button', :accesskey => accesskey(:edit)) do %>
+ <%= link_to(edit_project_meeting_path(@project, @meeting), class: 'button', :accesskey => accesskey(:edit)) do %>
<%= op_icon('button--icon icon-edit') %>
<span class="button--text"><%= t(:button_edit) %></span>
<% end %>
@@ -121,8 +121,26 @@ See COPYRIGHT and LICENSE files for more details.
</div>
</div>
-<%= 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" }] %>
+<%= 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? %>
<div id="history">
diff --git a/modules/meeting/spec/controllers/meetings_controller_spec.rb b/modules/meeting/spec/controllers/meetings_controller_spec.rb
index c5606e768f7..abc55e4735c 100644
--- a/modules/meeting/spec/controllers/meetings_controller_spec.rb
+++ b/modules/meeting/spec/controllers/meetings_controller_spec.rb
@@ -54,7 +54,7 @@ RSpec.describe MeetingsController do
get "show", params: { id: meeting.id }
end
- it { expect(response).to be_successful }
+ it { expect(response).to redirect_to(project_meeting_path(project, meeting)) }
it { expect(assigns(:meeting)).to eql meeting }
end
end
diff --git a/modules/meeting/spec/features/meetings_close_spec.rb b/modules/meeting/spec/features/meetings_close_spec.rb
index d0222f0792c..5c4992fd40f 100644
--- a/modules/meeting/spec/features/meetings_close_spec.rb
+++ b/modules/meeting/spec/features/meetings_close_spec.rb
@@ -51,7 +51,7 @@ RSpec.describe "Meetings close" do
let(:permissions) { %i[view_meetings close_meeting_agendas] }
it "can delete own and other`s meetings" do
- visit meetings_path(project)
+ visit project_meetings_path(project)
click_on meeting.title
@@ -87,7 +87,7 @@ RSpec.describe "Meetings close" do
let(:permissions) { %i[view_meetings] }
it "cannot delete own and other`s meetings" do
- visit meetings_path(project)
+ visit project_meetings_path(project)
expect(page)
.to have_no_link "Close"