ui: fix comment action

This commit is contained in:
undefined committed 2022-02-09 15:41:23 +08:00
1 parent 25f1a4ce81
commit 5e4cdd3164
5 files changed
+13 -13

No files matched your search

@@ -66,8 +66,11 @@ const xss = new Xss.FilterXSS({
var: [], var: [],
video: ['autoplay', 'controls', 'loop', 'preload', 'src', 'height', 'width'], video: ['autoplay', 'controls', 'loop', 'preload', 'src', 'height', 'width'],
}, },
allowCommentTag: false,
stripIgnoreTagBody: ['script'],
safeAttrValue(tag, name, value) { safeAttrValue(tag, name, value) {
if (name === 'id') return `xss-id-${value}`; if (name === 'id') return `xss-id-${value}`;
if (name === 'class') return value.replace(/badge/g, 'xss-badge');
return value; return value;
}, },
}); });
@@ -64,9 +64,6 @@ $downvote-color = red
// FIXME doesn't work on IE 11 // FIXME doesn't work on IE 11
display: flex display: flex
>.media__body
width: calc(100% - (50px + 0.625rem))
&:last-child &:last-child
>.media >.media
padding-bottom: 0 padding-bottom: 0
@@ -111,6 +111,7 @@ async function onCommentClickReplyComment(ev, options: any = {}) {
} }
async function onCommentClickReplyReply(ev) { async function onCommentClickReplyReply(ev) {
console.log(ev);
const $evTarget = $(ev.currentTarget); const $evTarget = $(ev.currentTarget);
const $mediaBody = $evTarget.closest('.media__body'); const $mediaBody = $evTarget.closest('.media__body');
const uid = $mediaBody const uid = $mediaBody
@@ -119,7 +120,7 @@ async function onCommentClickReplyReply(ev) {
$evTarget $evTarget
.closest('.dczcomments__item') .closest('.dczcomments__item')
.find('[name="dczcomments__op-reply-comment"]').eq(0) .find('[data-op="reply"][data-type="comment"]').eq(0)
.trigger('click', { initialText: `@[](/user/${uid.trim()}) ` }); .trigger('click', { initialText: `@[](/user/${uid.trim()}) ` });
} }
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "@hydrooj/ui-default", "name": "@hydrooj/ui-default",
"version": "4.31.7", "version": "4.31.8",
"author": "undefined <i@undefined.moe>", "author": "undefined <i@undefined.moe>",
"license": "AGPL-3.0", "license": "AGPL-3.0",
"main": "hydro.js", "main": "hydro.js",
@@ -109,22 +109,21 @@
<div class="media__body top"> <div class="media__body top">
<div class="clearfix"> <div class="clearfix">
<div class="supplementary dczcomments__supplementary"> <div class="supplementary dczcomments__supplementary">
{{ user.render_inline(udoc) }} {{ user.render_inline(udoc) }} @ {{ datetimeSpan(doc._id)|safe }}
@ {{ datetimeSpan(doc._id)|safe }}
</div> </div>
<div class="dczcomments__operations nojs--hide"> <div class="dczcomments__operations nojs--hide">
{% if handler.user.hasPerm(reply_post_perm) %} {% if handler.user.hasPerm(reply_post_perm) %}
<a href="javascript:;" data-tooltip="{{ _('Reply') }}" name="dczcomments__op-reply-comment" <a href="javascript:;" data-tooltip="{{ _('Reply') }}" data-op="reply" data-type="comment"
data-form="{{ {operation: reply_post_op, psid: doc._id}|json }}" data-form="{{ {operation: reply_post_op, psid: doc._id}|json }}"
><span class="icon icon-reply"></span></a> ><span class="icon icon-reply"></span></a>
{% endif %} {% endif %}
{% if (handler.user.hasPerm(comment_edit_self_perm) and handler.user.own(doc)) or handler.user.hasPerm(comment_edit_perm) %} {% if (handler.user.hasPerm(comment_edit_self_perm) and handler.user.own(doc)) or handler.user.hasPerm(comment_edit_perm) %}
<a href="javascript:;" data-tooltip="{{ _('Edit') }}" name="dczcomments__op-edit-comment" <a href="javascript:;" data-tooltip="{{ _('Edit') }}" data-op="edit" data-type="comment"
data-form="{{ {operation: comment_edit_op, psid: doc._id}|json }}" data-form="{{ {operation: comment_edit_op, psid: doc._id}|json }}"
><span class="icon icon-edit"></span></a> ><span class="icon icon-edit"></span></a>
{% endif %} {% endif %}
{% if (handler.user.hasPerm(comment_delete_self_perm) and handler.user.own(doc)) or handler.user.hasPerm(comment_delete_perm) %} {% if (handler.user.hasPerm(comment_delete_self_perm) and handler.user.own(doc)) or handler.user.hasPerm(comment_delete_perm) %}
<a href="javascript:;" data-tooltip="{{ _('Delete') }}" name="dczcomments__op-delete-comment" <a href="javascript:;" data-tooltip="{{ _('Delete') }}" data-op="delete" data-type="comment"
data-form="{{ {operation: comment_delete_op, psid: doc._id}|json }}" data-form="{{ {operation: comment_delete_op, psid: doc._id}|json }}"
><span class="icon icon-delete"></span></a> ><span class="icon icon-delete"></span></a>
{% endif %} {% endif %}
@@ -146,15 +145,15 @@
</div> </div>
<div class="dczcomments__operations nojs--hide"> <div class="dczcomments__operations nojs--hide">
{% if handler.user.hasPerm(reply_post_perm) %} {% if handler.user.hasPerm(reply_post_perm) %}
<a href="javascript:;" data-tooltip="{{ _('Reply') }}" name="dczcomments__op-reply-reply"><span class="icon icon-reply"></span></a> <a href="javascript:;" data-tooltip="{{ _('Reply') }}" data-op="reply" data-type="reply"><span class="icon icon-reply"></span></a>
{% endif %} {% endif %}
{% if (handler.user.hasPerm(reply_edit_self_perm) and handler.user.own(doc)) or handler.user.hasPerm(reply_edit_perm) %} {% if (handler.user.hasPerm(reply_edit_self_perm) and handler.user.own(doc)) or handler.user.hasPerm(reply_edit_perm) %}
<a href="javascript:;" data-tooltip="{{ _('Edit') }}" name="dczcomments__op-edit-reply" <a href="javascript:;" data-tooltip="{{ _('Edit') }}" data-op="edit" data-type="reply"
data-form="{{ {operation: reply_edit_op, psid: doc._id, psrid: rdoc._id}|json }}" data-form="{{ {operation: reply_edit_op, psid: doc._id, psrid: rdoc._id}|json }}"
><span class="icon icon-edit"></span></a> ><span class="icon icon-edit"></span></a>
{% endif %} {% endif %}
{% if (handler.user.hasPerm(reply_delete_self_perm) and handler.user.own(doc)) or handler.user.hasPerm(reply_delete_perm) %} {% if (handler.user.hasPerm(reply_delete_self_perm) and handler.user.own(doc)) or handler.user.hasPerm(reply_delete_perm) %}
<a href="javascript:;" data-tooltip="{{ _('Delete') }}" name="dczcomments__op-delete-reply" <a href="javascript:;" data-tooltip="{{ _('Delete') }}" data-op="delete" data-type="reply"
data-form="{{ {operation: reply_delete_op, psid: doc._id, psrid: rdoc._id}|json }}" data-form="{{ {operation: reply_delete_op, psid: doc._id, psrid: rdoc._id}|json }}"
><span class="icon icon-delete"></span></a> ><span class="icon icon-delete"></span></a>
{% endif %} {% endif %}