Przeglądaj źródła

fix: YouTube channels admin page Run job to get missing channel data wasn't finished

Kristian Vos 2 lat temu
rodzic
commit
c8335901b9

+ 19 - 1
backend/logic/actions/youtube.js

@@ -708,5 +708,23 @@ export default {
 				}
 			);
 		}
-	)
+	),
+
+	/**
+	 * Gets missing YouTube channels
+	 *
+	 * @returns {{status: string, data: object}}
+	 */
+	getMissingChannels: useHasPermission("youtube.getMissingChannels", function getMissingChannels(session, cb) {
+		return YouTubeModule.runJob("GET_MISSING_CHANNELS", {}, this)
+			.then(response => {
+				this.log("SUCCESS", "YOUTUBE_GET_MISSING_CHANNELS", `Getting missing YouTube channels was successful.`);
+				return cb({ status: "success", data: { ...response } });
+			})
+			.catch(async err => {
+				err = await UtilsModule.runJob("GET_ERROR", { error: err }, this);
+				this.log("ERROR", "YOUTUBE_GET_MISSING_CHANNELS", `Getting missing YouTube channels failed. "${err}"`);
+				return cb({ status: "error", message: err });
+			});
+	})
 };

+ 2 - 1
backend/logic/hooks/hasPermission.js

@@ -96,7 +96,8 @@ permissions.admin = {
 	"youtube.getApiRequest": true,
 	"youtube.resetStoredApiRequests": true,
 	"youtube.removeStoredApiRequest": true,
-	"youtube.removeVideos": true
+	"youtube.removeVideos": true,
+	"youtube.getMissingChannels": true
 };
 
 if (config.get("experimental.soundcloud")) {

+ 1 - 1
frontend/src/pages/Admin/YouTube/Channels.vue

@@ -181,7 +181,7 @@ const jobs = ref([]);
 // if (hasPermission("media.recalculateAllRatings"))
 jobs.value.push({
 	name: "Get missing YouTube channels from YouTube video's",
-	socket: "media.recalculateAllRatings"
+	socket: "youtube.getMissingChannels"
 });
 
 const { openModal } = useModalsStore();