Here to report a bug with missing notifications. Using phpBB 3.3.3 fresh install (no modifications, no other extensions) and the
latest master version of Post Love from Github (version 2.0.0-b3). Have done some testing and here's what I've found:
Description of bug & how to reproduce:
When a user likes a post, the author of that post receives a notification as usual. However, when that same user likes
another (different) post by the same author, the author of that post does NOT receive a notification for this like. The author is only notified of the first 'like' - the notification for the second 'like' is not generated in the
phpbb_notifications
table at all.
Possible explanation for this:
It seems that if a 'like' notification already exists from the liking user in the
phpbb_notifications
table, a second one is not generated by any subsequent like actions from the same user. I have proved this behaviour by taking the steps to reproduce as described above, and then deleting the notification row from
phpbb_notifications
for the first like, and then liking another post, and observing that a notification is then generated.
It seems then that if a notification already exists from the same user in that table, that a second notification will never be generated. Until the notification disappears naturally (as per the ACP setting for 'Read Notification Expiration' under 'Load settings'), or is deleted manually from the database (like in my test), a second notification will never appear for any other likes from that user.
Could this be related to the historically prevalent issues with duplicate notifications? Perhaps when these sorts of SQL errors were fixed, it only hid the problem, and the extension still has issues generating another notification when it thinks that a 'duplicate' exists? It seems that this same issue was
reported on Github back in 2015, and then apparently fixed in
version 1.0.2.137. But clearly as you can see from my tests, the issue still persists in the latest master (version 2.0.0-b3).
Any ideas lads? I've also
raised an issue on Github over here for anyone else tracking this bug.
Edit: Fixed!
As I suspected it seems that the original fix for this was overwritten at some point during development, so the old bug snuck back in.
I looked at what the original dev changed back in 2015 when he released version 1.0.2.137 and re-applied the changes to my current master version (2.0.0-b3) and now all the notifications are showing
For anyone wanting a find & replace solution here's how to do it:
In /ext/anavaro/postlove/notifications/postlove.php:
FIND:
Code: Select all
public static function get_item_id($data)
{
return (int) $data['requester_id'];
}
REPLACE WITH:
Code: Select all
public static function get_item_id($data)
{
return (int) $data['post_id'];
}
FIND:
Code: Select all
public static function get_item_parent_id($data)
{
return (int) $data['post_id'];
}
REPLACE WITH:
Code: Select all
public static function get_item_parent_id($data)
{
return (int) $data['requester_id'];
}
That fixes it.