Skip to content

[feature] Improve inconsistent notification/draft behaviour flows #4333

@benfurber

Description

@benfurber

At the moment it's very easy to wrongly trigger notifications when you don't want them and to not send them when you do.

As an example, for news we do this during the create process:

...
    if (!news.isDraft) {
      notifyDiscord(
        news,
        profile,
        new URL(request.url).origin.replace('http:', 'https:'),
      )
    }
...

And there's no check during the updating of news, so if you make a draft and then want to publish/notify discord at a later date, the system won't do it for you.

The first option would be something like this. To add a check during update that looks for a change of isDraft. e.g.:

...
    if (Oldnews.isDraft & !news.isDraft) {
      notifyDiscord(
        news,
        profile,
        new URL(request.url).origin.replace('http:', 'https:'),
      )
    }
...

But this could add spamming potential, we only want discord notified once and for research updates we also only want notifications created for users once.

So a better approach would be a new field for news, questions, researchUpdates and projects called something like has_notified. And a new service that checks this field to decide whether or not to call discord and create notifications.

Showing this field to the content creator on the edit page would also enable easy E2E testing.

And in the future we could even allow users to decide when they want users to be notified.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    New / Under Discussion

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions