瀏覽代碼

refactor: hide autorequest disallow recent if experimental history is not enabled

Kristian Vos 1 年之前
父節點
當前提交
c26c692e49

+ 7 - 2
frontend/src/components/PlaylistTabBase.vue

@@ -8,7 +8,7 @@ import { useStationStore } from "@/stores/station";
 import { useUserPlaylistsStore } from "@/stores/userPlaylists";
 import { useModalsStore } from "@/stores/modals";
 import { useManageStationStore } from "@/stores/manageStation";
-
+import { useConfigStore } from "@/stores/config";
 import { useSortablePlaylists } from "@/composables/useSortablePlaylists";
 
 const PlaylistItem = defineAsyncComponent(
@@ -32,6 +32,8 @@ const props = defineProps({
 
 const emit = defineEmits(["selected"]);
 
+const configStore = useConfigStore();
+
 const { socket } = useWebsocketsStore();
 const stationStore = useStationStore();
 
@@ -106,7 +108,10 @@ const excludedYoutubeIds = computed(() => {
 
 	const mediaSources = new Set();
 
-	if (autorequestDisallowRecentlyPlayedEnabled) {
+	if (
+		autorequestDisallowRecentlyPlayedEnabled &&
+		configStore.get("experimental.station_history")
+	) {
 		history.value.forEach((historyItem, index) => {
 			if (index < autorequestDisallowRecentlyPlayedNumber)
 				mediaSources.add(historyItem.payload.song.mediaSource);

+ 11 - 2
frontend/src/components/modals/ManageStation/Settings.vue

@@ -6,6 +6,7 @@ import validation from "@/validation";
 import { useWebsocketsStore } from "@/stores/websockets";
 import { useManageStationStore } from "@/stores/manageStation";
 import { useForm } from "@/composables/useForm";
+import { useConfigStore } from "@/stores/config";
 
 const InfoIcon = defineAsyncComponent(
 	() => import("@/components/InfoIcon.vue")
@@ -17,6 +18,8 @@ const props = defineProps({
 
 const { socket } = useWebsocketsStore();
 
+const configStore = useConfigStore();
+
 const manageStationStore = useManageStationStore({
 	modalUuid: props.modalUuid
 });
@@ -321,7 +324,12 @@ watch(station, value => {
 							</div>
 						</div>
 
-						<div class="small-section">
+						<div
+							class="small-section"
+							v-if="
+								configStore.get('experimental.station_history')
+							"
+						>
 							<label class="label"
 								>Autorequest disallow recent</label
 							>
@@ -344,7 +352,8 @@ watch(station, value => {
 							v-if="
 								inputs[
 									'requestsAutorequestDisallowRecentlyPlayedEnabled'
-								].value
+								].value &&
+								configStore.get('experimental.station_history')
 							"
 							class="small-section"
 						>

+ 4 - 1
frontend/src/pages/Station/index.vue

@@ -296,7 +296,10 @@ const autoRequestSong = () => {
 	if (songsList.value.length >= 50) return;
 
 	let excludedYoutubeIds = [];
-	if (autorequestDisallowRecentlyPlayedEnabled) {
+	if (
+		autorequestDisallowRecentlyPlayedEnabled &&
+		configStore.get("experimental.station_history")
+	) {
 		excludedYoutubeIds = recentlyPlayedYoutubeIds(
 			autorequestDisallowRecentlyPlayedNumber
 		);