fix(ui): allow unreacting from comment popover

- fix selectors for hasReacted
- don't send empty HTML on reaction errors
- add E2E test
This commit is contained in:
Solomon Victorino 2024-08-07 16:24:49 -06:00
parent 633406704c
commit b8a5ca2c40
3 changed files with 80 additions and 27 deletions

View file

@ -9,7 +9,7 @@ export function initCompReactionSelector($parent) {
const actionUrl = this.closest('[data-action-url]')?.getAttribute('data-action-url');
const reactionContent = this.getAttribute('data-reaction-content');
const hasReacted = this.closest('.ui.segment.reactions')?.querySelector(`a[data-reaction-content="${reactionContent}"]`)?.getAttribute('data-has-reacted') === 'true';
const hasReacted = this.closest('.comment')?.querySelector(`.ui.segment.reactions a[data-reaction-content="${reactionContent}"]`)?.getAttribute('data-has-reacted') === 'true';
const res = await POST(`${actionUrl}/${hasReacted ? 'unreact' : 'react'}`, {
data: new URLSearchParams({content: reactionContent}),