ui: showSignInDialog if react when not loggedin

This commit is contained in:
undefined committed 2022-03-19 11:54:48 +08:00
1 parent fa554e58bf
commit d088227211
3 files changed
+11 -5

No files matched your search

@@ -6,6 +6,7 @@ import { Popover } from '@blueprintjs/core';
import { AutoloadPage } from 'vj/misc/Page';
import CommentBox from 'vj/components/discussion/CommentBox';
import { ConfirmDialog } from 'vj/components/dialog';
import Notification from 'vj/components/notification';
import delay from 'vj/utils/delay';
import { slideDown, slideUp } from 'vj/utils/slide';
@@ -254,10 +255,15 @@ const commentsPage = new AutoloadPage('commentsPage', () => {
$(document).on('click', '[data-op="delete"][data-type="comment"]', onCommentClickDeleteComment);
$(document).on('click', '[data-op="delete"][data-type="reply"]', onCommentClickDeleteReply);
const canUseReaction = $('[data-op="react"]').length > 0;
$('[data-op="react"]').each((i, e) => {
ReactDOM.render(<Reaction payload={$(e).data('form')} ele={$(e).closest('.media__body').find('.reactions')} />, e);
});
$(document).on('click', '.reaction', async (e) => {
if (!canUseReaction) {
(window as any).showSignInDialog();
return;
}
const target = $(e.currentTarget);
const res = await request.post('', {
operation: 'reaction',