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