Support RGI emoji reacts conditionally
This commit is contained in:
parent
bebe50cc33
commit
fb99d36494
3 changed files with 35 additions and 9 deletions
|
@ -1,9 +1,29 @@
|
||||||
import api from '../api';
|
import api from '../api';
|
||||||
import { Map as ImmutableMap, List as ImmutableList } from 'immutable';
|
import { Map as ImmutableMap, List as ImmutableList } from 'immutable';
|
||||||
|
import { getFeatures } from 'soapbox/utils/features';
|
||||||
|
|
||||||
export const SOAPBOX_CONFIG_REQUEST_SUCCESS = 'SOAPBOX_CONFIG_REQUEST_SUCCESS';
|
export const SOAPBOX_CONFIG_REQUEST_SUCCESS = 'SOAPBOX_CONFIG_REQUEST_SUCCESS';
|
||||||
export const SOAPBOX_CONFIG_REQUEST_FAIL = 'SOAPBOX_CONFIG_REQUEST_FAIL';
|
export const SOAPBOX_CONFIG_REQUEST_FAIL = 'SOAPBOX_CONFIG_REQUEST_FAIL';
|
||||||
|
|
||||||
|
const allowedEmoji = ImmutableList([
|
||||||
|
'👍',
|
||||||
|
'❤',
|
||||||
|
'😆',
|
||||||
|
'😮',
|
||||||
|
'😢',
|
||||||
|
'😩',
|
||||||
|
]);
|
||||||
|
|
||||||
|
// https://git.pleroma.social/pleroma/pleroma/-/issues/2355
|
||||||
|
const allowedEmojiRGI = ImmutableList([
|
||||||
|
'👍',
|
||||||
|
'❤️',
|
||||||
|
'😆',
|
||||||
|
'😮',
|
||||||
|
'😢',
|
||||||
|
'😩',
|
||||||
|
]);
|
||||||
|
|
||||||
export const defaultConfig = ImmutableMap({
|
export const defaultConfig = ImmutableMap({
|
||||||
logo: '',
|
logo: '',
|
||||||
banner: '',
|
banner: '',
|
||||||
|
@ -18,18 +38,22 @@ export const defaultConfig = ImmutableMap({
|
||||||
navlinks: ImmutableMap({
|
navlinks: ImmutableMap({
|
||||||
homeFooter: ImmutableList(),
|
homeFooter: ImmutableList(),
|
||||||
}),
|
}),
|
||||||
allowedEmoji: ImmutableList([
|
allowedEmoji: allowedEmoji,
|
||||||
'👍',
|
|
||||||
'❤️',
|
|
||||||
'😆',
|
|
||||||
'😮',
|
|
||||||
'😢',
|
|
||||||
'😩',
|
|
||||||
]),
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export function getSoapboxConfig(state) {
|
export function getSoapboxConfig(state) {
|
||||||
return defaultConfig.merge(state.get('soapbox'));
|
const instance = state.get('instance');
|
||||||
|
const soapbox = state.get('soapbox');
|
||||||
|
const features = getFeatures(instance);
|
||||||
|
|
||||||
|
// https://git.pleroma.social/pleroma/pleroma/-/issues/2355
|
||||||
|
if (features.emojiReactsRGI) {
|
||||||
|
return defaultConfig
|
||||||
|
.set('allowedEmoji', allowedEmojiRGI)
|
||||||
|
.merge(soapbox);
|
||||||
|
} else {
|
||||||
|
return defaultConfig.merge(soapbox);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function fetchSoapboxConfig() {
|
export function fetchSoapboxConfig() {
|
||||||
|
|
|
@ -32,6 +32,7 @@ const initialState = ImmutableMap({
|
||||||
max_options: 4,
|
max_options: 4,
|
||||||
min_expiration: 300,
|
min_expiration: 300,
|
||||||
}),
|
}),
|
||||||
|
version: '0.0.0',
|
||||||
});
|
});
|
||||||
|
|
||||||
const preloadImport = (state, action, path) => {
|
const preloadImport = (state, action, path) => {
|
||||||
|
|
|
@ -7,6 +7,7 @@ export const getFeatures = instance => {
|
||||||
suggestions: v.software === 'Mastodon' && gte(v.compatVersion, '2.4.3'),
|
suggestions: v.software === 'Mastodon' && gte(v.compatVersion, '2.4.3'),
|
||||||
trends: v.software === 'Mastodon' && gte(v.compatVersion, '3.0.0'),
|
trends: v.software === 'Mastodon' && gte(v.compatVersion, '3.0.0'),
|
||||||
emojiReacts: v.software === 'Pleroma' && gte(v.version, '2.0.0'),
|
emojiReacts: v.software === 'Pleroma' && gte(v.version, '2.0.0'),
|
||||||
|
emojiReactsRGI: v.software === 'Pleroma' && gte(v.version, '2.2.49'),
|
||||||
attachmentLimit: v.software === 'Pleroma' ? Infinity : 4,
|
attachmentLimit: v.software === 'Pleroma' ? Infinity : 4,
|
||||||
focalPoint: v.software === 'Mastodon' && gte(v.compatVersion, '2.3.0'),
|
focalPoint: v.software === 'Mastodon' && gte(v.compatVersion, '2.3.0'),
|
||||||
importMutes: v.software === 'Pleroma' && gte(v.version, '2.2.0'),
|
importMutes: v.software === 'Pleroma' && gte(v.version, '2.2.0'),
|
||||||
|
|
Loading…
Reference in a new issue