Add modal to remove uri from Blocked list.
Issue 3800
This commit is contained in:
parent
44ae8a64cd
commit
be7eaff6f1
5 changed files with 69 additions and 2 deletions
|
@ -1257,5 +1257,7 @@
|
||||||
"Get notified when a publish or channel is confirmed.": "Get notified when a publish or channel is confirmed.",
|
"Get notified when a publish or channel is confirmed.": "Get notified when a publish or channel is confirmed.",
|
||||||
"Email Preferences": "Email Preferences",
|
"Email Preferences": "Email Preferences",
|
||||||
"Opt out of any topics you don't want to receive email about.": "Opt out of any topics you don't want to receive email about.",
|
"Opt out of any topics you don't want to receive email about.": "Opt out of any topics you don't want to receive email about.",
|
||||||
"Uncheck your email below if you want to stop receiving messages.": "Uncheck your email below if you want to stop receiving messages."
|
"Uncheck your email below if you want to stop receiving messages.": "Uncheck your email below if you want to stop receiving messages.",
|
||||||
|
"Remove from Blocked List": "Remove from Blocked List",
|
||||||
|
"Are you sure you want to remove this from the list?": "Are you sure you want to remove this from the list?"
|
||||||
}
|
}
|
|
@ -41,3 +41,4 @@ export const REPOST = 'repost';
|
||||||
export const SIGN_OUT = 'sign_out';
|
export const SIGN_OUT = 'sign_out';
|
||||||
export const LIQUIDATE_SUPPORTS = 'liquidate_supports';
|
export const LIQUIDATE_SUPPORTS = 'liquidate_supports';
|
||||||
export const CONFIRM_AGE = 'confirm_age';
|
export const CONFIRM_AGE = 'confirm_age';
|
||||||
|
export const REMOVE_BLOCKED = 'remove_blocked';
|
||||||
|
|
15
ui/modal/modalRemoveBlocked/index.js
Normal file
15
ui/modal/modalRemoveBlocked/index.js
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
import { connect } from 'react-redux';
|
||||||
|
import { doHideModal } from 'redux/actions/app';
|
||||||
|
import ModalRemoveBlocked from './view';
|
||||||
|
import { doToggleBlockChannel, selectBlockedChannels } from 'lbry-redux';
|
||||||
|
|
||||||
|
const select = (state, props) => ({
|
||||||
|
blockedChannels: selectBlockedChannels(state),
|
||||||
|
});
|
||||||
|
|
||||||
|
const perform = dispatch => ({
|
||||||
|
closeModal: () => dispatch(doHideModal()),
|
||||||
|
toggleBlockChannel: uri => dispatch(doToggleBlockChannel(uri)),
|
||||||
|
});
|
||||||
|
|
||||||
|
export default connect(select, perform)(ModalRemoveBlocked);
|
46
ui/modal/modalRemoveBlocked/view.jsx
Normal file
46
ui/modal/modalRemoveBlocked/view.jsx
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
// @flow
|
||||||
|
import React from 'react';
|
||||||
|
import { Modal } from 'modal/modal';
|
||||||
|
import I18nMessage from 'component/i18nMessage';
|
||||||
|
|
||||||
|
type Props = {
|
||||||
|
blockedUri: string,
|
||||||
|
closeModal: () => void,
|
||||||
|
blockedChannels: Array<string>,
|
||||||
|
toggleBlockChannel: (uri: string) => void,
|
||||||
|
};
|
||||||
|
|
||||||
|
function ModalRemoveBlocked(props: Props) {
|
||||||
|
const { blockedUri, closeModal, blockedChannels, toggleBlockChannel } = props;
|
||||||
|
|
||||||
|
function handleConfirm() {
|
||||||
|
if (blockedUri && blockedChannels.includes(blockedUri)) {
|
||||||
|
// DANGER: Always ensure the uri is actually in the list since we are using a
|
||||||
|
// toggle function. If 'null' is accidentally toggled INTO the list, the app
|
||||||
|
// won't start. Ideally, we should add a "removeBlockedChannel()", but with
|
||||||
|
// the gating above, it should be safe/good enough.
|
||||||
|
toggleBlockChannel(blockedUri);
|
||||||
|
}
|
||||||
|
|
||||||
|
closeModal();
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Modal
|
||||||
|
isOpen
|
||||||
|
type="confirm"
|
||||||
|
title={__('Remove from Blocked List')}
|
||||||
|
confirmButtonLabel={__('Remove')}
|
||||||
|
onConfirmed={handleConfirm}
|
||||||
|
onAborted={() => closeModal()}
|
||||||
|
>
|
||||||
|
<em>{blockedUri}</em>
|
||||||
|
<p />
|
||||||
|
<p>
|
||||||
|
<I18nMessage>Are you sure you want to remove this from the list?</I18nMessage>
|
||||||
|
</p>
|
||||||
|
</Modal>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default ModalRemoveBlocked;
|
|
@ -17,6 +17,7 @@ import ModalRevokeClaim from 'modal/modalRevokeClaim';
|
||||||
import ModalPhoneCollection from 'modal/modalPhoneCollection';
|
import ModalPhoneCollection from 'modal/modalPhoneCollection';
|
||||||
import ModalFirstSubscription from 'modal/modalFirstSubscription';
|
import ModalFirstSubscription from 'modal/modalFirstSubscription';
|
||||||
import ModalConfirmTransaction from 'modal/modalConfirmTransaction';
|
import ModalConfirmTransaction from 'modal/modalConfirmTransaction';
|
||||||
|
import ModalRemoveBlocked from 'modal/modalRemoveBlocked';
|
||||||
import ModalSocialShare from 'modal/modalSocialShare';
|
import ModalSocialShare from 'modal/modalSocialShare';
|
||||||
import ModalSendTip from 'modal/modalSendTip';
|
import ModalSendTip from 'modal/modalSendTip';
|
||||||
import ModalPublish from 'modal/modalPublish';
|
import ModalPublish from 'modal/modalPublish';
|
||||||
|
@ -140,6 +141,8 @@ function ModalRouter(props: Props) {
|
||||||
return <ModalFileSelection {...modalProps} />;
|
return <ModalFileSelection {...modalProps} />;
|
||||||
case MODALS.LIQUIDATE_SUPPORTS:
|
case MODALS.LIQUIDATE_SUPPORTS:
|
||||||
return <ModalSupportsLiquidate {...modalProps} />;
|
return <ModalSupportsLiquidate {...modalProps} />;
|
||||||
|
case MODALS.REMOVE_BLOCKED:
|
||||||
|
return <ModalRemoveBlocked {...modalProps} />;
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue