diff --git a/app/soapbox/actions/soapbox.js b/app/soapbox/actions/soapbox.js
index ee203dbb1..0fc0a3382 100644
--- a/app/soapbox/actions/soapbox.js
+++ b/app/soapbox/actions/soapbox.js
@@ -1,9 +1,29 @@
import api from '../api';
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_FAIL = 'SOAPBOX_CONFIG_REQUEST_FAIL';
+const allowedEmoji = ImmutableList([
+ '👍',
+ '❤',
+ '😆',
+ '😮',
+ '😢',
+ '😩',
+]);
+
+// https://git.pleroma.social/pleroma/pleroma/-/issues/2355
+const allowedEmojiRGI = ImmutableList([
+ '👍',
+ '❤️',
+ '😆',
+ '😮',
+ '😢',
+ '😩',
+]);
+
export const defaultConfig = ImmutableMap({
logo: '',
banner: '',
@@ -18,18 +38,22 @@ export const defaultConfig = ImmutableMap({
navlinks: ImmutableMap({
homeFooter: ImmutableList(),
}),
- allowedEmoji: ImmutableList([
- '👍',
- '❤️',
- '😆',
- '😮',
- '😢',
- '😩',
- ]),
+ allowedEmoji: allowedEmoji,
});
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() {
diff --git a/app/soapbox/components/__tests__/__snapshots__/emoji_selector-test.js.snap b/app/soapbox/components/__tests__/__snapshots__/emoji_selector-test.js.snap
index 80bd49f8e..6b6307012 100644
--- a/app/soapbox/components/__tests__/__snapshots__/emoji_selector-test.js.snap
+++ b/app/soapbox/components/__tests__/__snapshots__/emoji_selector-test.js.snap
@@ -16,7 +16,7 @@ exports[` renders correctly 1`] = `
className="emoji-react-selector__emoji"
dangerouslySetInnerHTML={
Object {
- "__html": "
",
+ "__html": "
",
}
}
/>
diff --git a/app/soapbox/reducers/__tests__/instance-test.js b/app/soapbox/reducers/__tests__/instance-test.js
index cba12c648..47cbb936a 100644
--- a/app/soapbox/reducers/__tests__/instance-test.js
+++ b/app/soapbox/reducers/__tests__/instance-test.js
@@ -11,6 +11,7 @@ describe('instance reducer', () => {
max_options: 4,
min_expiration: 300,
}),
+ version: '0.0.0',
}));
});
});
diff --git a/app/soapbox/reducers/instance.js b/app/soapbox/reducers/instance.js
index 72105279e..36f06e0b5 100644
--- a/app/soapbox/reducers/instance.js
+++ b/app/soapbox/reducers/instance.js
@@ -32,6 +32,7 @@ const initialState = ImmutableMap({
max_options: 4,
min_expiration: 300,
}),
+ version: '0.0.0',
});
const preloadImport = (state, action, path) => {
diff --git a/app/soapbox/test_helpers.js b/app/soapbox/test_helpers.js
index 544650141..e77985e91 100644
--- a/app/soapbox/test_helpers.js
+++ b/app/soapbox/test_helpers.js
@@ -8,6 +8,7 @@ import { IntlProvider } from 'react-intl';
import { BrowserRouter } from 'react-router-dom';
import configureMockStore from 'redux-mock-store';
import { Map as ImmutableMap } from 'immutable';
+import rootReducer from 'soapbox/reducers';
// Mock Redux
// https://redux.js.org/recipes/writing-tests/
@@ -18,7 +19,7 @@ export const mockStore = configureMockStore(middlewares);
export const createComponent = (children, props = {}) => {
props = ImmutableMap({
locale: 'en',
- store: mockStore(ImmutableMap()),
+ store: mockStore(rootReducer(ImmutableMap(), {})),
}).merge(props);
return renderer.create(
diff --git a/app/soapbox/utils/features.js b/app/soapbox/utils/features.js
index 4c3b10744..be34cb4fb 100644
--- a/app/soapbox/utils/features.js
+++ b/app/soapbox/utils/features.js
@@ -7,6 +7,7 @@ export const getFeatures = instance => {
suggestions: v.software === 'Mastodon' && gte(v.compatVersion, '2.4.3'),
trends: v.software === 'Mastodon' && gte(v.compatVersion, '3.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,
focalPoint: v.software === 'Mastodon' && gte(v.compatVersion, '2.3.0'),
importMutes: v.software === 'Pleroma' && gte(v.version, '2.2.0'),