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
Correct route and contract definition
Henriette Darge2e2821130683
diff --git a/frontend/src/app/features/work-packages/components/wp-list/wp-query-view.service.ts b/frontend/src/app/features/work-packages/components/wp-list/wp-query-view.service.tsindex 5dd18c86679..07137bcf956 100644--- a/frontend/src/app/features/work-packages/components/wp-list/wp-query-view.service.ts+++ b/frontend/src/app/features/work-packages/components/wp-list/wp-query-view.service.ts@@ -42,6 +42,9 @@ export class WorkPackagesQueryViewService {if (this.$state.includes('bim')) {return 'bim';}+ if (this.$state.includes('calendar')) {+ return 'work_packages_calendar';+ }throw new Error('Not on a path defined for query views');}diff --git a/modules/calendar/app/contracts/calendar/views/contract_strategy.rb b/modules/calendar/app/contracts/calendar/views/contract_strategy.rbindex b66fbaba628..b1e93e157f4 100644--- a/modules/calendar/app/contracts/calendar/views/contract_strategy.rb+++ b/modules/calendar/app/contracts/calendar/views/contract_strategy.rb@@ -1,21 +1,23 @@-module Views- class CalendarStrategy < ::BaseContract- validate :manageable+module ::Calendar+ module Views+ class ContractStrategy < ::BaseContract+ validate :manageable- private+ private- def manageable- return if model.query.blank?+ def manageable+ return if model.query.blank?- errors.add(:base, :error_unauthorized) unless query_permissions?- end+ errors.add(:base, :error_unauthorized) unless query_permissions?+ end- def query_permissions?- user_allowed_on_query?(:view_calendar)- end+ def query_permissions?+ user_allowed_on_query?(:view_calendar)+ end- def user_allowed_on_query?(permission)- user.allowed_to?(permission, model.query.project, global: model.query.project.nil?)+ def user_allowed_on_query?(permission)+ user.allowed_to?(permission, model.query.project, global: model.query.project.nil?)+ endendendenddiff --git a/modules/calendar/config/routes.rb b/modules/calendar/config/routes.rbindex 40ef4fb1974..4c13c83eb95 100644--- a/modules/calendar/config/routes.rb+++ b/modules/calendar/config/routes.rb@@ -1,7 +1,7 @@OpenProject::Application.routes.draw doscope 'projects/:project_id', as: 'project' do- resources :calendar, controller: 'calendar/calendar', only: [:index]+ get '/calendar(/*state)', to: 'calendar/calendar#index', as: :indexend- resources :calendar, controller: 'calendar/calendar', only: [:index]+ get '/calendar(/*state)', to: 'calendar/calendar#index', as: :indexend