332 Commits

Author SHA1 Message Date
Kabiru Mwenja a88698c230 Use where_display_id_in in find_work_packages
Both :work_package_id (single-WP routes) and :ids (bulk routes) come
from URLs or HTML forms and may carry semantic identifiers, so the
prior numeric-only assumption on :ids was wrong. Route both inputs
through WorkPackage.where_display_id_in, which returns a chainable
scope that matches numeric, current-identifier, and historical-alias
forms in a single query — no per-id round trip and no controller-side
coupling to WorkPackageSemanticAlias.

Tighten the post-move controller spec to assert the redirect URL
contains the destination project's semantic prefix when follow: 1 is
set, which is the path that exercises the moved WP's display_id.
2026-04-30 17:44:12 +03:00
Kabiru Mwenja c069e1bcb1 Resolve semantic work package id in find_work_packages
Single-WP routes pass :work_package_id from the URL, which can be a
semantic identifier (e.g. "PROJ-42") since commit 4dfdd6ec5d dropped
numeric pins on the move and copy HAL action links. The bulk
where(id:) lookup in find_work_packages only matches numeric primary
keys, so /work_packages/PROJ-42/move/new returned 404. Translate
:work_package_id through find_by_display_id first; the bulk :ids
branch is untouched since form submissions already send numeric ids.
2026-04-30 16:45:27 +03:00
Klaus Zanders b4dcdf467e Remove generic find methods in controllers 2026-02-09 15:07:52 +01:00
Alexander Brandon Coles 9ff68b84c6 Fix wording (code): change "expiry" to "expiration" 2025-11-11 20:29:04 +00:00
Henriette Darge 655756631f [67007] Render the WP full view from rails (#20109)
* Create a FullView::CopyComponent for WorkPackages which is routed from rails

* Remove angular splitCopy route and component as it was overwritten by the angular fullCopy route for quite some time already and nobody complained. So we decided to remove the splitCopy completely

* Create FullView::CreateComponent for WorkPackages which is now routed from rails instead of Angular

* First draft of implementing the FullView route for WorkPackages from rails

* Pass correct tab from the URL to the FullView::ShowComponent

* Do a hard reload to "create" route when we are not routed from Angular

* Adapt routing spec to new WorkPackage routes and to some fine-tuning with the WP routes

* Show correct tab in WP Full view and change URL when clicking a tab entry

* Adapt to new rails based routing

* Fix some routes and redirects

* Make sure, the split screen stil renders correctly

* Remove back button from WP full view

* Fix routing issues

* Start fixing specs

* Attempt to override the browser history to be able to use browser back

* Use helper function to build new WP url string

* Adapt spec that now partially renders backend toasts

* Remove ability to move to fullscreen

Theoretically, we can re-add it by posting to some form endpoint, but
not worth it for the first iteration

* Disable cache-control on angular routed pages, so back links work

* Fix double click to fullscreen

* Adapt navigation and title setting

* Let WP breadcrumb to a hard reload instead of Angular transition

* Redirect when the WP route is incomplete (this is the attempt to re-implement an angular functionality)

* Navigate with Turbo when double clicking a card

* Adapt onboarding tour to new hard reload when switching to WP full view

* Fix some specs

* Fix more tests

* Hide Overview tab on FullView

* Correct check for incomplete routes

* Do a hard refresh when coming from slpit screen to full view

* Fix notification navigation

* Adapt attachment spec as the tab switch cannot be done anymore while dragging

* Fix more tests

* Please rubocop and fix more tests

* Attempt to fix navigation_spec

* Add debian_base for pullpreview

---------

Co-authored-by: Oliver Günther <mail@oliverguenther.de>
2025-11-03 09:02:16 +01:00
Christophe Bliard 44572fe4d0 Do not use all available languages as i18n fallbacks
The files downloaded from Crowdin are always complete, and already fall
back to english in the YML.

We still need I18n fallback mechanism for at least 2 use cases:
- during development when we are adding strings to the translation files
  and we are not using the English locale. (Only after crowdin took its
  turn, does a locale key exist everywhere)
- for `Settings::Email#localized_emails_header` and
  `Settings::Email#localized_emails_footer`: translations are set by the
  admins and some languages do not have a localized version. We use the
  fallback mechanism to get translations from other locales if there is
  none for the current locale.

As we have `:en` as the default locale, `I18n` automatically falls back
to our default locale. No need to set `I18n.fallbacks.defaults`
ourselves.
2025-10-06 15:55:20 +02:00
Henriette Darge 5cab658227 Re-add global news widget route 2025-09-23 08:32:19 +02:00
Oliver Günther bf93b827b3 Tag opentelemetry request 2025-09-17 15:32:27 +02:00
Oliver Günther 8151497ed0 Wrap error only when Rails.application.config.consider_all_requests_local false 2025-09-04 09:51:36 +02:00
Oliver Günther b21d621db2 Rescue ActionController::UnknownFormat error 2025-09-04 09:30:25 +02:00
Oliver Günther a175c84879 Move CSP to Rails 2025-07-08 16:17:29 +02:00
Oliver Günther 8c5d182d7b Add EnterpriseGuard to make it easier to add before_actions 2025-06-12 13:38:55 +02:00
Henriette Darge ee8452282a [63485] Remove show_local_breadcrumb and default_breadcrumb (#18663)
* add a new helper for breadcrumb in wiki page

* set page header in destroy page

* set page header in edit page

* set page header in history and rename and edit parent pages

* change toolbar items into page header items

* add new wiki action to sub header

* remove version edit page which is not in use any more

* add export as a menu item of the header

* fix rubocup errors

* fix failing tests

* replace page header in annotate page

* replace page header in diff page

* add page header in select menu page

* fix rubocup errors

* fix errors on rename test

* fix errors on selecting items from toolbar

* fix errors on tests for child pages

* set correct permission for configure menu item

* replace page header in summary page

* replace page header in summary details page

* edit docs of sub header

* add page header in wiki new page

* remove controller and a route for edit method

* undo changes for docs of sub header

* extract header in show page into a new component

* use helper method in header component

* add wiki module to the breadcrumb

* rename page header component for wiki page

* simplify how lock and lock implemented

* extract sub header

* remove wiki title from header of history page

* fix page header in new page

* use page.find_test_selector in test

* fix failing test for summary page

* fix failing test for wiki child pages

* change the summary test

* use test selector for page header title

* undo changes for activate user in admin

* use test selector in adding editing history test

* use test selector in attachment upload test

* use test selector in child pages tests

* use test selector in wiki menu items tests

* change test selector for breadcrumbs

* extract conditions to show edit button into a method

* extract conditions to show rollback action menu item into a method

* extract conditions to show create button into a method

* fix duplicated code in test

* Remove outdated `show_local_breadcrumb` method which is replaced by the Primer::PageHeader breadcrumb

* Remove `default_breadcrumb` method as it serves no prupose any more

* Remove the old breadcrumb and its hook completely

* remove breadcrumbs path from rename

* fix translations errors in storages

* undo changes on translations

* remove default breadcrumbs in time tracking controller

---------

Co-authored-by: Behrokh Satarnejad <b.satarnejad@openproject.com>
Co-authored-by: Behrokh Satarnejad <62008897+bsatarnejad@users.noreply.github.com>
2025-04-23 10:40:43 +02:00
Jan Sandbrink a74ff77546 Merge pull request #18547 from opf/remaining-frozen-strings
Fix remaining unit test failures due to frozen string literals
2025-04-17 09:23:47 +02:00
Dombi Attila 10dc5538a2 [#63386] Use rescue_from ActiveRecord::RecordNotFound
https://community.openproject.org/work_packages/63386
2025-04-14 13:44:28 +03:00
Jan Sandbrink 82fc4fcb13 Fix remaining unit test failures due to frozen string literals
This should fix the last known unit test failures occuring due to the usage of
frozen string literal comments. Those were tested in a separate
commit. Broadly enabling frozen string literals will happen in multiple
separate commits after this one and only after feature tests have been fixed
as well.
2025-04-04 17:09:48 +02:00
Oliver Günther b65e2cb514 Allow redirecting back to global 2025-02-13 13:16:54 +01:00
Kabiru Mwenja 39040c696c chore[Op#56496]: Collapase mixin into a single module
"OpModal::" is not really a shared namespace, so no need to nesting here
2024-09-30 17:45:10 +03:00
Kabiru Mwenja 4dbd60a367 chore[Op#56496]: Introduce flash modal contention via controller concern
`OpTurbo::Flashable`
  - `#flash_op_modal` - accepts a component and parameters. The component should be a ViewComponent and respond to `:name`, otherwise an error is raised
  - `#store_callback_op_modal_flash` - "Long term storage" - store directly in the session, useful when callback is needed on longer term basis E.g. in open redirect with callback
  - `#retrieve_callback_op_modal_flash` - safely read the values from `#store_callback_op_modal_flash`
2024-09-30 17:11:04 +03:00
Ivan Kuchin 4911b8a149 remove years from copyrights (except for COPYRIGHT file) 2024-07-31 15:02:49 +02:00
Oliver Günther c7286fb91f Set default host at all times
This results in us having to use a bit more helpers around request and feature specs
to ensure that the configured host name also matches the requested one.
2024-07-08 16:11:09 +02:00
ulferts 8d3b777941 move authorization methods into module 2024-06-07 17:11:55 +02:00
ulferts 65b3ca2175 remove authorize methods not used 2024-06-07 17:03:58 +02:00
ulferts d3e81b257b remove methods rendered superfluous by using default auth methods 2024-06-07 16:57:27 +02:00
ulferts 9ad5b32e45 fix typos 2024-06-07 16:56:41 +02:00
ulferts a3aa240823 enforce checking authorization by adding a before_action 2024-06-07 16:52:00 +02:00
ulferts 3b2121f733 Revert "Merge remote-tracking branch 'origin/release/13.4' into dev"
This reverts commit 40b2bbeb09, reversing
changes made to b4c6cb17cc.
2024-03-21 11:31:17 +01:00
Ivan Kuchin 7787e457a3 Revert "Merge branch 'dev' into release/13.4"
This reverts commit a901541269, reversing
changes made to e573ca00b7.
2024-03-20 20:19:08 +01:00
Ivan Kuchin 9e4934cd0a change quotes using rubocop --only Style/StringLiterals,Style/QuotedSymbols -a 2024-03-20 18:05:22 +01:00
Pavel Balashou 3572d18352 Modify set_localization to respect session[:authenticated_user_id]. 2024-02-13 22:07:22 +01:00
Dombi Attila 9865cc7880 Simplify default_breadcrumb method 2024-02-01 14:23:28 +02:00
Dombi Attila 37527067e2 Demodulize controller name for default breadcrumb, to avoid translation missing error 2024-02-01 14:22:07 +02:00
Christophe Bliard 8fa8584538 Run rubocop --autocorrect on all files
Only the safe cops have run. rubocop version is 1.59.0.
2024-01-05 15:27:09 +01:00
Christophe Bliard c795874f7f Update copyright year for 2024
command used: `rg -l 'Copyright \(C\) 2012-202\d the OpenProject' | xargs -n 100 sed -i -r 's/Copyright \(C\) 2012-202. the OpenProject/Copyright (C) 2012-2024 the OpenProject/'`
2024-01-02 16:23:54 +01:00
Klaus Zanders 6c690f678e Remove catching the UnknownPermissionError 2023-11-09 15:55:03 +01:00
Klaus Zanders 96c2646671 Fix tests 2023-11-07 17:02:19 +01:00
Klaus Zanders a732ad3bfd Try if we can use the allowed_based_on_permission_context method in authorize 2023-11-07 15:55:13 +01:00
Klaus Zanders e7396beb0a Fix method that finds projects to use new permission check 2023-11-07 15:28:39 +01:00
Klaus Zanders 93d6f2a7d7 Correctl use allowed_in_any_entity 2023-11-07 15:17:01 +01:00
Klaus Zanders 8951241c60 Add methods to ApplicationController to use new permission checks 2023-11-07 15:17:00 +01:00
Klaus Zanders 26cee2729e Fixes Performance/RegexpMatch offenses 2023-09-06 12:50:32 +02:00
Klaus Zanders 0c7fd939c8 Fixes Performance/MapCompact offenses 2023-09-06 11:06:36 +02:00
Christophe Bliard 52303a1fe9 [48451] Include default language in valid languages
https://community.openproject.org/wp/48451
2023-06-15 11:17:34 +02:00
Christophe Bliard 914272c6cf Only allow available languages for Setting.default_language
- Store the language information everywhere as string instead of symbol.
- Remove pt-BR from default available_languages as pt is already there.
2023-06-06 11:46:24 +02:00
Pavel Balashov d437ce3f32 [#47912] Create a way to trigger the set permissions command
https://community.openproject.org/work_packages/47912
2023-05-04 13:16:47 +02:00
Christophe Bliard 9edada09fd Fix tests 2023-02-06 09:30:33 +01:00
Christophe Bliard 78b3c94ecb Handle finer permissions for journals/diff endpoint
As description of both WorkPackage and Project journal can be diffed,
the needed permissions have to be distinct: view_project for Project
description diff, and view_work_packages for WorkPackage description
diff.
2023-02-06 09:30:32 +01:00
Christophe Bliard 21a696ef9b Update copyright information for 2023 2022-12-30 15:51:26 +01:00
Oliver Günther 7a5efe1e05 Add request tagging to rails and grape 2022-06-09 16:22:48 +02:00
Christophe Bliard 48a4f1b6ad lint with rubocop --autocorrect (safe cops only) 2022-06-02 10:40:10 +02:00