• Support
  • Subscription notifications not firing.

When a user subscribes to a thread and a new post is created, the users do not receive a notification.

I've been trying to debug this issue, and cannot understand how it works.

Within the SendReplyNotification it tries to find the subscribed users by the following query.

$notify = $discussion->readers()
            ->where('users.id', '!=', $post->user_id)
            ->where('discussion_user.subscription', 'follow')
            ->where('discussion_user.last_read_post_number', $this->lastPostNumber)
            ->get()
        ;

However to me there seems to be a flaw which should prevent this working at all.

The following condition in the query:

            ->where('discussion_user.last_read_post_number', $this->lastPostNumber)

This line says:

ONLY return the users which have READ the last post number

However, surely this should be the complete opposite? e.g.

->where('discussion_user.last_read_post_number', '<', $this->lastPostNumber)

So this would do

ONLY return the users which have READ replies OLDER than the latest post.

Right now the query is only dispatching notifications to the users who have already seen the latest reply.

Please advise?

Flarum information

Flarum core 1.3.0
PHP version: 8.1.5
MySQL version: 8.0.28
Loaded extensions: Core, date, libxml, openssl, pcre, sqlite3, zlib, bcmath, bz2, calendar, ctype, curl, dba, dom, hash, FFI, fileinfo, filter, ftp, gd, gettext, gmp, json, iconv, intl, SPL, ldap, mbstring, session, standard, odbc, pcntl, exif, mysqlnd, PDO, pdo_dblib, pdo_mysql, PDO_ODBC, pdo_pgsql, pdo_sqlite, pgsql, Phar, posix, pspell, readline, Reflection, mysqli, shmop, SimpleXML, soap, sockets, sodium, sysvmsg, sysvsem, sysvshm, tidy, tokenizer, xml, xmlreader, xmlwriter, xsl, zip, Zend OPcache
+----------------------+---------+--------+
| Flarum Extensions    |         |        |
+----------------------+---------+--------+
| ID                   | Version | Commit |
+----------------------+---------+--------+
| flarum-tags          | v1.3.0  |        |
| flarum-suspend       | v1.3.0  |        |
| flarum-subscriptions | v1.3.0  |        |
| flarum-sticky        | v1.3.0  |        |
| flarum-statistics    | v1.3.0  |        |
| flarum-nicknames     | v1.3.1  |        |
| flarum-mentions      | v1.3.0  |        |
| flarum-lock          | v1.3.0  |        |
| flarum-likes         | v1.3.0  |        |
| flarum-lang-english  | v1.3.0  |        |
| flarum-flags         | v1.3.0  |        |
+----------------------+---------+--------+
Base URL: http://xxx.localhost
Installation path: /Users/owen/Sites/xxx
Queue driver: redis
Mail driver: smtp
Debug mode: ON

    I see the fix is already merged. Are you planning to make a new minor update to Flarum soon or is that going to be postponed for 1.4?

      I believe the behaviour was always send notifications to subscribed users only if they are up to date on the thread. For instance, in v1 - 1.2 I know that our users would not receive notifications for the latest reply in a thread if they were subscribed to a tag (lurking) and had not read the latest reply. I suppose it is a mechanism to avoid spam, though in some cases we would like those notifications sent out to all subscribed users regardless if they're up to date. Is the reported issue different than what I've described?

      Yes, the behaviour you describe is how it always was. The bug completely prevented the reply notifications from being sent out at all. The fix that was merged and will be released as a patch restores the initial behaviour.

      luceos locked the discussion .