Просмотр исходного кода

refactor(Todos): Remove account githubLinkConfirmed and other minor tweaks

Owen Diffey 2 лет назад
Родитель
Сommit
9a579b31ab

+ 1 - 1
frontend/src/components/AdvancedTable.vue

@@ -65,7 +65,7 @@ const { socket } = store.state.websockets;
 const page = ref(1);
 const pageSize = ref(10);
 const rows = ref([]);
-const count = ref(0); // TODO Rename
+const count = ref(0);
 const sort = ref({});
 const orderedColumns = ref([]);
 const shownColumns = ref([]);

+ 11 - 1
frontend/src/components/modals/RemoveAccount.vue

@@ -3,8 +3,9 @@ import { useStore } from "vuex";
 import { ref, onMounted } from "vue";
 import { useRoute } from "vue-router";
 import Toast from "toasters";
+import { useModalState } from "@/vuex_helpers";
 
-defineProps({
+const props = defineProps({
 	modalUuid: { type: String, default: "" }
 });
 
@@ -14,6 +15,13 @@ const store = useStore();
 
 const { socket } = store.state.websockets;
 
+const { githubLinkConfirmed } = useModalState(
+	"modals/removeAccount/MODAL_UUID",
+	{
+		modalUuid: props.modalUuid
+	}
+);
+
 const isPasswordLinked = () => store.dispatch("settings/isPasswordLinked");
 const isGithubLinked = () => store.dispatch("settings/isGithubLinked");
 const closeCurrentModal = () =>
@@ -99,6 +107,8 @@ const remove = () =>
 onMounted(async () => {
 	apiDomain.value = await lofig.get("backend.apiDomain");
 	accountRemovalMessage.value = await lofig.get("messages.accountRemoval");
+
+	if (githubLinkConfirmed.value === true) confirmGithubLink();
 });
 </script>
 

+ 1 - 3
frontend/src/components/modals/ViewYoutubeVideo.vue

@@ -87,9 +87,7 @@ const confirmAction = ({ message, action, params }) => {
 };
 
 const seekTo = position => {
-	// TODO fix recursive/eslint warning
-	// eslint-disable-next-line
-	settings("play");
+	pauseVideo(false);
 	player.player.seekTo(position);
 };
 

+ 0 - 1
frontend/src/pages/Admin/YouTube/Videos.vue

@@ -212,7 +212,6 @@ const removeVideos = videoIds => {
 			}
 
 			if (id)
-				// TODO fix
 				setJob({
 					id,
 					name: title,

+ 4 - 10
frontend/src/pages/Settings/Tabs/Account.vue

@@ -150,16 +150,10 @@ onMounted(() => {
 		route.query.removeAccount === "relinked-github" &&
 		!localStorage.getItem("github_redirect")
 	) {
-		openModal("removeAccount");
-
-		// TODO fix/redo this logic, broke after composition refactor
-		// setTimeout(() => {
-		// 	const modal = this.$parent.$children.find(
-		// 		child => child.name === "RemoveAccount"
-		// 	);
-
-		// 	modal.confirmGithubLink();
-		// }, 50);
+		openModal({
+			modal: "removeAccount",
+			data: { githubLinkConfirmed: true }
+		});
 	}
 });
 

+ 2 - 1
frontend/src/store/index.ts

@@ -40,7 +40,8 @@ export default createStore({
 				viewReport: emptyModule,
 				confirm: emptyModule,
 				bulkActions: emptyModule,
-				viewYoutubeVideo: emptyModule
+				viewYoutubeVideo: emptyModule,
+				removeAccount: emptyModule
 			}
 		},
 		longJobs

+ 3 - 1
frontend/src/store/modules/modalVisibility.ts

@@ -17,6 +17,7 @@ import confirm from "./modals/confirm";
 import editSongs from "./modals/editSongs";
 import editSong from "./modals/editSong";
 import viewYoutubeVideo from "./modals/viewYoutubeVideo";
+import removeAccount from "./modals/removeAccount";
 
 const state = {
 	modals: {},
@@ -39,7 +40,8 @@ const modalModules = {
 	confirm,
 	editSongs,
 	editSong,
-	viewYoutubeVideo
+	viewYoutubeVideo,
+	removeAccount
 };
 
 const getters = {};

+ 16 - 0
frontend/src/store/modules/modals/removeAccount.ts

@@ -0,0 +1,16 @@
+/* eslint no-param-reassign: 0 */
+
+export default {
+	namespaced: true,
+	state: {
+		githubLinkConfirmed: false
+	},
+	actions: {
+		init: ({ commit }, data) => commit("init", data)
+	},
+	mutations: {
+		init(state, { githubLinkConfirmed }) {
+			state.githubLinkConfirmed = githubLinkConfirmed;
+		}
+	}
+};