mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
fix(flags): hide geolocation-only selectors on /int/ and /sp/
Country-only boards auto-publish geographic location flags without showing a flag dropdown, matching existing /bant/ behavior.
This commit is contained in:
@@ -17,30 +17,34 @@ describe('comment-flag-selection', () => {
|
||||
expect(hasCommentFlagsForDirectory({ features: { hasFlags: true }, title: '/pol/ - Politically Incorrect' })).toBe(true);
|
||||
});
|
||||
|
||||
it('uses geographic location as the default for country flag boards', () => {
|
||||
it('uses geographic location as the default for other flag boards', () => {
|
||||
expect(
|
||||
getCommentFlagOptionsForDirectory({
|
||||
directoryCode: 'int',
|
||||
directoryCode: 'fit',
|
||||
features: { hasFlags: true },
|
||||
title: '/int/ - International',
|
||||
title: '/fit/ - Fitness',
|
||||
}),
|
||||
).toEqual([{ label: 'Geographic Location', value: 'country:auto' }]);
|
||||
});
|
||||
|
||||
it('does not expose a flag selector on /bant/ but still publishes geographic location', () => {
|
||||
it.each([
|
||||
{ directoryCode: 'bant', title: '/bant/ - International/Random' },
|
||||
{ directoryCode: 'int', title: '/int/ - International' },
|
||||
{ directoryCode: 'sp', title: '/sp/ - Sports' },
|
||||
])('does not expose a flag selector on /$directoryCode/ but still publishes geographic location', ({ directoryCode, title }) => {
|
||||
expect(
|
||||
getCommentFlagOptionsForDirectory({
|
||||
directoryCode: 'bant',
|
||||
directoryCode,
|
||||
features: { hasFlags: true },
|
||||
title: '/bant/ - International/Random',
|
||||
title,
|
||||
}),
|
||||
).toEqual([]);
|
||||
|
||||
expect(
|
||||
getCommentFlagPublishOptionsForDirectory({
|
||||
directoryCode: 'bant',
|
||||
directoryCode,
|
||||
features: { hasFlags: true },
|
||||
title: '/bant/ - International/Random',
|
||||
title,
|
||||
}),
|
||||
).toEqual({
|
||||
challengeRequest: {
|
||||
|
||||
@@ -38,7 +38,7 @@ const NO_FLAG_OPTION: CommentFlagSelectOption = {
|
||||
};
|
||||
|
||||
/** Boards that always publish geographic location without showing a flag selector. */
|
||||
const AUTO_GEOGRAPHIC_FLAG_DIRECTORY_CODES = new Set(['bant']);
|
||||
const AUTO_GEOGRAPHIC_FLAG_DIRECTORY_CODES = new Set(['bant', 'int', 'sp']);
|
||||
|
||||
const getDirectoryCode = (directory: Pick<DirectoryCommunity, 'directoryCode' | 'title'> | undefined): string | undefined => {
|
||||
const directoryCode = directory?.directoryCode?.trim().toLowerCase();
|
||||
|
||||
Reference in New Issue
Block a user