[mastofe] Adds deleting others notice if you have the rights(~moderator)

Closes: https://git.pleroma.social/pleroma/mastofe/issues/20
This commit is contained in:
Haelwenn (lanodan) Monnier 2018-06-26 20:46:28 +02:00
parent 88f12d6ba6
commit 2897056b81
No known key found for this signature in database
GPG key ID: D5B7A8E43C997DEE
4 changed files with 14 additions and 2 deletions

View file

@ -5,7 +5,7 @@ import IconButton from './icon_button';
import DropdownMenuContainer from 'flavours/glitch/containers/dropdown_menu_container';
import { defineMessages, injectIntl } from 'react-intl';
import ImmutablePureComponent from 'react-immutable-pure-component';
import { me, isStaff } from 'flavours/glitch/util/initial_state';
import { me, isStaff, deleteOthersNotice } from 'flavours/glitch/util/initial_state';
import RelativeTimestamp from './relative_timestamp';
import { accountAdminLink, statusAdminLink } from 'flavours/glitch/util/backend_links';
@ -255,6 +255,9 @@ class StatusActionBar extends ImmutablePureComponent {
});
}
}
if ( deleteOthersNotice ) {
menu.push({ text: intl.formatMessage(messages.delete), action: this.handleDeleteClick });
}
}
if (status.get('in_reply_to_id', null) === null) {

View file

@ -10,6 +10,7 @@ const initialState = element && function () {
}();
const getMeta = (prop) => initialState && initialState.meta && initialState.meta[prop];
const getRight = (prop) => initialState && initialState.rights && initialState.rights[prop];
export const reduceMotion = getMeta('reduce_motion');
export const autoPlayGif = getMeta('auto_play_gif');
@ -35,4 +36,6 @@ export const usePendingItems = getMeta('use_pending_items');
export const useSystemEmojiFont = getMeta('system_emoji_font');
export const showTrends = getMeta('trends');
export const deleteOthersNotice = getRight('delete_others_notice');
export default initialState;

View file

@ -5,7 +5,7 @@ import IconButton from './icon_button';
import DropdownMenuContainer from '../containers/dropdown_menu_container';
import { defineMessages, injectIntl } from 'react-intl';
import ImmutablePureComponent from 'react-immutable-pure-component';
import { me, isStaff } from '../initial_state';
import { me, deleteOthersNotice, isStaff } from '../initial_state';
const messages = defineMessages({
delete: { id: 'status.delete', defaultMessage: 'Delete' },
@ -227,6 +227,9 @@ class StatusActionBar extends ImmutablePureComponent {
menu.push({ text: intl.formatMessage(messages.admin_account, { name: status.getIn(['account', 'username']) }), href: `/admin/accounts/${status.getIn(['account', 'id'])}` });
menu.push({ text: intl.formatMessage(messages.admin_status), href: `/admin/accounts/${status.getIn(['account', 'id'])}/statuses/${status.get('id')}` });
}
if ( deleteOthersNotice ) {
menu.push({ text: intl.formatMessage(messages.delete), action: this.handleDeleteClick });
}
}
if (status.get('visibility') === 'direct') {

View file

@ -2,6 +2,7 @@ const element = document.getElementById('initial-state');
const initialState = element && JSON.parse(element.textContent);
const getMeta = (prop) => initialState && initialState.meta && initialState.meta[prop];
const getRight = (prop) => initialState && initialState.rights && initialState.rights[prop];
export const reduceMotion = getMeta('reduce_motion');
export const autoPlayGif = getMeta('auto_play_gif');
@ -26,4 +27,6 @@ export const usePendingItems = getMeta('use_pending_items');
export const showTrends = getMeta('trends');
export const title = getMeta('title');
export const deleteOthersNotice = getRight('delete_others_notice');
export default initialState;