Opened 3 weeks ago
Last modified 11 days ago
#9305 new defect (bug)
'joined_group' activity item not removed when user leaves group or is removed from the group
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Awaiting Contributions | Priority: | normal |
Severity: | minor | Version: | 1.9 |
Component: | Groups | Keywords: | dev-feedback needs-patch |
Cc: | emaralive |
Description
There are a few issues when a user leaves a group and with their corresponding 'joined_group'
activity item:
1. When you join a group and leave the group, the 'joined_group' activity item is not removed
This was last touched in https://github.com/buddypress/buddypress/commit/8db16ebbcc4eb7cbf955d415635e4c6a00ebc1e1#diff-5e3670bc398e40e7b.
The issue is grabbing the group membership object after the user has been removed from the group: https://github.com/buddypress/buddypress/blob/8c0406454b260566fb17fc6cb21d755838eac675/src/bp-groups/bp-groups-activity.php#L903-L916, https://github.com/buddypress/buddypress/blob/8c0406454b260566fb17fc6cb21d755838eac675/src/bp-groups/bp-groups-functions.php#L638-L648.
This means that the 'date_modified'
property doesn't exist, which leads to the membership check failing and the activity deletion not occurring.
2. There is a five-minute conditional check to determine whether the 'joined_group' activity item should be removed or not
If a user has been a member of a group longer than five minutes and if that user is removed (whether by manually leaving or removed/banned by a group admin), the corresponding 'joined_group'
activity entry will not be deleted.
Before I work up a patch, I generally think that this 5-minute membership check is unnecessary. It was introduced way back in https://github.com/buddypress/buddypress/commit/bbad97385015a171c8c52cb788ced2c1705221fd#diff-6bc6696e8c90e746617fe12d44d16641280cccb4d292c2ed278c74dfaaaff345, so this is quite old, but I'd like to consider removing this membership time check.
According to the commit message, the time check was meant to be some form of activity flood protection, but wouldn't this type of functionality be best suited in a plugin? Thoughts?
Change History (5)
#3
@
2 weeks ago
I'm not sure that the joined group item should be deleted. Doesn't it kind of make sense like in Slack where you see the join activity and the leave activity for a channel? I get that if you only join the group mistakenly then leave almost immediately, that maybe it makes sense to remove the activity item. I only know how Slack handles this; what do the other big social networks do, like facebook?
#4
@
13 days ago
Forgot to CC myself to this ticket.
Meaning, the 5 minute rule is considered irrelevant?
Yes, the proposal would be to remove the 5-minute rule.
Doesn't it kind of make sense like in Slack where you see the join activity and the leave activity for a channel?
Currently, BP doesn't record when someone leaves a group into the group activity stream though.
I think your idea might make sense when a user manually leaves, but if a group admin is removing or banning the user from the group, the removed user's 'joined_group' activity item should be deleted from the group activity stream.
#5
@
11 days ago
- Keywords needs-patch added
- Milestone changed from Awaiting Review to Awaiting Contributions
In a way, deleting the "joined_group" activity item is an indirect way of indicating that someone has left a group (there is no record of joining). In essence, when someone joins a group the record is created and when someone leaves the group, the "joined_group" record is removed/deleted, for any of the 3 reasons.
Currently, group activity items may/can be removed/deleted, at will, by the group admin or mod. So, I'm not seeing much of any adverse effect by the proposal, well at least, not at the moment. Why don't we move forward and see what unintended consequences, if any, might arise from the proposal?
I'm not sure that I'm following this correctly, is the intent to delete/remove the 'joined_group' activity item when someone leaves the group, regardless of the 5 minute rule? Meaning, the 5 minute rule is considered irrelevant?