45 Commits

Author SHA1 Message Date
Mir Bhatia 3178db63dd Update delete contract to use same error messages 2025-09-16 17:06:21 +02:00
Mir Bhatia ef5150649a Add checks for update and delete actions 2025-09-16 17:06:20 +02:00
Mir Bhatia d9bbc37e96 Add validation for 'to' work package 2025-09-16 17:06:20 +02:00
Alexander Brandon Coles 0091ee164d Freeze string literals in app/contracts
rubocop -A --only Style/FrozenStringLiteralComment,Layout/EmptyLineAfterMagicComment,Style/RedundantFreeze app/contracts
2025-07-18 17:51:41 +01:00
Henriette Darge be18ff082a Code improvements 2025-02-14 08:06:57 +01:00
ulferts e41058ed04 use _id where appropriate to fix specs 2025-02-13 12:53:36 +01:00
Henriette Darge 7a243a54cf Show error messages for both from_id and to_id fields in the relations dialog 2025-02-13 12:53:27 +01:00
Henriette Darge 153fff72e7 Show a form error when there is no WP selected before adding a relation via modal 2025-02-13 12:53:05 +01:00
Ivan Kuchin 4911b8a149 remove years from copyrights (except for COPYRIGHT file) 2024-07-31 15:02:49 +02:00
Oliver Günther e3e8d78972 Rename delay to lag
https://community.openproject.org/work_packages/44054
2024-04-08 19:31:38 +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
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 5b7cb792df Check :manage_work_package_relations permission on the work package 2023-11-27 10:23:10 +01:00
Klaus Zanders 8931c063cf Update allowed_to calls in contracts 2023-10-27 11:32:41 +02:00
ulferts b1d3ddf0d7 remove triggering of before_validation callback 2023-10-24 11:53:14 +02:00
ulferts 02d3135d5b avoid unnecessary db call 2023-10-24 09:09:58 +02:00
ulferts 4c2d9f9b24 add specs for relation contract 2023-10-20 16:34:22 +02:00
ulferts 322af4b738 fix reversing the relation if necessary before validation 2023-10-19 20:09:24 +02:00
Christophe Bliard 21a696ef9b Update copyright information for 2023 2022-12-30 15:51:26 +01: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
Oliver Günther ccfa29c728 Move license and copyright docs to root, fix names and references 2021-09-02 21:50:46 +02: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
Henriette Dinger bd7f4e4814 Update copyright notice 2020-01-15 11:31:26 +01:00
ulferts 481fe5b291 use default end points for most of the relations api 2019-12-11 10:19:39 +01:00
Oliver Günther aa9897561b [28455] Ensure model contracts are initiaited immediately before saving 2018-09-05 21:03:28 +02:00
Jens Ulferts 61dddffc15 move relation_type validation to contract 2018-03-05 15:43:35 +01:00
Oliver Günther 6ef4211e77 Bump copyright to 2018 (#6171)
[ci skip]
2018-02-12 08:51:12 +01:00
ulferts 09751f9f25 allow relations to be altered and also inverted (#6120)
[ci skip]
2018-01-18 14:49:09 +01:00
ulferts bf28dfb830 tweak circular dependency detection when siblings already have a follows relation (#6107)
Instead of going to root, we now only go up till to's first ancestor not shared with from. That way, we avoid wrongfully detecting transitive follows + hierarchy relations from to's root pointing to from.

[ci skip]
2018-01-10 08:42:37 +01:00
Jens Ulferts a4af690d0e more leniency with existing follows relations 2017-12-20 15:16:06 +01:00
ulferts 0c8ec533c0 allow creating follows relations among siblings (#6093)
[ci skip]
2017-12-19 11:57:13 +01:00
ulferts 634f45d6fc prevent circular scheduling relationship (#6062)
[ci skip]
2017-12-13 14:38:35 +01:00
Jens Ulferts 763a154eb8 actually execute validations 2017-11-30 13:25:04 +01:00
Jens Ulferts d2fe896b88 fix error localization in relations
For reasons beyond me, using

validated :to do
  add an error
end

seems to be execute in a different context (class) than

attribute :to do
  add an error
end

The later, has the correct i18n_scope set as it is a child of
::ModelContract.
2017-11-30 10:12:40 +01:00
ulferts 0c0b16508b Fix/bump representable (#5465)
* bump reform and roar -> bumps representer

* adapt to changed validation interface

* disable initializer patch for now

* adapt to changed representable attr interface

* can no longer have private methods inside a representer

* private no longer possible for representer

* bump reform

* wip - restyle validation

* remove commented out patch

* apply injection as prescribed

* reactivate reform error symbols patch

* remove patch to Hash superfluous wit ruby 2.3

* remove outdated human_attribute_name patch

* whitespace fixes

* adapt filter name after removal of human_attribute_name patch

* adapt filter specs to no longer rely on human_attribute_name patch

* fix version filter name

* remove reliance on no longer existing human_attribute_name patch

* use correct key in journal formatter

* remove private from representer

* adapt to altered setter interface

* reenable i18n for error messages in contracts

* no private methods in representer

* defined model for contracts

* fix validaton

* instantiate correct Object

* define model for contract

* circumvent now existing render method on reform

* replace deprecated constant

* patch correct reform class - not the module - via prepend

* refactor too complex method

* replace deprations

* remove remnants of parentId

* prevent error symbols from existing twice

* adapt user representer to altered setter interface

* adapt watcher representer to altered setter interface

* remove now unnessary patch

* adapt setter to altered interface

* adapt spec

* fix custom field setters

* remove parentId from wp representer

As the parent is a wp resource, clients should use the parent link instead

* adapt spec to changed valid? interface

* remove parentId from wp schema

* replace references of parentId in frontend

* remove TODO

[ci skip]
2017-06-02 09:10:51 +02:00
Oliver Günther 7cf11bb689 Update copyright notice 2017-01-10 15:11:43 +01:00
Markus Kahl 6b84e9788c fixed the relations contract which was sabotaged by delayed_job 2016-11-01 11:52:24 +01:00
Markus Kahl 6f91bd09b1 code climate 2016-10-20 15:06:28 +01:00
Markus Kahl cdf472d9ba more specs e.g. for validations including permissions 2016-10-20 10:41:19 +01:00
Markus Kahl 7f6d74a88e basic crud 2016-10-20 10:41:19 +01:00