139 Commits

Author SHA1 Message Date
Oliver Günther 4cc9faef4f Consistently use OpenProject::SqlSanitization instead of forwarding to sanitize_sql_array 2026-05-27 10:08:16 +02:00
Jan Sandbrink fa784d5f26 Consistently use Version.visible scope
Previously there was a separate permissions check for
/api/v3/versions/:id. This check at least looked like it was
inconsistent with the visible-scope.

Using the scope both for /api/v3/versions and /api/v3/versions/:id
ensures that both will return results consistent with each other.

As part of this change, the manage_versions permission was also added into
the Version.visible scope and the Version#visible? method, because it was missing so far
from those places.
2026-01-19 14:40:42 +01:00
Alexander Brandon Coles d17da65477 Freeze string literals in app/models
rubocop -A --only Style/FrozenStringLiteralComment,Layout/EmptyLineAfterMagicComment,Style/RedundantFreeze app/models
2025-07-22 18:26:13 +01:00
Klaus Zanders 0571f4beea Merge branch 'dev' into implementation/61533-extend-data-model-to-allow-logging-time-on-other-resources 2025-07-10 11:51:16 +02:00
Klaus Zanders d1a3243748 fix total spent hours query for version 2025-07-09 10:41:13 +02:00
Ivan Kuchin 352547cd85 [#59079] Remove deprecated ordering versions by semver_name
https://community.openproject.org/work_packages/59079
2025-07-08 19:32:48 +02:00
Dombi Attila a339dbc043 Add systemwide condition to Version#visible? 2025-07-03 16:30:24 +02:00
Dombi Attila 54189c925a [#62610] Version from the shared work package not available in Version filter on global wp page
https://community.openproject.org/work_packages/62610
2025-07-03 16:30:24 +02:00
Dombi Attila b4dff826b1 Unify the Version.visible scope to contain Version.systemwide too 2025-04-04 16:41:42 +03:00
Ivan Kuchin 223fd69ddc remove Version order_by_name scope 2024-10-28 15:18:06 +01:00
Ivan Kuchin 4911b8a149 remove years from copyrights (except for COPYRIGHT file) 2024-07-31 15:02:49 +02:00
Christophe Bliard f3c99ee5dd Comply with rubocop Style/StringLiterals enforcing double_quotes 2024-03-18 11:42:32 +01:00
Christophe Bliard 717a85a600 [30865] Show all work packages belonging to the version in status graph
In the graph widget, the default subprojectId filter is limiting the
work packages shown to the ones belonging to the version's project and
its subprojects. This is not always the desired behavior, especially
when the version is shared with other projects with 'hierarchy',
'tree', or 'system' sharing.

The fix opts for a projects filter including all visible projects for
the version when sharing is 'tree' or 'hierarchy' (which may have a
performance penalty when there are many projects), and a global scope
when sharing is 'system'.
2024-03-18 11:28:20 +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 61f273b10e Replace allowed_to? calls in models 2023-10-31 10:35:36 +01:00
Oliver Günther 6c59824379 [#48641] Automatic time tracking for work packages (start/stop buttons) (#12936)
* Add ongoing flag to time_entries

* Add timer button

* Save another timer automagically once starting a new one

* Add button_flex class to override the spot handling of buttons

* Add stop icon and use it

* Show the work package link when outside active timer work package

* Add hotwire partial in the account menu

* Add stimulus controller for timer in menu

* add the timer to the details view

* add a basic helper for the timer

* make the button inline-flex

* add a function to show elapsed time in ruby

* show timer on user menu

* add a bubble over avatar

* Implement timer icon and dropdown item in top menu

* Show a "start" button even if there is an active entry

* align items in timer menu entry

* remove stop icon

* add time tracking running icon

* add time tracking stop icon

* add time tracking start icon

* Add StopExistingTimer modal

* stop timer in user menu

* Start the next timer when saving the first one

* remove timer button from split view

* use new icons

* Hide button when no permission

* Don't save before showing edit modal for active timer

* Fix action when to cancel

* Use service method in account item

* Add spec

* Fix permission checks when user has only partial permissions

The time_entries API requires us to have log_own_time,
view_own_logged_time and edit_own_logged time to get the timer
functionality

Linting

* Allow users with only log_time to access their ongoing timers

* Fix setting new values on timer

* Allow deletion of time entry when ongoing

* Extend API docs on time entries

* remaining UI changes requested by Parimal

* Update frontend/src/stimulus/controllers/dynamic/my/timers.controller.ts

Co-authored-by: Dombi Attila <83396+dombesz@users.noreply.github.com>

* Update modules/costs/app/helpers/timer_helper.rb

Co-authored-by: Dombi Attila <83396+dombesz@users.noreply.github.com>

* Review feedback

* Show warning when timer was already stopped in other tab, and refresh before saving

* Remove TimerHelper

* Add spec to handle two parallel window timers

* Fix api spec

* Update frontend/src/app/features/work-packages/components/wp-timer-button/wp-timer-button.component.ts

* Update frontend/src/stimulus/controllers/dynamic/my/timers.controller.ts

* Simplify time formatter helper

* Use the formatElapsedTime helper in the MyTimersController as well

* Fix formatter using milliseconds

* Subscribe to initial reload

* Restrict ongoing scope to own timers

* Show warning in account timer component too

* Move timer into async again

* Correctly remove timer at all times

* Add dependency on view time entries when logging

* Linting

* Fix form link error after saving time entry

* Fix time entries spec

* Fix change detection on members

---------

Co-authored-by: bsatarnejad <b.satarnejad@gmail.com>
Co-authored-by: Dombi Attila <83396+dombesz@users.noreply.github.com>
2023-07-06 20:14:55 +02:00
Christophe Bliard 21a696ef9b Update copyright information for 2023 2022-12-30 15:51:26 +01:00
Christophe Bliard 48a4f1b6ad lint with rubocop --autocorrect (safe cops only) 2022-06-02 10:40:10 +02:00
Oliver Günther 3cc978598c Merge pull request #10349 from opf/feature/closure_tree_hierarchy
move wp hierarchy to closure_tree
2022-05-18 11:32:46 +02:00
ulferts 8d5b62b5cd remove behind_schedule methods since they are unused 2022-05-04 15:33:20 +02:00
ulferts 491928a3fd replace typed_dag with closure_tree and CTE 2022-03-29 12:02:55 +02:00
Christophe Bliard a33524ef6d remove ruby magic comment for utf-8
ruby interprets source encoding as utf-8 since 2.0.0, making magic comment redundant and useless
2022-03-10 19:36:58 +01:00
Christophe Bliard bc8d423ec2 update copyright information for 2022 2022-03-01 17:05:59 +01:00
ulferts f07bdc5078 extract version scopes 2021-10-29 15:48:17 +02:00
Oliver Günther ccfa29c728 Move license and copyright docs to root, fix names and references 2021-09-02 21:50:46 +02:00
ulferts cc4ed56e2a use AR`s scope method instead of singleton class method (#8976)
* use AR`s scope method instead of singleton class method

By using the scope method, all of Rails` checks and method definition usually done on a method are now also performed on the extracted scope methods

https://github.com/rails/rails/blob/5f3ff60084ab5d5921ca3499814e4697f8350ee7/activerecord/lib/active_record/scoping/named.rb#L154-L190

* turn scope classes into modules
2021-02-05 10:53:44 +01:00
ulferts 6140f4c7e9 update copyright to 2021 (#8925)
Updates the copyright to 2021 for all files that have a copyright. Files in our source code without the copyright header still do not receive one automatically. Additionally, backlisted files are also excluded.

Previously the copyright of chiliproject which references redmine stated a copyright of redmine up to and including 2017 which is not true for the code we have in here. Because of that I changed that to 2013
2021-01-13 17:47:45 +01:00
ulferts e2961fba14 replaces reform & custom error handling
Replaces reform by a simple layer of Disposable +
ActiveModel::Validations for contracts.

Additionally removes the custom error handling where OpenProject added
symbols to keep the ability to identify faulty attributes while having
non standard format (deviates from `%{attribute} %{message}`).

Changes to active record now allow us to define the format of a message
on i18n level, e.g. `%{message}`. Therefore the patching can be removed.

Reform plans to remove support for ActiveModel::Validations in version
4.0 at the latest but even today, support for it is hapazard. As we do
not need the full stack of Reform anyway, we can solely rely on
Disposable.
2020-08-25 12:58:37 +02:00
Markus Kahl 5e795a844a remove unnecessary redefinition of order_by_name scope 2020-08-11 09:40:15 +01:00
Oliver Günther 53f2d694ff Use AnyFixtures to generate fixtures from factories (#7230)
Uses FactoryBot to keep and maintain specific records in a special transaction that does not get removed after each spec.
They automatically are created whenever first hitting them.
This makes an excellent time saver for items that are commonly used, such as an admin user account
2020-04-09 11:54:26 +02:00
ulferts 0b15db3c9a rename fixed_version to version 2020-03-27 09:10:44 +01:00
ulferts c2b5d38b23 avoid eager loading magic 2020-03-24 23:17:29 +01:00
ulferts 95fd58cff7 replace order_by_date with order_by_semver_name 2020-03-24 23:17:27 +01:00
ulferts e7359bcd94 have scoped methods available in model class 2020-03-24 23:17:26 +01:00
ulferts 9fa02860f9 introduce semver name sorting scope 2020-03-24 23:17:14 +01:00
Oliver Günther 18e4ed1a9a Change case insensitive validations to false 2020-03-11 11:32:53 +01:00
Oliver Günther fa33b8c296 [32296] Also ensure versions are sorted by name
If versions are not sorted by date, the default work_packages.id sort
will break up grouped versions if they have no date.

https://community.openproject.com/wp/32296
2020-02-19 15:03:12 +01:00
Oliver Günther fa25c0ec21 Remove magic start_date applied to version, but not saved to DB
[ci skip]
2020-02-13 15:15:26 +01:00
Oliver Günther c18ae83b9e Sort versions in roadmap in the same fashion 2020-02-06 14:08:20 +01:00
Oliver Günther f4f1e98b20 [32156] Use backlogs sorting of versions date for work packages
- Adds a null_handling option to the property columns to allow `NULLS
FIRST/LAST` to be handled
- Adds a query specific SortCriteria that can work with null_handling
- Fixes sorting of allowed_versions to reuse that sort order

https://community.openproject.com/wp/32156
2020-02-05 08:12:22 +01:00
Henriette Dinger bd7f4e4814 Update copyright notice 2020-01-15 11:31:26 +01:00
ulferts c83ba63640 Revert revert unwanted in dev branch
This reverts commit b05a8f7b54.

The release/10 branch received a revert that was applied after changes
from dev unwillingly where merged into it. But when merging release/10.0
back into dev, that revert was also applied to dev where the changes are
indeed wanted. So we revert the revert for dev.
2019-09-20 08:36:05 +02:00
Oliver Günther b05a8f7b54 Revert "[31080] Trigger wpEvent after custom action" 2019-09-18 14:28:33 +02:00
ulferts e7263fcedb migrate to rails 6.0.0 2019-09-12 16:14:51 +02:00
ulferts 1850622f20 Feature/versions api update (#7299)
Feature/versions api update

[ci skip]
2019-05-22 10:29:06 +03:00
Oliver Günther 5de0b9a2d8 Go through brakeman warnings 2019-04-30 11:26:11 +02:00
Oliver Günther ae8db4011a Fix more deprecations 2018-12-05 18:52:54 +01:00
Oliver Günther 3807bc4f7f [28446] Rename due date to finish date
https://community.openproject.com/wp/28446
2018-09-10 15:12:14 +02:00
Jens Ulferts 0b7e192a5d adapt to changes to AR::Dirty 2018-03-05 15:43:37 +01:00
Jens Ulferts 486046681d replace deprecated references to attribute_was/changed 2018-03-05 15:43:35 +01:00