Features: focalPoint check

This commit is contained in:
Alex Gleason 2020-06-07 14:52:13 -05:00
parent 8f532b1b92
commit dfb133b22c
No known key found for this signature in database
GPG key ID: 7211D1F99744FBB7
2 changed files with 17 additions and 0 deletions

View file

@ -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);
});
});
});

View file

@ -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'),
};
};