From 3c6eb37a1b25f454cd0edb19406e614be22d30fa Mon Sep 17 00:00:00 2001 From: Dessalines Date: Wed, 1 Jan 2020 22:09:07 -0500 Subject: [PATCH 1/2] Add are you sure dialogs to mod actions. - Fixes #386 --- ui/src/components/comment-node.tsx | 223 ++++++++++++++++++++--------- 1 file changed, 154 insertions(+), 69 deletions(-) diff --git a/ui/src/components/comment-node.tsx b/ui/src/components/comment-node.tsx index 34ec0dfb..b3ca682b 100644 --- a/ui/src/components/comment-node.tsx +++ b/ui/src/components/comment-node.tsx @@ -42,6 +42,8 @@ interface CommentNodeState { banType: BanType; showConfirmTransferSite: boolean; showConfirmTransferCommunity: boolean; + showConfirmAppointAsMod: boolean; + showConfirmAppointAsAdmin: boolean; collapsed: boolean; viewSource: boolean; } @@ -71,6 +73,8 @@ export class CommentNode extends Component { viewSource: false, showConfirmTransferSite: false, showConfirmTransferCommunity: false, + showConfirmAppointAsMod: false, + showConfirmAppointAsAdmin: false, }; constructor(props: any, context: any) { @@ -206,6 +210,18 @@ export class CommentNode extends Component { /> )}
    + {this.props.markable && ( +
  • + + {node.comment.read + ? i18n.t('mark_as_unread') + : i18n.t('mark_as_read')} + +
  • + )} {UserService.Instance.user && !this.props.viewOnly && ( <>
  • @@ -246,28 +262,51 @@ export class CommentNode extends Component {
  • )} +
  • +
  • + + # + +
  • +
  • + + # + +
  • {/* Admins and mods can remove comments */} {(this.canMod || this.canAdmin) && ( -
  • - {!node.comment.removed ? ( - - # - - ) : ( - - # - - )} -
  • + <> +
  • +
  • + {!node.comment.removed ? ( + + # + + ) : ( + + # + + )} +
  • + )} {/* Mods can ban from community, and appoint as mods to community */} {this.canMod && ( @@ -299,17 +338,43 @@ export class CommentNode extends Component { )} {!node.comment.banned_from_community && (
  • - - {this.isMod - ? i18n.t('remove_as_mod') - : i18n.t('appoint_as_mod')} - + {!this.state.showConfirmAppointAsMod ? ( + + {this.isMod + ? i18n.t('remove_as_mod') + : i18n.t('appoint_as_mod')} + + ) : ( + <> + + # + + + # + + + # + + + )}
  • )} @@ -381,14 +446,40 @@ export class CommentNode extends Component { )} {!node.comment.banned && (
  • - - {this.isAdmin - ? i18n.t('remove_as_admin') - : i18n.t('appoint_as_admin')} - + {!this.state.showConfirmAppointAsAdmin ? ( + + {this.isAdmin + ? i18n.t('remove_as_admin') + : i18n.t('appoint_as_admin')} + + ) : ( + <> + + # + + + # + + + # + + + )}
  • )} @@ -432,34 +523,6 @@ export class CommentNode extends Component { )} )} -
  • - - # - -
  • -
  • - - # - -
  • - {this.props.markable && ( -
  • - - {node.comment.read - ? i18n.t('mark_as_unread') - : i18n.t('mark_as_read')} - -
  • - )}
)} @@ -725,13 +788,13 @@ export class CommentNode extends Component { } handleModBanFromCommunityShow(i: CommentNode) { - i.state.showBanDialog = true; + i.state.showBanDialog = !i.state.showBanDialog; i.state.banType = BanType.Community; i.setState(i.state); } handleModBanShow(i: CommentNode) { - i.state.showBanDialog = true; + i.state.showBanDialog = !i.state.showBanDialog; i.state.banType = BanType.Site; i.setState(i.state); } @@ -784,6 +847,16 @@ export class CommentNode extends Component { i.setState(i.state); } + handleShowConfirmAppointAsMod(i: CommentNode) { + i.state.showConfirmAppointAsMod = true; + i.setState(i.state); + } + + handleCancelConfirmAppointAsMod(i: CommentNode) { + i.state.showConfirmAppointAsMod = false; + i.setState(i.state); + } + handleAddModToCommunity(i: CommentNode) { let form: AddModToCommunityForm = { user_id: i.props.node.comment.creator_id, @@ -791,6 +864,17 @@ export class CommentNode extends Component { added: !i.isMod, }; WebSocketService.Instance.addModToCommunity(form); + i.state.showConfirmAppointAsMod = false; + i.setState(i.state); + } + + handleShowConfirmAppointAsAdmin(i: CommentNode) { + i.state.showConfirmAppointAsAdmin = true; + i.setState(i.state); + } + + handleCancelConfirmAppointAsAdmin(i: CommentNode) { + i.state.showConfirmAppointAsAdmin = false; i.setState(i.state); } @@ -800,6 +884,7 @@ export class CommentNode extends Component { added: !i.isAdmin, }; WebSocketService.Instance.addAdmin(form); + i.state.showConfirmAppointAsAdmin = false; i.setState(i.state); } From a998bfc1f5cb881b2295e048ca9dd168082273d6 Mon Sep 17 00:00:00 2001 From: Dessalines Date: Wed, 1 Jan 2020 22:12:24 -0500 Subject: [PATCH 2/2] Version v0.5.13 --- docker/prod/docker-compose.yml | 2 +- server/src/version.rs | 2 +- ui/src/version.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docker/prod/docker-compose.yml b/docker/prod/docker-compose.yml index 9a0108b2..b8491b9a 100644 --- a/docker/prod/docker-compose.yml +++ b/docker/prod/docker-compose.yml @@ -11,7 +11,7 @@ services: - lemmy_db:/var/lib/postgresql/data restart: always lemmy: - image: dessalines/lemmy:v0.5.12 + image: dessalines/lemmy:v0.5.13 ports: - "127.0.0.1:8536:8536" restart: always diff --git a/server/src/version.rs b/server/src/version.rs index 6397f1a8..ed582e6f 100644 --- a/server/src/version.rs +++ b/server/src/version.rs @@ -1 +1 @@ -pub const VERSION: &'static str = "v0.5.12"; +pub const VERSION: &'static str = "v0.5.13"; diff --git a/ui/src/version.ts b/ui/src/version.ts index 4f406a8a..bacfecf2 100644 --- a/ui/src/version.ts +++ b/ui/src/version.ts @@ -1 +1 @@ -export let version: string = 'v0.5.12'; +export let version: string = 'v0.5.13';