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

Notification sent multiple times/for each followed tag #80

Open
mfuerni opened this issue Dec 28, 2024 · 0 comments
Open

Notification sent multiple times/for each followed tag #80

mfuerni opened this issue Dec 28, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@mfuerni
Copy link

mfuerni commented Dec 28, 2024

Bug Report

Current Behavior
If someone posts to a discussion that is assigned to multiple tags, users that follow multiple of those tags, get the notification multiple times. This even applies if a discussion is assigned to a single tag that has a parent tag, since flarum assigns the parent and the child tag individually to the discussion.

Steps to Reproduce

  1. Create a main tag and a sub tag, where the main tag is the parent of the sub tag.
  2. Follow/lurk both tags, the main tag and the sub tag.
  3. As another user, create a new discussion with the sub tag assigned, or reply to such a discussion.
  4. The first user receives two emails with exactly the same content.

Expected Behavior
Per post only a single notification should be sent.

Environment

  • Flarum version: 1.8.9
  • Extension version: 1.2.7
Flarum core: 1.8.9
PHP version: 8.3.15
MySQL version: 10.5.26-MariaDB-0+deb11u2
Loaded extensions: Core, date, libxml, openssl, pcre, zlib, filter, hash, json, pcntl, random, Reflection, SPL, session, standard, sodium, mysqlnd, PDO, xml, calendar, ctype, curl, dom, mbstring, FFI, fileinfo, ftp, gd, gettext, iconv, imagick, exif, mysqli, pdo_mysql, Phar, posix, readline, shmop, SimpleXML, sockets, sysvmsg, sysvsem, sysvshm, tokenizer, xmlreader, xmlwriter, xsl, zip, Zend OPcache, xdebug
+--------------------------+---------+--------+
| Flarum Extensions        |         |        |
+--------------------------+---------+--------+
| ID                       | Version | Commit |
+--------------------------+---------+--------+
| flarum-flags             | v1.8.2  |        |
| flarum-tags              | v1.8.3  |        |
| flarum-approval          | v1.8.2  |        |
| flarum-mentions          | v1.8.5  |        |
| flarum-subscriptions     | v1.8.1  |        |
| fof-follow-tags          | 1.2.7   |        |
| flarum-suspend           | v1.8.4  |        |
| flarum-sticky            | v1.8.2  |        |
| flarum-statistics        | v1.8.1  |        |
| flarum-markdown          | v1.8.1  |        |
| flarum-lock              | v1.8.2  |        |
| flarum-likes             | v1.8.1  |        |
| flarum-lang-english      | v1.8.0  |        |
| flarum-extension-manager | v1.0.6  |        |
| flarum-emoji             | v1.8.1  |        |
| flarum-bbcode            | v1.8.0  |        |
| askvortsov-categories    | v3.1.0  |        |
+--------------------------+---------+--------+
Base URL: http://localhost:80
Installation path: /mnt/t/flarumTest
Queue driver: sync
Session driver: file
Mail driver: smtp
Debug mode: off

Possible solution(s)
The database queries in src/Jobs/SendNotificationWhen...*.php should add a distinct-filter. Currently, users appear multiple times because of the join with tag_user. I'm not confident with Eloquent, so I leave the coding to others.

Relevant lines:

$notify = User::select('users.*')

$notify = User::select('users.*')

$notify = $this->post->discussion->readers()

@mfuerni mfuerni added the bug Something isn't working label Dec 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant