浏览代码

fix: eslint issue & socket events emitted properly when privacy updated of playlist

Signed-off-by: Jonathan <theflametrooper@gmail.com>
Jonathan 4 年之前
父节点
当前提交
c28c1010c4
共有 3 个文件被更改,包括 10 次插入8 次删除
  1. 7 4
      backend/logic/actions/playlists.js
  2. 1 4
      frontend/src/pages/Home/index.vue
  3. 2 0
      frontend/src/pages/Profile.vue

+ 7 - 4
backend/logic/actions/playlists.js

@@ -143,7 +143,9 @@ CacheModule.runJob("SUB", {
 	cb: res => {
 		IOModule.runJob("SOCKETS_FROM_USER", { userId: res.userId }, this).then(response => {
 			response.sockets.forEach(socket => {
-				socket.emit("event:playlist.updatePrivacy");
+				socket.emit("event:playlist.updatePrivacy", {
+					playlist: res.playlist
+				});
 			});
 		});
 
@@ -1395,9 +1397,7 @@ export default {
 
 				(res, next) => {
 					PlaylistsModule.runJob("UPDATE_PLAYLIST", { playlistId }, this)
-						.then(playlist => {
-							next(null, playlist);
-						})
+						.then(playlist => next(null, playlist))
 						.catch(next);
 				}
 			],
@@ -1411,11 +1411,13 @@ export default {
 					);
 					return cb({ status: "failure", message: err });
 				}
+
 				this.log(
 					"SUCCESS",
 					"PLAYLIST_UPDATE_PRIVACY",
 					`Successfully updated privacy to "${privacy}" for private playlist "${playlistId}" for user "${session.userId}".`
 				);
+
 				CacheModule.runJob("PUB", {
 					channel: "playlist.updatePrivacy",
 					value: {
@@ -1423,6 +1425,7 @@ export default {
 						playlist
 					}
 				});
+
 				return cb({
 					status: "success",
 					message: "Playlist has been successfully updated"

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

@@ -8,10 +8,7 @@
 				:hide-logged-out="true"
 			/>
 			<div class="header" :class="{ loggedIn }">
-				<img
-					class="background"
-					src="/assets/homebg.jpeg"
-				/>
+				<img class="background" src="/assets/homebg.jpeg" />
 				<div class="overlay"></div>
 				<div class="content-container">
 					<div class="content">

+ 2 - 0
frontend/src/pages/Profile.vue

@@ -307,10 +307,12 @@ export default {
 					if (res.status === "error") this.$router.go("/404");
 					else {
 						this.user = res.data;
+
 						this.user.createdAt = format(
 							parseISO(this.user.createdAt),
 							"MMMM do yyyy"
 						);
+
 						this.isUser = true;
 
 						if (this.user._id !== this.userId) {