Features: add attachmentLimit check

This commit is contained in:
Alex Gleason 2020-06-07 14:31:04 -05:00
parent cc6aae5937
commit 75412ca078
No known key found for this signature in database
GPG Key ID: 7211D1F99744FBB7
2 changed files with 17 additions and 0 deletions

View File

@ -92,4 +92,20 @@ describe('getFeatures', () => {
expect(features.trends).toBe(false);
});
});
describe('attachmentLimit', () => {
it('is 4 by default', () => {
const instance = ImmutableMap({ version: '3.1.4' });
const features = getFeatures(instance);
expect(features.attachmentLimit).toEqual(4);
});
it('is Infinity for Pleroma', () => {
const instance = ImmutableMap({
version: '2.7.2 (compatible; Pleroma 1.1.50-42-g3d9ac6ae-develop)',
});
const features = getFeatures(instance);
expect(features.attachmentLimit).toEqual(Infinity);
});
});
});

View File

@ -7,6 +7,7 @@ export const getFeatures = instance => {
suggestions: v.software === 'Mastodon' && semver.gte(v.compatVersion, '2.4.3'),
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,
};
};