Using batch showcase flag to hide archival releases.

This commit is contained in:
DebaucheryLibrarian 2023-07-25 04:23:10 +02:00
parent 671e110d99
commit d033def947
4 changed files with 14 additions and 4 deletions

View File

@ -57,7 +57,12 @@
<script setup> <script setup>
import config from 'config'; import config from 'config';
import { defineProps, defineEmits, computed } from 'vue'; import {
defineProps,
defineEmits,
computed,
} from 'vue';
import { useStore } from 'vuex'; import { useStore } from 'vuex';
import { useRouter } from 'vue-router'; import { useRouter } from 'vue-router';

View File

@ -506,6 +506,7 @@ const releasesFragment = `
] ]
effectiveDate: { lessThan: $before, greaterThan: $after } effectiveDate: { lessThan: $before, greaterThan: $after }
showcased: { equalTo: true } showcased: { equalTo: true }
batchShowcased: { in: $batchShowcased }
} }
) { ) {
releases: nodes { releases: nodes {

View File

@ -24,7 +24,8 @@ function initReleasesActions(store, router) {
$after:Datetime = "1900-01-01 00:00:00", $after:Datetime = "1900-01-01 00:00:00",
$before:Datetime = "2100-01-01 00:00:00", $before:Datetime = "2100-01-01 00:00:00",
$orderBy: [ReleasesSummariesOrderBy!], $orderBy: [ReleasesSummariesOrderBy!],
$exclude: [String!] $exclude: [String!],
$batchShowcased: [Boolean!]
) { ) {
${releasesFragment} ${releasesFragment}
${batchFragment} ${batchFragment}
@ -38,6 +39,7 @@ function initReleasesActions(store, router) {
before, before,
orderBy, orderBy,
exclude: store.state.ui.tagFilter, exclude: store.state.ui.tagFilter,
batchShowcased: range === 'new' ? true : [true, false],
}); });
return { return {

View File

@ -15,6 +15,7 @@ exports.up = async (knex) => {
AND (channels.showcased IS NOT false OR COALESCE(studios.showcased, false) = true) AND (channels.showcased IS NOT false OR COALESCE(studios.showcased, false) = true)
AND (networks.showcased IS NOT false OR COALESCE(channels.showcased, false) = true OR COALESCE(studios.showcased, false) = true) AND (networks.showcased IS NOT false OR COALESCE(channels.showcased, false) = true OR COALESCE(studios.showcased, false) = true)
AS showcased, AS showcased,
batches.showcased AS batch_showcased,
releases.effective_date, releases.effective_date,
releases.created_at, releases.created_at,
array_agg(tags.slug ORDER BY tags.priority DESC) FILTER (WHERE tags.slug IS NOT NULL) AS tags array_agg(tags.slug ORDER BY tags.priority DESC) FILTER (WHERE tags.slug IS NOT NULL) AS tags
@ -25,14 +26,15 @@ exports.up = async (knex) => {
LEFT JOIN entities AS studios ON studios.id = releases.studio_id LEFT JOIN entities AS studios ON studios.id = releases.studio_id
LEFT JOIN entities AS networks ON networks.id = channels.parent_id LEFT JOIN entities AS networks ON networks.id = channels.parent_id
LEFT JOIN entities AS parent_networks ON parent_networks.id = networks.parent_id LEFT JOIN entities AS parent_networks ON parent_networks.id = networks.parent_id
GROUP BY releases.id, studios.showcased, LEFT JOIN batches ON batches.id = releases.updated_batch_id
GROUP BY releases.id, studios.showcased, batches.showcased,
channels.showcased, channels.slug, channels.type, channels.showcased, channels.slug, channels.type,
networks.showcased, networks.slug, networks.type, networks.showcased, networks.slug, networks.type,
parent_networks.slug, parent_networks.type parent_networks.slug, parent_networks.type
); );
COMMENT ON MATERIALIZED VIEW releases_summaries IS E'@foreignKey (release_id) references releases (id)'; COMMENT ON MATERIALIZED VIEW releases_summaries IS E'@foreignKey (release_id) references releases (id)';
GRANT ALL ON ALL TABLES IN SCHEMA public TO :visitor; GRANT ALL ON releases_summaries TO :visitor;
`, { `, {
visitor: knex.raw(config.database.query.user), visitor: knex.raw(config.database.query.user),
}); });