From dfb133b22cc067eef104d9948831a3037b153bd0 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Sun, 7 Jun 2020 14:52:13 -0500 Subject: [PATCH] Features: focalPoint check --- app/soapbox/utils/__tests__/features-test.js | 16 ++++++++++++++++ app/soapbox/utils/features.js | 1 + 2 files changed, 17 insertions(+) diff --git a/app/soapbox/utils/__tests__/features-test.js b/app/soapbox/utils/__tests__/features-test.js index 900928fa0..d9dfdf476 100644 --- a/app/soapbox/utils/__tests__/features-test.js +++ b/app/soapbox/utils/__tests__/features-test.js @@ -108,4 +108,20 @@ describe('getFeatures', () => { expect(features.attachmentLimit).toEqual(Infinity); }); }); + + describe('focalPoint', () => { + it('is true for Mastodon 2.3.0+', () => { + const instance = ImmutableMap({ version: '2.3.0' }); + const features = getFeatures(instance); + expect(features.focalPoint).toBe(true); + }); + + it('is false for Pleroma', () => { + const instance = ImmutableMap({ + version: '2.7.2 (compatible; Pleroma 1.1.50-42-g3d9ac6ae-develop)', + }); + const features = getFeatures(instance); + expect(features.focalPoint).toBe(false); + }); + }); }); diff --git a/app/soapbox/utils/features.js b/app/soapbox/utils/features.js index 2c29b34dc..98266e3ca 100644 --- a/app/soapbox/utils/features.js +++ b/app/soapbox/utils/features.js @@ -8,6 +8,7 @@ export const getFeatures = instance => { trends: v.software === 'Mastodon' && semver.gte(v.compatVersion, '3.0.0'), emojiReacts: v.software === 'Pleroma' && semver.gte(v.version, '2.0.0'), attachmentLimit: v.software === 'Pleroma' ? Infinity : 4, + focalPoint: v.software === 'Mastodon' && semver.gte(v.compatVersion, '2.3.0'), }; };