From 55c19aefe212d14e0693b1a04c49f19e2f3e66c2 Mon Sep 17 00:00:00 2001 From: Jake Potrebic Date: Sat, 4 May 2024 03:20:42 -0700 Subject: [PATCH] Add channel flag to de-select by default on versions page (#1255) Co-authored-by: MiniDigger | Martin --- README.md | 2 +- .../main/java/io/papermc/hangar/model/common/ChannelFlag.java | 1 + frontend/src/components/modals/ChannelModal.vue | 3 ++- frontend/src/i18n/locales/en.json | 4 +++- frontend/src/pages/[user]/[project]/versions/index.vue | 4 ++-- frontend/src/types/backend/index.ts | 1 + 6 files changed, 10 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 4cd98131a..335714156 100644 --- a/README.md +++ b/README.md @@ -44,7 +44,7 @@ To get the project running locally, you need to follow a few steps: ### Notes -* The Spring Boot configuration file that is used by this environment is located at `Hangar/src/main/resources/application.yml`. +* The Spring Boot configuration file that is used by this environment is located at `backend/src/main/resources/application.yml`. * You can view the emails hangar sends on http://localhost:4436/ * On staging/prod Hangar uses object storage, if you want to test that you can install minio and change the storage type to `object` in the `application.yml` diff --git a/backend/src/main/java/io/papermc/hangar/model/common/ChannelFlag.java b/backend/src/main/java/io/papermc/hangar/model/common/ChannelFlag.java index 3896d3d2c..dfa109bc4 100644 --- a/backend/src/main/java/io/papermc/hangar/model/common/ChannelFlag.java +++ b/backend/src/main/java/io/papermc/hangar/model/common/ChannelFlag.java @@ -13,6 +13,7 @@ public enum ChannelFlag { UNSTABLE(true, false), PINNED(true, true), SENDS_NOTIFICATIONS(true, false), + HIDE_BY_DEFAULT(true, true), ; public static final Set EDITABLE = Arrays.stream(values()).filter(ChannelFlag::isEditable).collect(Collectors.toUnmodifiableSet()); diff --git a/frontend/src/components/modals/ChannelModal.vue b/frontend/src/components/modals/ChannelModal.vue index 2458acee7..2c308791a 100644 --- a/frontend/src/components/modals/ChannelModal.vue +++ b/frontend/src/components/modals/ChannelModal.vue @@ -14,7 +14,7 @@ const i18n = useI18n(); const v = useVuelidate({ $stopPropagation: true }); const frozen = props.channel && props.channel.flags.includes(ChannelFlag.FROZEN); -const possibleFlags = frozen ? [ChannelFlag.PINNED] : [ChannelFlag.UNSTABLE, ChannelFlag.PINNED, ChannelFlag.SENDS_NOTIFICATIONS]; +const possibleFlags = frozen ? [ChannelFlag.PINNED] : [ChannelFlag.UNSTABLE, ChannelFlag.PINNED, ChannelFlag.SENDS_NOTIFICATIONS, ChannelFlag.HIDE_BY_DEFAULT]; const form = reactive({ name: "", @@ -135,6 +135,7 @@ reset(); + {{ i18n.t("channel.modal.flags." + f.toLowerCase()) }} diff --git a/frontend/src/i18n/locales/en.json b/frontend/src/i18n/locales/en.json index 29cd0c748..6f8699ec1 100644 --- a/frontend/src/i18n/locales/en.json +++ b/frontend/src/i18n/locales/en.json @@ -597,7 +597,9 @@ "flags": { "unstable": "Versions are to be considered unstable", "pinned": "Latest version is pinned on main project page", - "sends_notifications": "New versions in this channel send notifications to watching users" + "sends_notifications": "New versions in this channel send notifications to watching users", + "pinned": "Latest version is pinned on main project page", + "hide_by_default": "De-select this channel on the versions page" }, "error": { "invalidName": "Invalid channel name", diff --git a/frontend/src/pages/[user]/[project]/versions/index.vue b/frontend/src/pages/[user]/[project]/versions/index.vue index 8e635a51a..ecd30dda9 100644 --- a/frontend/src/pages/[user]/[project]/versions/index.vue +++ b/frontend/src/pages/[user]/[project]/versions/index.vue @@ -1,5 +1,5 @@