Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] Ability to notify new replies even if the last post wasn't read #32

Open
oscarotero opened this issue Feb 16, 2021 · 1 comment

Comments

@oscarotero
Copy link

As I can see in this code: https://github.com/FriendsOfFlarum/follow-tags/blob/master/src/Jobs/SendNotificationWhenReplyIsPosted.php#L67 the email notification is sent only to users who view the last post of the discussion, right?

There are many users who read the replies in the email notification, so they don't enter in the forum and stop receiving more updates of the discussion.
I'd love to have an option in the plugin to change this behavior and send the emails to all subscribed users, no matter if they read the last post.

@xmarcux
Copy link

xmarcux commented Dec 1, 2022

I have made a hackish solution for notification mails even if user has not read the post.
User will receive mails for all replies on post even if post is not read if "Lurk" has been chosen for the tag.
I include a patch file if somebody else is interested:
obsess.txt

To run the patch file:

  • Have this extension installed
  • Go to root flarum directory
  • Run: patch -p0 <obsess.txt

What is changed is the sql that searches for users in file: SendNotificationWhenReplyIsPosted.php
on line: 62-74
The replacement sql is:

        $notify = User::select('users.*')
            ->where('users.id', '!=', $this->post->user_id)
            ->join('tag_user', 'tag_user.user_id', '=', 'users.id')
            ->whereIn('tag_user.tag_id', $tagIds->all())
            ->whereIn('tag_user.subscription', ['lurk'])
            ->get()
            ->reject(function (User $user) use ($tags) {
                return $tags->map->stateFor($user)->map->subscription->contains('ignore')
                    || !$this->post->isVisibleTo($user);
            });

It starts on this line:
https://github.com/FriendsOfFlarum/follow-tags/blob/master/src/Jobs/SendNotificationWhenReplyIsPosted.php#L62

As I am not a php developer I will not be able create a full change for this feature and add a merge request.
Hope this could be useful to somebody else.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants