Project

General

Profile

Bug #15024

Erroneous social paper notifications

Added by Matt Gold about 2 months ago. Updated about 1 month ago.

Status:
Resolved
Priority name:
Normal
Assignee:
Category name:
Social Paper
Target version:
Start date:
2021-12-02
Due date:
% Done:

0%

Estimated time:

Description

Hi Boone -- I just received a bunch of notifications that social papers I'm not following have been updated. First, I doubt whether they have truly been updated, and Second, I know I'm not following them. Here is a sample notification:

The paper "Rhetorical Analysis of Mother Tongue" has been updated [CUNY Academic Commons]
Inbox

CUNY Academic Commons
11:52 AM (1 minute ago)
to me

The paper "Rhetorical Analysis of Mother Tongue" has been updated

Editor: Sajan Chokar (He/Him/His)
Visit the paper: https://commons.gc.cuny.edu/papers/rhetorical-analysis-of-mother-tongue/

You receieved this notification because you are following the paper "Rhetorical Analysis of Mother Tongue". To unfollow, visit https://commons.gc.cuny.edu/papers/rhetorical-analysis-of-mother-tongue/ and click the Unfollow button.


Related issues

Related to CUNY Academic Commons - Bug #15026: Email Notifications from Social PaperDuplicate2021-12-02

Related to CUNY Academic Commons - Bug #15029: Social papers with post passwords should not record 'new_cacsp_edit' activity itemsResolved2021-12-02

Has duplicate CUNY Academic Commons - Support #15025: emails for all the papers on the commons that have been changedDuplicate2021-12-02

History

#1 Updated by Boone Gorges about 2 months ago

  • Has duplicate Support #15025: emails for all the papers on the commons that have been changed added

#2 Updated by Boone Gorges about 2 months ago

  • Related to Bug #15026: Email Notifications from Social Paper added

#3 Updated by Boone Gorges about 2 months ago

I am getting them too.

For the time being, I've disabled mail from Social Paper.

I'll investigate to see why this might be happening.

#4 Updated by Boone Gorges about 2 months ago

  • Category name set to Social Paper
  • Assignee changed from Boone Gorges to Raymond Hoh

I've spent a few minutes looking into this.

- The papers in question are indeed being edited.
- This is triggering https://github.com/cuny-academic-commons/social-paper/blob/master/includes/hooks-buddypress-notifications.php#L405
- social-paper is fetching the "leader_id" of the paper in order to determine followers https://github.com/cuny-academic-commons/social-paper/blob/master/includes/hooks-buddypress-notifications.php#L416
- This checks the 'cacsp_activity_id' postmeta, but it's empty in the case of these paper objects, and the function doesn't appear to be able to create the activity item https://github.com/cuny-academic-commons/social-paper/blob/c6461a16713fe2956549552ea52ee45d814efe67/includes/hooks-buddypress-follow.php#L1047 As such, a NULL value is stored in the wp_1_postmeta table, and the 'leader_id' is null as well.
- The behavior of bp_follow_get_followers() is difficult to predict when leader_id is empty. In this case, it's pulling up ~975 users, which explains why so many got the email.

For the moment, I've commented out the call to wp_mail() in social-paper: https://github.com/cuny-academic-commons/social-paper/blob/master/includes/hooks-buddypress-notifications.php#L146

Ray, could you please investigate? At the very least, buddypress-followers should have a failsafe, such that when no leader_id is passed, no followers are returned. It may also be helpful to see why social-paper isn't properly generating the 'cacsp_activity_id' postmeta value, though given the status of social-paper, it's not worth sticking a lot of time into it.

#5 Updated by Raymond Hoh about 2 months ago

Thanks for the rundown, Boone.

I'm looking into this.

#6 Updated by Raymond Hoh about 2 months ago

  • Status changed from Assigned to Resolved
  • Target version set to 1.18.24

I've added a hotfix for buddypress-followers when passing a null value to either leader_id or follower_id during the fetch routine: https://github.com/cuny-academic-commons/cac/commit/f13b41a49484faa85ea9df863c5b860e83b15432. This is live on production.

As to why social-paper is saving the activity ID as a null value, the issue is the author added a password to the paper and bp_activity_post_type_publish() doesn't support activity recording for posts with passwords: https://github.com/buddypress/buddypress/blob/f71f78ae681068f932b7856ffe59c97ccaacb7bd/src/bp-activity/bp-activity-functions.php#L2157-L2159.

The hotfix I added should address this.

#7 Updated by Raymond Hoh about 2 months ago

  • Related to Bug #15029: Social papers with post passwords should not record 'new_cacsp_edit' activity items added

#8 Updated by Boone Gorges about 2 months ago

Thanks for the quick work on this, Ray!

#9 Updated by Matt Gold about 1 month ago

Thank you both so much!

Also available in: Atom PDF