diff --git a/app/soapbox/actions/__tests__/soapbox.test.ts b/app/soapbox/actions/__tests__/soapbox.test.ts new file mode 100644 index 0000000000..e3dcf9a853 --- /dev/null +++ b/app/soapbox/actions/__tests__/soapbox.test.ts @@ -0,0 +1,19 @@ +import { rootState } from '../../jest/test-helpers'; +import { getSoapboxConfig } from '../soapbox'; + +const ASCII_HEART = '❤'; // '\u2764\uFE0F' +const RED_HEART_RGI = '❤️'; // '\u2764' + +describe('getSoapboxConfig()', () => { + it('returns RGI heart on Pleroma > 2.3', () => { + const state = rootState.setIn(['instance', 'version'], '2.7.2 (compatible; Pleroma 2.3.0)'); + expect(getSoapboxConfig(state).allowedEmoji.includes(RED_HEART_RGI)).toBe(true); + expect(getSoapboxConfig(state).allowedEmoji.includes(ASCII_HEART)).toBe(false); + }); + + it('returns an ASCII heart on Pleroma < 2.3', () => { + const state = rootState.setIn(['instance', 'version'], '2.7.2 (compatible; Pleroma 2.0.0)'); + expect(getSoapboxConfig(state).allowedEmoji.includes(ASCII_HEART)).toBe(true); + expect(getSoapboxConfig(state).allowedEmoji.includes(RED_HEART_RGI)).toBe(false); + }); +}); diff --git a/app/soapbox/actions/soapbox.js b/app/soapbox/actions/soapbox.js index bc3bdc82fd..fd08d0300c 100644 Binary files a/app/soapbox/actions/soapbox.js and b/app/soapbox/actions/soapbox.js differ diff --git a/app/soapbox/utils/features.ts b/app/soapbox/utils/features.ts index 4f70f93411..93529f21e3 100644 --- a/app/soapbox/utils/features.ts +++ b/app/soapbox/utils/features.ts @@ -83,7 +83,7 @@ const getInstanceFeatures = (instance: Instance) => { chats: v.software === PLEROMA && gte(v.version, '2.1.0'), chatsV2: v.software === PLEROMA && gte(v.version, '2.3.0'), scopes: v.software === PLEROMA ? 'read write follow push admin' : 'read write follow push', - federating: federation.get('enabled', true), // Assume true unless explicitly false + federating: federation.get('enabled', true) === true, // Assume true unless explicitly false richText: v.software === PLEROMA, securityAPI: any([ v.software === PLEROMA,