Fixing inline videos in comments

This commit is contained in:
Daniela Narvaez 2021-01-26 16:50:44 -03:00 committed by Sean Yesmunt
parent 10a83bbfe9
commit 0a2f9fa0be
2 changed files with 15 additions and 2 deletions

View file

@ -13,6 +13,7 @@ import { doCommentAbandon, doCommentUpdate, doCommentPin, doCommentList } from '
import { doToggleBlockChannel } from 'redux/actions/blocked';
import { selectChannelIsBlocked } from 'redux/selectors/blocked';
import { doToast } from 'redux/actions/notifications';
import { doSetPlayingUri } from 'redux/actions/content';
import { selectUserVerifiedEmail } from 'redux/selectors/user';
import {
selectIsFetchingComments,
@ -41,6 +42,7 @@ const select = (state, props) => {
};
const perform = dispatch => ({
closeInlinePlayer: () => dispatch(doSetPlayingUri({ uri: null })),
resolveUri: uri => dispatch(doResolveUri(uri)),
updateComment: (commentId, comment) => dispatch(doCommentUpdate(commentId, comment)),
deleteComment: commentId => dispatch(doCommentAbandon(commentId)),

View file

@ -60,6 +60,7 @@ const ESCAPE_KEY = 27;
function Comment(props: Props) {
const {
closeInlinePlayer,
uri,
author,
authorUri,
@ -151,6 +152,16 @@ function Comment(props: Props) {
pinComment(commentId, remove).then(() => fetchComments(uri));
}
function handleEditComment() {
closeInlinePlayer();
setEditing(true);
}
function handleDeleteComment() {
closeInlinePlayer();
deleteComment(commentId);
}
function handleSubmit() {
updateComment(commentId, editedMessage);
setEditing(false);
@ -235,11 +246,11 @@ function Comment(props: Props) {
<MenuList className="menu__list--comments">
{commentIsMine ? (
<>
<MenuItem className="comment__menu-option menu__link" onSelect={() => setEditing(true)}>
<MenuItem className="comment__menu-option menu__link" onSelect={handleEditComment}>
<Icon aria-hidden icon={ICONS.EDIT} />
{__('Edit')}
</MenuItem>
<MenuItem className="comment__menu-option menu__link" onSelect={() => deleteComment(commentId)}>
<MenuItem className="comment__menu-option menu__link" onSelect={handleDeleteComment}>
<Icon aria-hidden icon={ICONS.DELETE} />
{__('Delete')}
</MenuItem>