Show unauthorized modal when clicking emoji button if unauthorized
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
parent
86fab1adf6
commit
9ac18e787f
1 changed files with 15 additions and 7 deletions
|
@ -83,10 +83,7 @@ const EmojiButtonWrapper: React.FC<IEmojiButtonWrapper> = ({ statusId, children
|
||||||
if (ownAccount) {
|
if (ownAccount) {
|
||||||
dispatch(simpleEmojiReact(status, emoji));
|
dispatch(simpleEmojiReact(status, emoji));
|
||||||
} else {
|
} else {
|
||||||
dispatch(openModal('UNAUTHORIZED', {
|
handleUnauthorized();
|
||||||
action: 'FAVOURITE',
|
|
||||||
ap_id: status.url,
|
|
||||||
}));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
setVisible(false);
|
setVisible(false);
|
||||||
|
@ -96,11 +93,15 @@ const EmojiButtonWrapper: React.FC<IEmojiButtonWrapper> = ({ statusId, children
|
||||||
const meEmojiReact = getReactForStatus(status, soapboxConfig.allowedEmoji) || '👍';
|
const meEmojiReact = getReactForStatus(status, soapboxConfig.allowedEmoji) || '👍';
|
||||||
|
|
||||||
if (isUserTouching()) {
|
if (isUserTouching()) {
|
||||||
|
if (ownAccount) {
|
||||||
if (visible) {
|
if (visible) {
|
||||||
handleReact(meEmojiReact);
|
handleReact(meEmojiReact);
|
||||||
} else {
|
} else {
|
||||||
setVisible(true);
|
setVisible(true);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
handleUnauthorized();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
handleReact(meEmojiReact);
|
handleReact(meEmojiReact);
|
||||||
}
|
}
|
||||||
|
@ -109,6 +110,13 @@ const EmojiButtonWrapper: React.FC<IEmojiButtonWrapper> = ({ statusId, children
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleUnauthorized = () => {
|
||||||
|
dispatch(openModal('UNAUTHORIZED', {
|
||||||
|
action: 'FAVOURITE',
|
||||||
|
ap_id: status.url,
|
||||||
|
}));
|
||||||
|
};
|
||||||
|
|
||||||
// const handleUnfocus: React.EventHandler<React.KeyboardEvent> = () => {
|
// const handleUnfocus: React.EventHandler<React.KeyboardEvent> = () => {
|
||||||
// setFocused(false);
|
// setFocused(false);
|
||||||
// };
|
// };
|
||||||
|
|
Loading…
Reference in a new issue