51 Commits

Author SHA1 Message Date
Jan Sandbrink f9d8bc6614 Introduce SubclassResponsibility error
This error is intended for cases when a method is
intentionally not implemented, because the module/class defining
it expects a subclass (or class including the module) to implement
the method.

This is intended to distinguish it from other cases, such as:
* feature not implemented yet
* edge case of a method call not yet supported

Notably it avoids the misuse of the Ruby-defined NotImplementedError,
which is only intended for much more specific scenarios:

> Raised when a feature is not implemented on the current platform. For example, methods depending on the fsync or fork system calls may raise this exception [...]

Also see https://docs.ruby-lang.org/en/master/NotImplementedError.html
2026-03-27 08:14:56 +01:00
Alexander Brandon Coles 03572f4444 Freeze string literals in app/workers
rubocop -A --only Style/FrozenStringLiteralComment,Layout/EmptyLineAfterMagicComment,Style/RedundantFreeze app/workers
2025-07-18 17:42:42 +01:00
Oliver Günther fbb54ba6f7 Ensure mailer jobs also have a priority 2025-01-28 12:46:19 +01:00
Kabiru Mwenja e4688ef6d9 Remove seemingly unneeded absolute namespacing 2024-12-19 13:26:15 +03:00
Kabiru Mwenja 1cf2bb4f17 Dispatch immediate email reminder based on user preference 2024-12-17 15:10:37 +03:00
ulferts 8937defc9c avoid naming conflicts on concurrency key 2024-10-22 16:41:59 +02:00
Christophe Bliard 49a74827ff [57932] Keep retrying mailer jobs for 1.5 days
https://community.openproject.org/wp/57932

Retrying 14 times with polynomial backoff means it will retry for
roughly 1.5 days.

Previously the `retry_on StandardError` defined in the
`Mails::MailerJob` class was ignored because there is also a
`rescue_from StandardError` declared after it. As `retry_on` is
implemented using `rescue_from`, and the handlers are evaluated in
reverse order, the last declared `rescue_from` would be picked up and
the retry logic would not be triggered. That's why mail jobs were
discarded instead of being retried.

This commit fixes the issue by inheriting directly from
`ActionMailer::MailDeliveryJob` instead of redefining its methods. This
was the `rescue_from` is declared first in the parent class, and then
`retry_on` is declared second in the child class, meaning it will take
precedence and be picked up.

The needed shared logic from `ApplicationJob` is extracted to a new
`SharedJobSetup` module and included in both `ApplicationJob` and
`Mails::MailerJob`.
2024-10-02 12:17:18 +02:00
Christophe Bliard 46120b6cd0 Make our MailerJob match Rails' MailDeliveryJob
We want `MailerJob` to behave like both our `ApplicationJob` (for
reloading the mailer configuration and resetting the request store
automatically) and `ActionMailer::MailDeliveryJob` (for the basic
functionalities of sending emails).

As we can only inherit from one of these two classes, we inherit from
`ApplicationJob` and copy the relevant parts from
`ActionMailer::MailDeliveryJob`.

