{master} blindfix for #3052 (can't reproduce)
This commit is contained in:
parent
8dad601b46
commit
7458b96907
|
@ -126,8 +126,14 @@ function renderLine(ctrl: Ctrl, line: Line) {
|
|||
]);
|
||||
var userNode = thunk('a', line.u, userLink, [line.u]);
|
||||
|
||||
return h('li', ctrl.moderation ? [
|
||||
lineAction(() => ctrl.moderation && line.u && ctrl.moderation.open(line.u.split(' ')[0])),
|
||||
return h('li', {
|
||||
hook: ctrl.moderation ? bind('click', (e: Event) => {
|
||||
const target = e.target as HTMLElement;
|
||||
if (ctrl.moderation && target.classList.contains('mod'))
|
||||
ctrl.moderation.open((target.getAttribute('data-username') as string).split(' ')[0]);
|
||||
}) : {}
|
||||
}, ctrl.moderation ? [
|
||||
line.u ? lineAction(line.u) : null,
|
||||
userNode,
|
||||
textNode
|
||||
] : [userNode, textNode]);
|
||||
|
|
|
@ -52,11 +52,11 @@ export function moderationCtrl(opts: ModerationOpts): ModerationCtrl {
|
|||
};
|
||||
}
|
||||
|
||||
export function lineAction(onClick: (e: Event) => void) {
|
||||
export function lineAction(username: string) {
|
||||
return h('i.mod', {
|
||||
hook: bind('click', onClick),
|
||||
attrs: {
|
||||
'data-icon': '',
|
||||
'data-username': username,
|
||||
title: 'Moderation'
|
||||
}
|
||||
});
|
||||
|
@ -65,10 +65,12 @@ export function lineAction(onClick: (e: Event) => void) {
|
|||
export function moderationView(ctrl?: ModerationCtrl): VNode[] | undefined {
|
||||
if (!ctrl) return;
|
||||
if (ctrl.loading()) return [h('div.loading', spinner())];
|
||||
var data = ctrl.data();
|
||||
const data = ctrl.data();
|
||||
if (!data) return;
|
||||
return [
|
||||
h('div.top', [
|
||||
h('div.top', {
|
||||
key: 'mod-' + data.id,
|
||||
}, [
|
||||
h('span.text', {
|
||||
attrs: {'data-icon': '' },
|
||||
}, [userLink(data.username)]),
|
||||
|
|
Loading…
Reference in a new issue