From 36b88d87eec0353b774c2de11db6dc10a7d2b706 Mon Sep 17 00:00:00 2001 From: Dan Peterson Date: Wed, 29 Dec 2021 11:35:54 -0600 Subject: [PATCH 1/2] Add prefix to all internal tags --- ui/constants/tags.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/ui/constants/tags.js b/ui/constants/tags.js index b923f4491..0fdd4b6e4 100644 --- a/ui/constants/tags.js +++ b/ui/constants/tags.js @@ -13,11 +13,19 @@ export const DEFAULT_FOLLOWED_TAGS = [ 'technology', ]; -export const DISABLE_COMMENTS_TAG = 'disable-comments'; +export const DISABLE_COMMENTS_TAG = 'c:disable-comments'; export const DISABLE_SUPPORT_TAG = 'disable-support'; -export const PREFERENCE_EMBED = 'preference-embed'; +export const PREFERENCE_EMBED = 'c:preference-embed'; +export const SCHEDULED_LIVESTREAM_TAG = 'c:scheduled-livestream'; +export const LBRY_FIRST_TAG = 'c:lbry-first'; -export const UTILITY_TAGS = [DISABLE_COMMENTS_TAG, DISABLE_SUPPORT_TAG, PREFERENCE_EMBED]; +// Control tags are special tags that are available to the user in some situations. +export const CONTROL_TAGS = [DISABLE_COMMENTS_TAG, DISABLE_SUPPORT_TAG, PREFERENCE_EMBED]; + +// System tags are special tags that are not available to the user. +export const SYSTEM_TAGS = [SCHEDULED_LIVESTREAM_TAG, LBRY_FIRST_TAG]; + +export const INTERNAL_TAGS = [...CONTROL_TAGS, ...SYSTEM_TAGS]; export const MATURE_TAGS = [ 'porn', -- 2.45.3 From cfdd19309738784c77462592334c7c81ebfa80d2 Mon Sep 17 00:00:00 2001 From: Dan Peterson Date: Thu, 30 Dec 2021 14:47:25 -0600 Subject: [PATCH 2/2] Strip internal tag prefix from form labels --- ui/component/tagsSearch/view.jsx | 9 +++++---- ui/constants/tags.js | 2 ++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/ui/component/tagsSearch/view.jsx b/ui/component/tagsSearch/view.jsx index e4495ca63..0f9919f34 100644 --- a/ui/component/tagsSearch/view.jsx +++ b/ui/component/tagsSearch/view.jsx @@ -5,7 +5,7 @@ import Tag from 'component/tag'; import { setUnion, setDifference } from 'util/set-operations'; import I18nMessage from 'component/i18nMessage'; import analytics from 'analytics'; -import { UTILITY_TAGS } from 'constants/tags'; +import { CONTROL_TAGS, INTERNAL_TAGS, INTERNAL_TAG_PREFIX } from 'constants/tags'; type Props = { tagsPassedIn: Array, @@ -79,7 +79,7 @@ export default function TagsSearch(props: Props) { const remainingUnfollowedTagsSet = setDifference(unfollowedTagsSet, selectedTagsSet); const suggestedTagsSet = setUnion(remainingFollowedTagsSet, remainingUnfollowedTagsSet); - const SPECIAL_TAGS = [...UTILITY_TAGS, 'lbry-first', 'mature']; + const SPECIAL_TAGS = [...INTERNAL_TAGS, 'mature']; let countWithoutSpecialTags = selectedTagsSet.size; SPECIAL_TAGS.forEach((t) => { @@ -179,7 +179,7 @@ export default function TagsSearch(props: Props) { {countWithoutSpecialTags === 0 && } {Boolean(tagsPassedIn.length) && tagsPassedIn - .filter((t) => !UTILITY_TAGS.includes(t.name)) + .filter((t) => !INTERNAL_TAGS.includes(t.name)) .map((tag) => ( - {UTILITY_TAGS.map((t) => ( + {CONTROL_TAGS.map((t) => ( word.charAt(0).toUpperCase() + word.slice(1)) .join(' ') diff --git a/ui/constants/tags.js b/ui/constants/tags.js index 0fdd4b6e4..0a24ffa62 100644 --- a/ui/constants/tags.js +++ b/ui/constants/tags.js @@ -13,6 +13,8 @@ export const DEFAULT_FOLLOWED_TAGS = [ 'technology', ]; +export const INTERNAL_TAG_PREFIX = 'c:'; + export const DISABLE_COMMENTS_TAG = 'c:disable-comments'; export const DISABLE_SUPPORT_TAG = 'disable-support'; export const PREFERENCE_EMBED = 'c:preference-embed'; -- 2.45.3