This copy was done some time ago, and the `ActionMailer::MailDeliveryJob`
class has evolved since then. This commit updates our copy to match the
current `ActionMailer::MailDeliveryJob` class.
2024-10-01 14:58:17 +02:00
Ivan Kuchin 4911b8a149 remove years from copyrights (except for COPYRIGHT file) 2024-07-31 15:02:49 +02:00
Marcello Rocha 8c33cb59ef Adds a concurrency key to the jobs depending on the user_id 2024-05-27 11:24:07 +02:00
Marcello Rocha 36108c86c0 Apply @ulferts feedback 2024-05-27 11:24:07 +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
Dombi Attila ac98e83452 Fix typos 2024-02-01 14:23:27 +02:00
Dombi Attila 8ffa313bb8 Fix deprecation warnings 2024-02-01 14:22:06 +02: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
ulferts 84995eaf4f rename member "of" scopes 2023-11-20 18:40:42 +01:00
Aaron Contreras 29b7183192 Use COUNT(*) instead of COUNT(column_name)
Thanks Jens!
2023-10-16 14:31:17 -05:00
Aaron Contreras c1e79db06b Enqueue emails for Group shares 2023-10-16 09:47:00 -05:00
Aaron Contreras d3d39adc74 Create WorkPackageSharedJob to enqueue emails 2023-09-27 09:48:52 -05:00
Christophe Bliard 21a696ef9b Update copyright information for 2023 2022-12-30 15:51:26 +01:00
Dombi Attila bd9cb9ef67 Fix error on Mails::WatcherJob missing notification_settings 2022-09-26 17:07:06 +02:00
Christophe Bliard 48a4f1b6ad lint with rubocop --autocorrect (safe cops only) 2022-06-02 10:40:10 +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
Christophe Bliard ed3aa3f598 rename Mails::MemberRolesDiff as Members::RolesDiff
applicability is not only limited to emails, hence mving it to models makes more sense.
2022-02-07 11:26:12 +01:00
Christophe Bliard eea0240b5e fix test 2022-01-31 11:18:53 +01:00
Christophe Bliard 632e1f7ec3 Make rubocop happier
Remove the 'FactoryBot.'
2022-01-31 09:32:49 +01:00
Christophe Bliard 30efbe426d send emails when adding global role to a group
Also refactor the logic to decide if a 'membership created' or 'membership updated' email should be sent
2022-01-31 09:32:46 +01:00
ulferts ebc25fd7cc check visibility on notifications
For now, the implementation is work package specific
2021-11-04 13:55:19 +01:00
ulferts e07cb5f6c1 prevent being self notified on member manipulation 2021-10-05 17:33:10 +02:00
ulferts aff788bdf6 Merge remote-tracking branch 'origin/dev' into implementation/38884-notifications-send-out-mention-mail-on-mentioning 2021-10-01 11:39:21 +02:00
ulferts 672a5c79b6 consolidate work package mailing 2021-09-30 12:59:26 +02:00
Oliver Günther 5e8d9867c1 Remove all option in watcher job spec 2021-09-29 09:35:46 +02:00
Oliver Günther dc7b0ff99f Remove channel from member_job 2021-09-28 22:02:00 +02:00
Oliver Günther 528ca50faa Strip sent_mail into two columns mail_alert_sent and mail_reminder_sent 2021-09-28 22:01:59 +02:00
Oliver Günther 5b8df97498 Rename read_mail_digest into sent_mail and merge with non-wp items 2021-09-28 20:38:19 +02:00
Oliver Günther 202e2f31e6 Fix disabling of member notifications when setting is false 2021-09-27 10:55:27 +02:00
Oliver Günther 4ef23efb90 Fix check for disabling member updated notifications 2021-09-27 10:55:26 +02:00
Oliver Günther 612572190a Remove notified events 2021-09-27 10:55:26 +02:00
Wieland Lindenthal a701a6bdc2 Rename 'digest' to 'reminder', first chunk. Not touching Notification yet 2021-09-08 09:47:56 +02:00
Wieland Lindenthal 86427c2b78 Remove scheduling DigestJobs from WorkFlowJob 2021-09-08 09:47:55 +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 1f024e5796 remove no_self_notified user preference 2021-08-23 20:12:15 +02:00
ulferts 63ad2e8dd1 Generate IAN near real time (#9570)
* destroy notifications upon journal destruction

* breakup spec by journable

* have a dedicated job for scheduling journal completed events

* generate notifications in delayed job

* route wiki journal events through notifications

* combine mail sending for notifications into single job

* robustness if a journal is deleted

* linting

* differentiate BaseJournal and AssociatedJournal

BaseJournal holds the data of a journal that reflects the columns in the journaled model while AssociatedJournal reflects the columns of a model associated to the journaled model via a has_many/one association

* route news journal events through notifications

This does not yet include notifications for comments on news

* include news comment in notification workflow

* have the whole workflow in a single state machine job

* include forum message in notification workflow

* include document in notification workflow

* less dependencies from acts as watchable

* fix, test and document workflow job
2021-08-23 15:25:47 +02:00
ulferts 75bb809ad6 Feature/1899 send daily email summaries (#9430)
* email digests

* use time for notification digest setting

* safeguard against empty digest
2021-07-14 16:54:17 +02:00
Oliver Günther 9636a08988 [26688] In-app notifications (#9399)
* Add bell icon to icon font

* Add in app notification in top menu

* Add fullscreen modal

* Add notification modal and items

* Style items

* Toggle details of item

* Mark all read

* Add no results box

* wip specification for event api

* Add events table, query and index

* Send out events from WP notification mailer job

There we have the recipients present

* Add cleanup job for older events with a setting

* Hide bell notification when not logged

* Add specs for events API index/show

* Fix setting yml key

* remove pry in event creation

* Fix before hook in events API to after_validation

* Fix polymorphic association raising exception for aggregated journals

* Fix typo in read_ian

* Fix yml entry for mentioned

* Add read/unread post actions to event API and add specs

* Wire up API to frontend

* Fix order on events

* Switch to unread in notification

* Add event query

* rename WPEventService

* route wp mail sending over events

* rename spec methods

* author becomes watcher

* correct message call signature

* rename events to notifications

* renname parameter to reflect notification nature

* create author watcher for existing work packages

* Merge unreadCount from store

* Take a stab at polymorphic representers

* Fix link generation in polymorphic resources

For journals, no title is being generated however

* Fix frontend model for context

* Use timer for polling

* add notification_setting data layer

* Fix show resource spec

* Fix duplicate class in notification bell item

* Add minimal feature spec for notification

* API for notification settings

* Persist notifications

* adapt work package notification creation to notification settings

* extract notified_on_all

* consolidate wp#recipients

* concentrate wp notification in journal service

* simplify methods

* Remove unused patch endpoint

* Add specs for rendering and parsing notification settings

* Contract spec

* Update service spec

* adapt specs

* Angular notifications frontend

commit e29dced64699eb5f2443b9307c78343c9a58d1ee
Author: Wieland Lindenthal <w.lindenthal@forkmerge.com>
Date:   Mon Jun 21 17:34:50 2021 +0200

    Create Akita store and query for notification settings

commit 1a45c26c1a0c147d15393e49d2625aca4851a64d
Author: Wieland Lindenthal <w.lindenthal@forkmerge.com>
Date:   Mon Jun 21 11:09:25 2021 +0200

    Remove tabs from notificaition settings page

commit 0ea21e90c13a197f8bf2cfba1b60ddcff4e5e827
Author: Oliver Günther <mail@oliverguenther.de>
Date:   Sun Jun 20 21:55:48 2021 +0200

    WIP in app settings

* migrate notification data

* add project visible filter to project query

* Add inline-create and table display grouped by project

* Add notifications under admin/users

* Remove notifications partial

* Rename notififcations store to user preferences store

* Add setting for self_notified and hook that up to the backend

* Add aria-label to table checkboxes

* Restyle table and toolbar

* replace remains of mail_notifications attribute

* initialize notification settings for new user

* adapt my_preferences references

* reenable no self notified for documents

* adapt specs

* Avoid has_many :notifcation_settings

Rails magically autosaves the user's preferences when the user gets saved,
which somehow also tries to save the notfifications even when unchanged.

This breaks some specs such as the avatar upload spec. As we can't update the assocation
through rails anyway, just delegate to the user for reading instead.

* Restore update method of notification settings

* Restore update spec

* fix spec syntax

* lint scss

* linting

* Fix content_tag for bell icon

* Add feature specs for notification settings

* Disable ContentTag cop

* use visible filter to get projects for notification

The visible filter will reduce the project list down to the set of projects visible to the user provided as a parameter. This includes public projects.

* test for actual mail sending

* adapt me resource path

this.apiV3Service.users.me changed its type in 0d6c0b6bc7

* Implement changed migration

* Linting

* Add actor to notification representer

* Fix factory creating a duplicate WP journal

* Add work packages loading and journal details to notification entry component

* IAN basic facets, keep and expanded states.

* Fix notification bell spec

* Render body separately and add auto updating relative time

* Add fixedTime title

* Add actor to notification entry

* Fix clicking links on work package and project

* Tiny styling changes on entry row

* Disable count in notification if larger than 99 (wont fit)

* Introduce virtual scrolling to entry table

* allow delaying & prevent mail sending if ain read

Introduces a setting to delay mail sending after a journal aggregation time has expired. That way, users can confirm a notification in app. If they do before the delay expires, no mail is sent out additionally for that user.

* consolidate notifications (in&out) into shared admin menu

Co-authored-by: ulferts <jens.ulferts@googlemail.com>
Co-authored-by: Wieland Lindenthal <w.lindenthal@forkmerge.com>
2021-06-24 14:03:29 +02:00
ulferts 2a015eeac3 Feature/journal aggregation on write (#9396)
* aggregate journals on write - simple implementation

* remove references to aggregated journals on read

* rewrite existing journals to be aggregated

* remove aggregated journal reference

* only delete predecessor if it can be aggregated

* fix aggregation condition

* adapt specs

* remove aggregated journal functionality from production code

The code is still necessary in a migration for the time being

* adapt specs

* use polymorphic belongs_to for journal data

The association can then be employed for eager loading

* eager load for activity rendering
2021-06-17 20:08:58 +02:00
ulferts d1f419385f Feature/member custom notifications (#9173)
* include custom message in membership forms

* keep pristine params to be able to pass it to the state

* fix indentation on projects api docs

* pass grape instance around in default endpoints

The grape instance has readily available access to all the objects (params, current_user) so less individual parameters need to be passed. This also avoids having to store the grape endpoint in a potentials not thread safe variable

* send custom message out on membership creation

* send custom message on membership update

* send custom message even if setting disabled

* restore params interface

* add custom message description to schema

* describe notificationMessage in the api documentation

* extract meta payload functionality into mixin

* ensure password in spec meets requirements

* Update docs/api/apiv3/endpoints/members.apib

Co-authored-by: Oliver Günther <mail@oliverguenther.de>

* Update docs/api/apiv3/endpoints/members.apib

Co-authored-by: Oliver Günther <mail@oliverguenther.de>

* Update docs/api/apiv3/endpoints/members.apib

Co-authored-by: Oliver Günther <mail@oliverguenther.de>

* Update docs/api/apiv3/endpoints/members.apib

Co-authored-by: Oliver Günther <mail@oliverguenther.de>

* Update docs/api/apiv3/endpoints/members.apib

Co-authored-by: Oliver Günther <mail@oliverguenther.de>

Co-authored-by: Oliver Günther <mail@oliverguenther.de>
2021-04-26 16:26:04 +02:00