Both models are only supposed to be visible
to users that have some basic permissions in at least
one project. While the desired scoping is not very fine grained
(you either see all or nothing), it still makes sense for all
models to have such a scope for consistency purposes.
This means if there were other (non-subject) keys in the patterns,
we'd not inadvertently overwrite them.
This includes a change to the Patterns::Collection:
* The subject pattern is now considered optional
* This is in line with most code ignoring it if it's disabled anyways,
there was never a strong expectation to always have a subject pattern
* The patterns-collection itself will now always be present on a type, it will
never be nil (but it can be empty)
The latter change means that we can get rid of some nil-checks, and thus we don't
need to differentiate between "create" cases (when there are no patterns yet) and
"update" cases (there are patterns and we change them). Everything is an update to
the patterns.
This is consistent with other enumerable relations and attributes attached to a
record. E.g. one wouldn't perform a nil-check on a has_many relation.
This also means that invalid assignments, such as
type.patterns = "Bob"
will now not set patterns to nil, but to the null object (an empty collection)
as well.
This ensures that the method is only used in contexts where we know
for which attribute we expect a replacement pattern to be defined.
This change makes errors less likely where one would expect that
all replacement patterns are defined for subjects (which is the status
quo as implemented, but not as designed).
Also all code that I've seen so far that calls this method, needed to
validate the subject attribute separately afterwards. This change should
make such code shorter.
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.
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
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
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.
When switching the type, the status is not validated in the target type,
resulting in a correctly saved work package whose status can no longer
be changed.
https://community.openproject.com/wp/27780