Fix post listing mod actions. Fixes #58

This commit is contained in:
Dessalines 2020-10-13 15:12:40 -05:00
parent 498a5a64f1
commit 52b5d32fde

View file

@ -749,53 +749,53 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
{/* Mods can ban from community, and appoint as mods to community */} {/* Mods can ban from community, and appoint as mods to community */}
{(this.canMod || this.canAdmin) && {(this.canMod || this.canAdmin) &&
(!post.removed ? ( (!post.removed ? (
<span <button
class="pointer" class="btn btn-link btn-animate text-muted py-0"
onClick={linkEvent(this, this.handleModRemoveShow)} onClick={linkEvent(this, this.handleModRemoveShow)}
> >
{i18n.t('remove')} {i18n.t('remove')}
</span> </button>
) : ( ) : (
<span <button
class="pointer" class="btn btn-link btn-animate text-muted py-0"
onClick={linkEvent(this, this.handleModRemoveSubmit)} onClick={linkEvent(this, this.handleModRemoveSubmit)}
> >
{i18n.t('restore')} {i18n.t('restore')}
</span> </button>
))} ))}
{this.canMod && ( {this.canMod && (
<> <>
{!this.isMod && {!this.isMod &&
(!post.banned_from_community ? ( (!post.banned_from_community ? (
<span <button
class="pointer" class="btn btn-link btn-animate text-muted py-0"
onClick={linkEvent( onClick={linkEvent(
this, this,
this.handleModBanFromCommunityShow this.handleModBanFromCommunityShow
)} )}
> >
{i18n.t('ban')} {i18n.t('ban')}
</span> </button>
) : ( ) : (
<span <button
class="pointer" class="btn btn-link btn-animate text-muted py-0"
onClick={linkEvent( onClick={linkEvent(
this, this,
this.handleModBanFromCommunitySubmit this.handleModBanFromCommunitySubmit
)} )}
> >
{i18n.t('unban')} {i18n.t('unban')}
</span> </button>
))} ))}
{!post.banned_from_community && post.creator_local && ( {!post.banned_from_community && post.creator_local && (
<span <button
class="pointer" class="btn btn-link btn-animate text-muted py-0"
onClick={linkEvent(this, this.handleAddModToCommunity)} onClick={linkEvent(this, this.handleAddModToCommunity)}
> >
{this.isMod {this.isMod
? i18n.t('remove_as_mod') ? i18n.t('remove_as_mod')
: i18n.t('appoint_as_mod')} : i18n.t('appoint_as_mod')}
</span> </button>
)} )}
</> </>
)} )}
@ -804,35 +804,35 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
this.isMod && this.isMod &&
post.creator_local && post.creator_local &&
(!this.state.showConfirmTransferCommunity ? ( (!this.state.showConfirmTransferCommunity ? (
<span <button
class="pointer" class="btn btn-link btn-animate text-muted py-0"
onClick={linkEvent( onClick={linkEvent(
this, this,
this.handleShowConfirmTransferCommunity this.handleShowConfirmTransferCommunity
)} )}
> >
{i18n.t('transfer_community')} {i18n.t('transfer_community')}
</span> </button>
) : ( ) : (
<> <>
<span class="d-inline-block mr-1"> <button class="d-inline-block mr-1 btn btn-link btn-animate text-muted py-0">
{i18n.t('are_you_sure')} {i18n.t('are_you_sure')}
</span> </button>
<span <button
class="pointer d-inline-block mr-1" class="btn btn-link btn-animate text-muted py-0 d-inline-block mr-1"
onClick={linkEvent(this, this.handleTransferCommunity)} onClick={linkEvent(this, this.handleTransferCommunity)}
> >
{i18n.t('yes')} {i18n.t('yes')}
</span> </button>
<span <button
class="pointer d-inline-block" class="btn btn-link btn-animate text-muted py-0 d-inline-block"
onClick={linkEvent( onClick={linkEvent(
this, this,
this.handleCancelShowConfirmTransferCommunity this.handleCancelShowConfirmTransferCommunity
)} )}
> >
{i18n.t('no')} {i18n.t('no')}
</span> </button>
</> </>
))} ))}
{/* Admins can ban from all, and appoint other admins */} {/* Admins can ban from all, and appoint other admins */}
@ -840,29 +840,29 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
<> <>
{!this.isAdmin && {!this.isAdmin &&
(!post.banned ? ( (!post.banned ? (
<span <button
class="pointer" class="btn btn-link btn-animate text-muted py-0"
onClick={linkEvent(this, this.handleModBanShow)} onClick={linkEvent(this, this.handleModBanShow)}
> >
{i18n.t('ban_from_site')} {i18n.t('ban_from_site')}
</span> </button>
) : ( ) : (
<span <button
class="pointer" class="btn btn-link btn-animate text-muted py-0"
onClick={linkEvent(this, this.handleModBanSubmit)} onClick={linkEvent(this, this.handleModBanSubmit)}
> >
{i18n.t('unban_from_site')} {i18n.t('unban_from_site')}
</span> </button>
))} ))}
{!post.banned && post.creator_local && ( {!post.banned && post.creator_local && (
<span <button
class="pointer" class="btn btn-link btn-animate text-muted py-0"
onClick={linkEvent(this, this.handleAddAdmin)} onClick={linkEvent(this, this.handleAddAdmin)}
> >
{this.isAdmin {this.isAdmin
? i18n.t('remove_as_admin') ? i18n.t('remove_as_admin')
: i18n.t('appoint_as_admin')} : i18n.t('appoint_as_admin')}
</span> </button>
)} )}
</> </>
)} )}
@ -870,35 +870,35 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
{this.amSiteCreator && {this.amSiteCreator &&
this.isAdmin && this.isAdmin &&
(!this.state.showConfirmTransferSite ? ( (!this.state.showConfirmTransferSite ? (
<span <button
class="pointer" class="btn btn-link btn-animate text-muted py-0"
onClick={linkEvent( onClick={linkEvent(
this, this,
this.handleShowConfirmTransferSite this.handleShowConfirmTransferSite
)} )}
> >
{i18n.t('transfer_site')} {i18n.t('transfer_site')}
</span> </button>
) : ( ) : (
<> <>
<span class="d-inline-block mr-1"> <button class="btn btn-link btn-animate text-muted py-0 d-inline-block mr-1">
{i18n.t('are_you_sure')} {i18n.t('are_you_sure')}
</span> </button>
<span <button
class="pointer d-inline-block mr-1" class="btn btn-link btn-animate text-muted py-0 d-inline-block mr-1"
onClick={linkEvent(this, this.handleTransferSite)} onClick={linkEvent(this, this.handleTransferSite)}
> >
{i18n.t('yes')} {i18n.t('yes')}
</span> </button>
<span <button
class="pointer d-inline-block" class="btn btn-link btn-animate text-muted py-0 d-inline-block"
onClick={linkEvent( onClick={linkEvent(
this, this,
this.handleCancelShowConfirmTransferSite this.handleCancelShowConfirmTransferSite
)} )}
> >
{i18n.t('no')} {i18n.t('no')}
</span> </button>
</> </>
))} ))}
</> </>