PLT-5188: Reinstate delete option on system messages. (#5113)

* PLT-5188: Reinstate delete option on system messages.

* Fix styling.

* Fix empty hover box.
Этот коммит содержится в:
George Goldberg
2017-02-28 21:28:37 +00:00
коммит произвёл Harrison Healey
родитель 25b9b7d26b
Коммит 5a3bc43668
2 изменённых файлов: 48 добавлений и 31 удалений

Просмотреть файл

@@ -53,10 +53,8 @@ export default class PostInfo extends React.Component {
} }
createDropdown() { createDropdown() {
var post = this.props.post; const post = this.props.post;
const isSystemMessage = PostUtils.isSystemMessage(post);
this.canDelete = PostUtils.canDeletePost(post);
this.canEdit = PostUtils.canEditPost(post, this.editDisableAction);
if (post.state === Constants.POST_FAILED || post.state === Constants.POST_LOADING) { if (post.state === Constants.POST_FAILED || post.state === Constants.POST_LOADING) {
return ''; return '';
@@ -131,22 +129,24 @@ export default class PostInfo extends React.Component {
} }
} }
dropdownContents.push( if (!isSystemMessage) {
<li dropdownContents.push(
key='copyLink' <li
role='presentation' key='copyLink'
> role='presentation'
<a
href='#'
onClick={this.handlePermalink}
> >
<FormattedMessage <a
id='post_info.permalink' href='#'
defaultMessage='Permalink' onClick={this.handlePermalink}
/> >
</a> <FormattedMessage
</li> id='post_info.permalink'
); defaultMessage='Permalink'
/>
</a>
</li>
);
}
if (this.canDelete) { if (this.canDelete) {
dropdownContents.push( dropdownContents.push(
@@ -267,6 +267,9 @@ export default class PostInfo extends React.Component {
var commentCountText = this.props.commentCount; var commentCountText = this.props.commentCount;
const flagIcon = Constants.FLAG_ICON_SVG; const flagIcon = Constants.FLAG_ICON_SVG;
this.canDelete = PostUtils.canDeletePost(post);
this.canEdit = PostUtils.canEditPost(post, this.editDisableAction);
if (this.props.commentCount >= 1) { if (this.props.commentCount >= 1) {
showCommentClass = ' icon--show'; showCommentClass = ' icon--show';
} else { } else {
@@ -296,18 +299,21 @@ export default class PostInfo extends React.Component {
{this.createRemovePostButton()} {this.createRemovePostButton()}
</li> </li>
); );
} else if (!PostUtils.isSystemMessage(post)) { } else {
options = ( const dropdown = this.createDropdown();
<li className='col col__reply'> if (dropdown) {
<div options = (
className='dropdown' <li className='col col__reply'>
ref='dotMenu' <div
> className='dropdown'
{this.createDropdown()} ref='dotMenu'
</div> >
{comments} {dropdown}
</li> </div>
); {comments}
</li>
);
}
} }
let flag; let flag;

Просмотреть файл

@@ -518,6 +518,17 @@
position: relative; position: relative;
word-wrap: break-word; word-wrap: break-word;
&.post--system {
.post__header {
.col__reply {
min-width: 0;
}
.dropdown {
margin-right: 0;
}
}
}
&:hover { &:hover {
.dropdown, .dropdown,
.comment-icon__container, .comment-icon__container,