mirror of
https://github.com/go-gitea/gitea
synced 2024-11-23 00:54:26 +01:00
Remove jQuery .attr
from the reaction selector (#30052)
- Switched from jQuery `attr` to plain javascript `getAttribute` - Tested the reaction selector and it works as before Signed-off-by: Yarden Shoham <git@yardenshoham.com>
This commit is contained in:
parent
428e05662f
commit
2e31a2800e
1 changed files with 3 additions and 3 deletions
|
@ -7,9 +7,9 @@ export function initCompReactionSelector($parent) {
|
|||
|
||||
if ($(this).hasClass('disabled')) return;
|
||||
|
||||
const actionUrl = $(this).closest('[data-action-url]').attr('data-action-url');
|
||||
const reactionContent = $(this).attr('data-reaction-content');
|
||||
const hasReacted = $(this).closest('.ui.segment.reactions').find(`a[data-reaction-content="${reactionContent}"]`).attr('data-has-reacted') === 'true';
|
||||
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 res = await POST(`${actionUrl}/${hasReacted ? 'unreact' : 'react'}`, {
|
||||
data: new URLSearchParams({content: reactionContent}),
|
||||
|
|
Loading…
Reference in a new issue