From e42110a3ba7212004d8c9d2467d44267671943ea Mon Sep 17 00:00:00 2001 From: Vyrtsev Mikhail Date: Thu, 17 Jan 2019 03:20:33 +0300 Subject: [PATCH 1/3] fix wrong label on voting buttons --- web/app/components/comment/comment.jsx | 1 + web/app/remark.js | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/web/app/components/comment/comment.jsx b/web/app/components/comment/comment.jsx index d59e0b70..92df6ff7 100644 --- a/web/app/components/comment/comment.jsx +++ b/web/app/components/comment/comment.jsx @@ -360,6 +360,7 @@ export default class Comment extends Component { * @return {(string|null)} */ getVoteDisabledReason() { + if (this.props.mods && this.props.mods.view === 'user') return 'Voting disabled in last comments'; if (this.isGuest()) return 'Only authorized users are allowed to vote'; const info = store.get('info'); if (info && info.read_only) return "You can't vote on read-only topics"; diff --git a/web/app/remark.js b/web/app/remark.js index 74f0a272..a4e7a751 100644 --- a/web/app/remark.js +++ b/web/app/remark.js @@ -49,7 +49,8 @@ function init() { isDefaultPicture: params.isDefaultPicture != 0, picture: params.picture, }; - store.set('user', user); + store.set('user', {}); + store.set('target-user', user); const onClose = () => { if (window.parent) { window.parent.postMessage(JSON.stringify({ isUserInfoShown: false }), '*'); From 00bf14863021a459685f3b451f78f4e2ed8e10a8 Mon Sep 17 00:00:00 2001 From: Vyrtsev Mikhail Date: Thu, 17 Jan 2019 04:14:06 +0300 Subject: [PATCH 2/3] restore comments controls in last comments --- web/app/components/user-info/user-info.jsx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/web/app/components/user-info/user-info.jsx b/web/app/components/user-info/user-info.jsx index 1b802858..e3b1ce30 100644 --- a/web/app/components/user-info/user-info.jsx +++ b/web/app/components/user-info/user-info.jsx @@ -2,6 +2,7 @@ import { h, Component } from 'preact'; import { connect } from 'preact-redux'; +import store from 'common/store'; import api from 'common/api'; import LastCommentsList from './last-comments-list'; import Avatar from 'components/avatar-icon'; @@ -21,6 +22,11 @@ class UserInfo extends Component { if (!comments && !isLoading) { fetchComments(id); + api + .getUser() + .then(data => store.set('user', data)) + .catch(() => store.set('user', {})); + api .getUserComments({ user: id, limit: 10 }) .then(({ comments }) => completeFetchComments(id, comments)) From ddd2c25498a37fe289830423c4c5c0403bfef399 Mon Sep 17 00:00:00 2001 From: Vyrtsev Mikhail Date: Thu, 17 Jan 2019 04:24:17 +0300 Subject: [PATCH 3/3] exclude pin/unpin from last comments comment controls --- web/app/components/comment/comment.jsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/web/app/components/comment/comment.jsx b/web/app/components/comment/comment.jsx index 92df6ff7..8dcc832e 100644 --- a/web/app/components/comment/comment.jsx +++ b/web/app/components/comment/comment.jsx @@ -622,9 +622,11 @@ export default class Comment extends Component { {isCopied && Copied!} - this.togglePin(pinned))} className="comment__control"> - {pinned ? 'Unpin' : 'Pin'} - + {mods.view !== 'user' && ( + this.togglePin(pinned))} className="comment__control"> + {pinned ? 'Unpin' : 'Pin'} + + )} {userBlocked && ( this.onUnblockUserClick())} className="comment__control">