95 Commits

Author SHA1 Message Date
Klaus Zanders c52abc3bee Add uniqueness constraints to the database for models that have them in code 2026-01-05 11:29:43 +01:00
ulferts 52053c6971 encorporate dombesz proposals 2025-09-11 10:27:29 +02:00
ulferts 30fd5412fc enforce enumerations to be active if they are default 2025-09-11 09:30:50 +02: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
Pavel Balashou b78678c5ec Load STI models explicitly.
Due to STI nature it is required. Otherwise undesired behavior is possible
in dev and test environments(where usually lazy loading is enabled).
The udesired behavior can be like:
  Fetching not loaded yet STI model through its parent model
  (e.g. `User.find(service_account_id)` raises `ActiveRecord::NotFound`, because
  `ServiceAccount` has not been referenced yet.

`SubclassRegistry` has been removed, because:
1. `.register_subclasses` and `.registered_subclasses` produce unexpected results.
    ```ruby
      # e.g.: Principal -> User -> ServiceAccount
      Principal.register_subclass(User)

      # Then
      Principal.registered_subclasses == [User] # true
      User.registered_subclasses == [User] # true
      ServiceAccount.registered_subclasses == [User] # true
      # Having User as a subclass of User and ServiceAccount seems to be weird.
    ```

2. There seems to be no big win in have the additional list of subclasses that have to be manually filled.
3. Used in commit apprach seems to be simpler.
   It is just calling STI classes explicitly in to_prepare block of configuration.
2025-06-20 17:00:08 +02:00
Oliver Günther 7cfebcdb72 Remove subclass loading and use base controller 2025-02-25 20:12:01 +01:00
Oliver Günther 03a96eefb4 Primerize and separate enumerations 2025-02-25 20:12:00 +01:00
Klaus Zanders f1bb16afb4 implement form for time entry activities 2025-02-14 16:19:14 +01:00
Alexander Brandon Coles 1d707895c6 Grammar fixes in code, docs: possessive its/it's
- **it's** is a contraction of _it is_ or _it has_. It requires an
apostrophe.
- **its** is the posssive form of _it_, denoting ownership. It should
not use an apostrophe.
2025-02-12 06:36:46 -03:00
Klaus Zanders b91e2ebed5 remove default column and form field for enumerations of certain type 2025-01-28 17:41:27 +01:00
Oliver Günther d0ef27dcb6 Introduce registry to ensure we eager load all of them 2024-08-22 14:41:23 +02:00
Ivan Kuchin 4911b8a149 remove years from copyrights (except for COPYRIGHT file) 2024-07-31 15:02:49 +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
Christophe Bliard fb6c296428 Lift name length limit of some models
Role name being limited to 30 characters does not work anymore with some
translations of default seeded roles. Raising the limit to 256
characters like a lot of other models.
2023-05-16 15:08:28 +02:00
Christophe Bliard 96415fd16c Mark some belongs_to association as optional
The ones I could find while trying to cope with config.active_record.belongs_to_required_by_default = true to make tests pass, before finally giving up when I realized that Notification.journal cannot be nil, and be set in tests.
2023-03-15 08:53:10 +01: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
luz paz d0f3c4be7f Fix source typos
Follow-up to 300b2cff00
2022-04-19 07:50:33 -04: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 89cfee203f remove usage of require_dependency
according to the rails 6 migration guide, it should no longer be necessary: https://guides.rubyonrails.org/upgrading_ruby_on_rails.html#require-dependency
2022-01-07 14:46:21 +01:00
ulferts eae6749562 remove acts_as_customizable from enumerable 2021-11-02 22:04:15 +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 1bdd2ab9ae safe automatic fixes by rubocop (#8994) 2021-02-11 16:02:18 +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
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
Oliver Günther 18e4ed1a9a Change case insensitive validations to false 2020-03-11 11:32:53 +01:00
Henriette Dinger bd7f4e4814 Update copyright notice 2020-01-15 11:31:26 +01:00
Oliver Günther 33bc6466d5 Fix some sentry issues 2019-04-19 21:04:20 +02:00
Oliver Günther d4b20e6feb Fix check on new CF values
[ci skip]
2019-01-09 09:07:11 +01:00
Oliver Günther 730d610e39 Refactor priorities tables into cells 2018-05-11 15:36:30 +02:00
Oliver Günther 6ef4211e77 Bump copyright to 2018 (#6171)
[ci skip]
2018-02-12 08:51:12 +01:00
Oliver Günther 46fdced488 Fix removed methods from timelines helper 2018-01-17 17:23:56 +01:00
ulferts 9c8f7f3ca1 read operations for time_entries via api v3 (#5776)
* read operations for time_entries via api v3

Introduces the endpoints:
* GET /api/v3/time_entries
* GET /api/v3/time_entries/:id
* GET /api/v3/time_entries/activities/:id

The index action for time entries can be queried by the following
filters:
* project_id
* user_id
* work_package_id

The implementation is exposing the database structure mostly one to one
with the exception of some renaming and the hiding of the activities'
complexity, where only the activity used systemwide is referenced
regardless of whether a project specific override exists or not.

* allow custom values for time entries

[ci skip]
2017-08-09 10:24:16 +02:00
Oliver Günther 7cf11bb689 Update copyright notice 2017-01-10 15:11:43 +01:00
Mohamed Wael Khobalatte 972b04d86e Refactor to allow for strong params
We no longer need attr_accessible.
2015-10-23 14:33:55 +02:00
Alex Coles 5557f58e80 Migrate model scopes to use lambda/block
Signed-off-by: Alex Coles <alex@alexbcoles.com>
2015-06-30 12:12:55 +02:00
Alex Coles 064d66449a Migrate AR finder/query methods in models
Signed-off-by: Alex Coles <alex@alexbcoles.com>
2015-06-30 12:12:51 +02:00
Alex Coles df51b6ed99 Fix syntax (w/Rubocop) in (Rails) models
Signed-off-by: Alex Coles <alex@alexbcoles.com>
2015-06-30 12:08:28 +02:00
Alex Coles f968ecffe1 Merge branch 'dev' into feature/rails4
Signed-off-by: Alex Coles <alex@alexbcoles.com>
2015-06-03 17:42:39 +02:00
Jan Sandbrink 4a69d2505a replace ternaries returning booleans
- foo ? true : false was replaced where foo already was bool
- foo ? true : false was kept, when the ternary did a bool conversion
- foo ? false : true was replaced by either negation or replacing == with !=

Note: I intentionally left one occurence that is fixed in another running PR and would cause a conflict
2015-05-27 10:14:43 +02:00
Alex Coles e5da2578d5 Merge branch 'dev' into feature/rails4
Signed-off-by: Alex Coles <alex@alexbcoles.com>

Conflicts:
	.travis.yml
	Gemfile
	Gemfile.lock
	README.md
	app/assets/stylesheets/external.css.sass.erb
	app/assets/stylesheets/legacy/main.css.sass
	app/models/work_package.rb
	config/routes.rb
	lib/tabular_form_builder.rb
	spec/controllers/versions_controller_spec.rb
	spec/exemplars/type_exemplar.rb
	spec/factories/type_factory.rb
	spec/legacy/unit/default_data_spec.rb
	spec/legacy/unit/helpers/application_helper_spec.rb
	spec/legacy/unit/mail_handler_spec.rb
	spec/legacy/unit/project_spec.rb
	spec/legacy/unit/time_entry_activity_spec.rb
	spec/legacy/unit/type_spec.rb
	spec/models/work_package/work_package_validations_spec.rb
	spec/requests/api/v3/render_resource_spec.rb
	test/functional/types_controller_test.rb
	test/test_helper.rb
	test/unit/version_test.rb
2015-05-01 11:39:24 +02:00
Alex Coles e0191e759c Update year in copyright header to 2015
[ci skip]
2015-01-01 00:02:57 +00:00
Alex Coles 7635d8c814 Update Enumeration scopes to use callable object
Signed-off-by: Alex Coles <alex@alexbcoles.com>
2014-11-06 21:53:06 +01:00
Alex Coles 6fe9535b1f Fix syntax (w/Rubocop) in (Rails) models
Signed-off-by: Alex Coles <alex@alexbcoles.com>
2014-11-03 22:15:11 +01:00
Alex Coles 721101ed25 Use 1.9+ Hash syntax in (Rails) models
Signed-off-by: Alex Coles <alex@alexbcoles.com>
2014-11-03 22:15:11 +01:00
Alex Coles d872d91d0d Fix typos, spelling in model comments
Signed-off-by: Alex Coles <alex@alexbcoles.com>
2014-04-04 22:35:01 +02:00