Project

General

Profile

Actions

Bug #15024

closed

Erroneous social paper notifications

Added by Matt Gold over 2 years ago. Updated over 2 years ago.

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

0%

Estimated time:
Deployment actions:

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

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

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

Actions
Actions #1

Updated by Boone Gorges over 2 years ago

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

Updated by Boone Gorges over 2 years ago

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

Updated by Boone Gorges over 2 years 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.

Actions #4

Updated by Boone Gorges over 2 years 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.

Actions #5

Updated by Raymond Hoh over 2 years ago

Thanks for the rundown, Boone.

I'm looking into this.

Actions #6

Updated by Raymond Hoh over 2 years 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.

Actions #7

Updated by Raymond Hoh over 2 years ago

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

Updated by Boone Gorges over 2 years ago

Thanks for the quick work on this, Ray!

Actions #9

Updated by Matt Gold over 2 years ago

Thank you both so much!

Actions

Also available in: Atom PDF