Fix searchability api to compat with fedibird
This commit is contained in:
parent
6735a422ab
commit
de9e4b964c
9 changed files with 32 additions and 33 deletions
|
@ -10,12 +10,12 @@ import { Icon } from 'mastodon/components/icon';
|
|||
const messages = defineMessages({
|
||||
public_short: { id: 'searchability.public.short', defaultMessage: 'Public' },
|
||||
public_long: { id: 'searchability.public.long', defaultMessage: 'Anyone can find' },
|
||||
unlisted_short: { id: 'searchability.unlisted.short', defaultMessage: 'Followers' },
|
||||
unlisted_long: { id: 'searchability.unlisted.long', defaultMessage: 'Your followers can find' },
|
||||
private_short: { id: 'searchability.private.short', defaultMessage: 'Reactionners' },
|
||||
private_long: { id: 'searchability.private.long', defaultMessage: 'Reacter of this post can find' },
|
||||
direct_short: { id: 'searchability.direct.short', defaultMessage: 'Self only' },
|
||||
direct_long: { id: 'searchability.direct.long', defaultMessage: 'Nobody can find, but you can' },
|
||||
private_short: { id: 'searchability.unlisted.short', defaultMessage: 'Followers' },
|
||||
private_long: { id: 'searchability.unlisted.long', defaultMessage: 'Your followers can find' },
|
||||
direct_short: { id: 'searchability.private.short', defaultMessage: 'Reactionners' },
|
||||
direct_long: { id: 'searchability.private.long', defaultMessage: 'Reacter of this post can find' },
|
||||
limited_short: { id: 'searchability.direct.short', defaultMessage: 'Self only' },
|
||||
limited_long: { id: 'searchability.direct.long', defaultMessage: 'Nobody can find, but you can' },
|
||||
change_searchability: { id: 'searchability.change', defaultMessage: 'Set status searchability' },
|
||||
});
|
||||
|
||||
|
@ -212,14 +212,14 @@ class SearchabilityDropdown extends React.PureComponent {
|
|||
this.props.onChange(value);
|
||||
};
|
||||
|
||||
componentWillMount () {
|
||||
UNSAFE_componentWillMount () {
|
||||
const { intl: { formatMessage } } = this.props;
|
||||
|
||||
this.options = [
|
||||
{ icon: 'globe', value: 'public', text: formatMessage(messages.public_short), meta: formatMessage(messages.public_long) },
|
||||
{ icon: 'unlock', value: 'unlisted', text: formatMessage(messages.unlisted_short), meta: formatMessage(messages.unlisted_long) },
|
||||
{ icon: 'lock', value: 'private', text: formatMessage(messages.private_short), meta: formatMessage(messages.private_long) },
|
||||
{ icon: 'at', value: 'direct', text: formatMessage(messages.direct_short), meta: formatMessage(messages.direct_long) },
|
||||
{ icon: 'unlock', value: 'private', text: formatMessage(messages.private_short), meta: formatMessage(messages.private_long) },
|
||||
{ icon: 'lock', value: 'direct', text: formatMessage(messages.direct_short), meta: formatMessage(messages.direct_long) },
|
||||
{ icon: 'at', value: 'limited', text: formatMessage(messages.limited_short), meta: formatMessage(messages.limited_long) },
|
||||
];
|
||||
}
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ const mapStateToProps = state => ({
|
|||
needsLockWarning: state.getIn(['compose', 'privacy']) === 'private' && !state.getIn(['accounts', me, 'locked']),
|
||||
hashtagWarning: ['public', 'public_unlisted'].indexOf(state.getIn(['compose', 'privacy'])) < 0 && HASHTAG_PATTERN_REGEX.test(state.getIn(['compose', 'text'])),
|
||||
directMessageWarning: state.getIn(['compose', 'privacy']) === 'direct',
|
||||
searchabilityWarning: state.getIn(['compose', 'searchability']) === 'direct',
|
||||
searchabilityWarning: state.getIn(['compose', 'searchability']) === 'limited',
|
||||
});
|
||||
|
||||
const WarningWrapper = ({ needsLockWarning, hashtagWarning, directMessageWarning, searchabilityWarning }) => {
|
||||
|
|
|
@ -26,9 +26,9 @@ const messages = defineMessages({
|
|||
private_short: { id: 'privacy.private.short', defaultMessage: 'Followers-only' },
|
||||
direct_short: { id: 'privacy.direct.short', defaultMessage: 'Direct' },
|
||||
searchability_public_short: { id: 'searchability.public.short', defaultMessage: 'Public' },
|
||||
searchability_unlisted_short: { id: 'searchability.unlisted.short', defaultMessage: 'Followers' },
|
||||
searchability_private_short: { id: 'searchability.private.short', defaultMessage: 'Reactionners' },
|
||||
searchability_direct_short: { id: 'searchability.direct.short', defaultMessage: 'Self only' },
|
||||
searchability_private_short: { id: 'searchability.unlisted.short', defaultMessage: 'Followers' },
|
||||
searchability_direct_short: { id: 'searchability.private.short', defaultMessage: 'Reactionners' },
|
||||
searchability_limited_short: { id: 'searchability.direct.short', defaultMessage: 'Self only' },
|
||||
});
|
||||
|
||||
class DetailedStatus extends ImmutablePureComponent {
|
||||
|
@ -223,9 +223,9 @@ class DetailedStatus extends ImmutablePureComponent {
|
|||
|
||||
const searchabilityIconInfo = {
|
||||
'public': { icon: 'globe', text: intl.formatMessage(messages.searchability_public_short) },
|
||||
'unlisted': { icon: 'unlock', text: intl.formatMessage(messages.searchability_unlisted_short) },
|
||||
'private': { icon: 'lock', text: intl.formatMessage(messages.searchability_private_short) },
|
||||
'direct': { icon: 'at', text: intl.formatMessage(messages.searchability_direct_short) },
|
||||
'private': { icon: 'unlock', text: intl.formatMessage(messages.searchability_private_short) },
|
||||
'direct': { icon: 'lock', text: intl.formatMessage(messages.searchability_direct_short) },
|
||||
'limited': { icon: 'at', text: intl.formatMessage(messages.searchability_limited_short) },
|
||||
};
|
||||
|
||||
const searchabilityIcon = searchabilityIconInfo[status.get('searchability')];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue