From: Dessalines Date: Thu, 29 Aug 2019 02:22:50 +0000 (-0700) Subject: Adding are you sure dialogs for transferring community and site. X-Git-Url: http://these/git/%7Bicon?a=commitdiff_plain;h=d8ad56c6472b8ce64e0aa3e03d3ec95f4a19a507;p=lemmy.git Adding are you sure dialogs for transferring community and site. - Fixes #241 --- diff --git a/ui/src/components/comment-node.tsx b/ui/src/components/comment-node.tsx index 785e3107..ef231d4b 100644 --- a/ui/src/components/comment-node.tsx +++ b/ui/src/components/comment-node.tsx @@ -22,6 +22,8 @@ interface CommentNodeState { banExpires: string; banType: BanType; collapsed: boolean; + showConfirmTransferSite: boolean; + showConfirmTransferCommunity: boolean; } interface CommentNodeProps { @@ -46,6 +48,8 @@ export class CommentNode extends Component { banExpires: null, banType: BanType.Community, collapsed: false, + showConfirmTransferSite: false, + showConfirmTransferCommunity: false, } constructor(props: any, context: any) { @@ -151,7 +155,14 @@ export class CommentNode extends Component { {/* Community creators can transfer community to another mod */} {this.amCommunityCreator && this.isMod &&
  • - # + {!this.state.showConfirmTransferCommunity ? + # + : <> + # + # + # + + }
  • } {/* Admins can ban from all, and appoint other admins */} @@ -175,7 +186,14 @@ export class CommentNode extends Component { {/* Site Creator can transfer to another admin */} {this.amSiteCreator && this.isAdmin &&
  • - # + {!this.state.showConfirmTransferSite ? + # + : <> + # + # + # + + }
  • } @@ -457,6 +475,16 @@ export class CommentNode extends Component { i.setState(i.state); } + handleShowConfirmTransferCommunity(i: CommentNode) { + i.state.showConfirmTransferCommunity = true; + i.setState(i.state); + } + + handleCancelShowConfirmTransferCommunity(i: CommentNode) { + i.state.showConfirmTransferCommunity = false; + i.setState(i.state); + } + handleTransferCommunity(i: CommentNode) { let form: TransferCommunityForm = { community_id: i.props.node.comment.community_id, @@ -466,6 +494,16 @@ export class CommentNode extends Component { i.setState(i.state); } + handleShowConfirmTransferSite(i: CommentNode) { + i.state.showConfirmTransferSite = true; + i.setState(i.state); + } + + handleCancelShowConfirmTransferSite(i: CommentNode) { + i.state.showConfirmTransferSite = false; + i.setState(i.state); + } + handleTransferSite(i: CommentNode) { let form: TransferSiteForm = { user_id: i.props.node.comment.creator_id, diff --git a/ui/src/translations/en.ts b/ui/src/translations/en.ts index 79249214..85b5cab3 100644 --- a/ui/src/translations/en.ts +++ b/ui/src/translations/en.ts @@ -133,6 +133,9 @@ export const en = { to: 'to', transfer_community: 'transfer community', transfer_site: 'transfer site', + are_you_sure: 'are you sure?', + yes: 'yes', + no: 'no', powered_by: 'Powered by', landing_0: 'Lemmy is a <1>link aggregator / reddit alternative, intended to work in the <2>fediverse.<3>It\'s self-hostable, has live-updating comment threads, and is tiny (<4>~80kB). Federation into the ActivityPub network is on the roadmap. <5>This is a <6>very early beta version, and a lot of features are currently broken or missing. <7>Suggest new features or report bugs <8>here.<9>Made with <10>Rust, <11>Actix, <12>Inferno, <13>Typescript.', not_logged_in: 'Not logged in.',