p2 breathe – orphan comment breaks theme
- Dominant language
- JavaScript
- Stars
- 338
- Forks
- 56
- Avg merge
- 24m
- Merged PRs (30d)
- 16
Description
The p2 breathe theme with o2 plugin stops functioning properly in this scenario:
An authorized user ‘y’ (level=editor) adds a new user ‘x’ (level=contributor).
User ‘x’ signs on
User ‘x’ replies with comment to posts by ‘y’
At this point, the theme works fine, everything is showing as expected.
Here’s where it breaks:
User ‘x’ is deleted using either:
– wp_delete_user($id, $reassign); …or…
– Dashboard==>Users==>Delete (including the dialog to reassign)
In either method, the user is successfully removed.
**BUT**, it’s the ‘orphaned’ comment record that is disrupting the theme, and at that point:
=>The POST button spins off ‘o2 app not found’ messages, and
=>The console shows ‘TypeError: jsonifiedModel.userLogin is null’ message spelled below.
If the orphaned comment record is deleted, the theme functions normally.
I have verified this is the case with a vanilla WordPress / p2-breathe / o2 instance. I can provide a link / signon to the vanilla P2 theme site.
The comments.user_id value retains the original user ‘x’ user_id after the user deletion.
If comments.user_id is changed to a live user_id, the problem goes away and the theme works normally.
**C O N S O L E :**
The errors (2) below appear in the console. For the first one, the userLogin value and length are present up to line 375, but something happens to the userLogin value in ‘jsonification’ (jsonifiedModel = this.model.toJSON();
TypeError: jsonifiedModel.userLogin is nullcomment.js:378:4
render https://go7c.net/c90/wp-content/plugins/o2-master/js/views/comment.js?ver=5.3.2:378
addOneCommentView https://go7c.net/c90/wp-content/plugins/o2-master/js/views/post.js?ver=5.3.2:759
Underscore 2
y
forEach
$/ https://go7c.net/c90/:855
jQuery 4
i
fireWith
ready
This error also appears in the console on POST button:
TypeError: o2.App is undefinednew-post.js:112:4
onSave https://go7c.net/c90/wp-content/plugins/o2-master/js/views/new-post.js?ver=5.3.2:112
onSave self-hosted:876
jQuery 2
dispatch
handle
Contributor guide
No contributing guide indexed for this repository
Research direction
Reproduce the user-deletion scenario with p2-breathe and o2, then inspect js/views/comment.js around line 378 and js/views/post.js around lines 548-759. Also check js/views/new-post.js around line 112 for the POST failure; done means orphaned comments no longer break comment rendering or posting.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100