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

Update default to show upcoming invitations

Mir Bhatia53e313b4037f
diff --git a/modules/meeting/app/controllers/meetings_controller.rb b/modules/meeting/app/controllers/meetings_controller.rb
index d71402442d9..02ec1c34136 100644
--- a/modules/meeting/app/controllers/meetings_controller.rb
+++ b/modules/meeting/app/controllers/meetings_controller.rb
@@ -58,7 +58,7 @@ class MeetingsController < ApplicationController
def index
@query = load_query
@meetings = load_meetings(@query)
- render 'index', locals: { menu_name: project_or_global_menu }
+ render "index", locals: { menu_name: project_or_global_menu }
end
current_menu_item :index do
@@ -70,11 +70,11 @@ class MeetingsController < ApplicationController
if @meeting.is_a?(StructuredMeeting)
render(Meetings::ShowComponent.new(meeting: @meeting, project: @project))
elsif @meeting.agenda.present? && @meeting.agenda.locked?
- params[:tab] ||= 'minutes'
+ params[:tab] ||= "minutes"
end
end
- def create
+ def create # rubocop:disable Metrics/AbcSize
call =
if @copy_from
::Meetings::CopyService
@@ -90,14 +90,15 @@ class MeetingsController < ApplicationController
text = I18n.t(:notice_successful_create)
if User.current.time_zone.nil?
link = I18n.t(:notice_timezone_missing, zone: Time.zone)
- text += " #{view_context.link_to(link, { controller: '/my', action: :settings, anchor: 'pref_time_zone' }, class: 'link_to_profile')}"
+ text += " #{view_context.link_to(link, { controller: '/my', action: :settings, anchor: 'pref_time_zone' },
+ class: 'link_to_profile')}"
end
flash[:notice] = text.html_safe # rubocop:disable Rails/OutputSafety
- redirect_to action: 'show', id: call.result
+ redirect_to action: "show", id: call.result
else
@meeting = call.result
- render template: 'meetings/new', project_id: @project, locals: { copy_from: @copy_from }
+ render template: "meetings/new", project_id: @project, locals: { copy_from: @copy_from }
end
end
@@ -114,13 +115,13 @@ class MeetingsController < ApplicationController
.call(save: false)
@meeting = call.result
- render action: 'new', project_id: @project, locals: { copy_from: }
+ render action: "new", project_id: @project, locals: { copy_from: }
end
def destroy
@meeting.destroy
flash[:notice] = I18n.t(:notice_successful_delete)
- redirect_to action: 'index', project_id: @project
+ redirect_to action: "index", project_id: @project
end
def edit
@@ -154,9 +155,9 @@ class MeetingsController < ApplicationController
@meeting.attributes = @converted_params
if @meeting.save
flash[:notice] = I18n.t(:notice_successful_update)
- redirect_to action: 'show', id: @meeting
+ redirect_to action: "show", id: @meeting
else
- render action: 'edit'
+ render action: "edit"
end
end
@@ -238,7 +239,7 @@ class MeetingsController < ApplicationController
flash[:notice] = I18n.t(:notice_successful_notification)
else
flash[:error] = I18n.t(:error_notification_with_errors,
- recipients: result.errors.map(&:name).join('; '))
+ recipients: result.errors.map(&:name).join("; "))
end
redirect_to action: :show, id: @meeting
@@ -255,7 +256,7 @@ class MeetingsController < ApplicationController
query = apply_default_filter_if_none_given(query)
if @project
- query.where("project_id", '=', @project.id)
+ query.where("project_id", "=", @project.id)
end
query
@@ -265,6 +266,7 @@ class MeetingsController < ApplicationController
return query if query.filters.any?
query.where("time", "=", Queries::Meetings::Filters::TimeFilter::FUTURE_VALUE)
+ query.where("invited_user_id", "=", [User.current.id.to_s])
end
def load_meetings(query)
@@ -335,15 +337,15 @@ class MeetingsController < ApplicationController
def meeting_type(given_type)
case given_type
- when 'dynamic'
- 'StructuredMeeting'
+ when "dynamic"
+ "StructuredMeeting"
else
- 'Meeting'
+ "Meeting"
end
end
def verify_activities_module_activated
- render_403 if @project && [email protected]_enabled?('activity')
+ render_403 if @project && [email protected]_enabled?("activity")
end
def set_activity
@@ -370,8 +372,8 @@ class MeetingsController < ApplicationController
if params[:from]
begin
- ; @date_to = params[:from].to_date + 1.day;
- rescue StandardError;
+ @date_to = params[:from].to_date + 1.day
+ rescue StandardError
end
end
@@ -393,8 +395,8 @@ class MeetingsController < ApplicationController
def copy_attributes
{
- copy_agenda: params[:copy_agenda] == '1',
- copy_attachments: params[:copy_attachments] == '1',
+ copy_agenda: params[:copy_agenda] == "1",
+ copy_attachments: params[:copy_attachments] == "1"
}
end
end
diff --git a/modules/meeting/app/helpers/meetings_helper.rb b/modules/meeting/app/helpers/meetings_helper.rb
index 0ba10516350..cbf86094711 100644
--- a/modules/meeting/app/helpers/meetings_helper.rb
+++ b/modules/meeting/app/helpers/meetings_helper.rb
@@ -44,7 +44,12 @@ module MeetingsHelper
end
def menu_upcoming_meetings_item
- path = project_or_global_meetings_path
+ path = project_or_global_meetings_path(
+ filters: [
+ { time: { operator: "=", values: ["future"] } }
+ ],
+ sort: "start_time"
+ )
menu_link_element path, t(:label_upcoming_meetings)
end
@@ -59,13 +64,7 @@ module MeetingsHelper
end
def menu_upcoming_invitations_item
- path = project_or_global_meetings_path(
- filters: [
- { time: { operator: "=", values: ["future"] } },
- { invited_user_id: { operator: "=", values: [User.current.id.to_s] } }
- ],
- sort: "start_time"
- )
+ path = project_or_global_meetings_path
menu_link_element path, t(:label_upcoming_invitations)
end
diff --git a/modules/meeting/spec/features/meetings_global_menu_item_spec.rb b/modules/meeting/spec/features/meetings_global_menu_item_spec.rb
index d849d29f2e8..c489fb98320 100644
--- a/modules/meeting/spec/features/meetings_global_menu_item_spec.rb
+++ b/modules/meeting/spec/features/meetings_global_menu_item_spec.rb
@@ -55,9 +55,9 @@ RSpec.describe "Meetings global menu item",
expect(page).to have_current_path("/meetings")
end
- specify '"Upcoming meetings" is the default filter set' do
+ specify '"Upcoming invitations" is the default filter set' do
within "#main-menu" do
- expect(page).to have_css(".selected", text: I18n.t(:label_upcoming_meetings))
+ expect(page).to have_css(".selected", text: I18n.t(:label_upcoming_invitations))
end
end
end