From 5233b3310e8898fa97b0c0ca6b43d6787a8f1c57 Mon Sep 17 00:00:00 2001 From: Travis Shivers Date: Sun, 25 Oct 2020 21:57:30 -0500 Subject: [PATCH] refactor(join): remove recent rooms --- config/defaults.js | 1 - src/store/index.js | 1 - src/store/modules/synclounge/actions.js | 30 +----------- src/store/modules/synclounge/getters.js | 2 - src/store/modules/synclounge/mutations.js | 4 -- src/store/modules/synclounge/state.js | 1 - src/views/AdvancedRoomJoin.vue | 59 +---------------------- 7 files changed, 3 insertions(+), 95 deletions(-) diff --git a/config/defaults.js b/config/defaults.js index 52efa495..7a16bea2 100644 --- a/config/defaults.js +++ b/config/defaults.js @@ -41,7 +41,6 @@ const defaults = { plex_auth_check_interval: 1000, socket_server_health_timeout: 2000, - synclounge_max_recent_room_history: 100, // TODO: investigate the average length of closing credits synclounge_upnext_trigger_time_from_end: 45000, diff --git a/src/store/index.js b/src/store/index.js index 03c72d6f..3db53f39 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -27,7 +27,6 @@ const persistedState = createPersistedState({ 'plexservers.lastServerId', 'plexservers.blockedServerIds', - 'synclounge.recentRooms', 'synclounge.areNotificationsEnabled', 'synclounge.areSoundNotificationsEnabled', diff --git a/src/store/modules/synclounge/actions.js b/src/store/modules/synclounge/actions.js index 160a6563..ccb89975 100644 --- a/src/store/modules/synclounge/actions.js +++ b/src/store/modules/synclounge/actions.js @@ -82,9 +82,7 @@ export default { return rest; }, - JOIN_ROOM_AND_INIT: async ({ - getters, rootGetters, dispatch, commit, - }) => { + JOIN_ROOM_AND_INIT: async ({ rootGetters, dispatch, commit }) => { // Note: this is also called on rejoining, so be careful not to register handlers twice // or duplicate tasks const { @@ -92,16 +90,6 @@ export default { } = await dispatch('JOIN_ROOM'); const updatedAt = Date.now(); - // Add this item to our recently-connected list - await dispatch( - 'ADD_RECENT_ROOM', - { - server: getters.GET_SERVER, - room: getters.GET_ROOM, - time: Date.now(), - }, - ); - commit('SET_HOST_ID', hostId); commit('SET_USERS', Object.fromEntries( @@ -228,22 +216,6 @@ export default { commit('SET_SERVERS_HEALTH', aliveServerHealths); }, - ADD_RECENT_ROOM: ({ commit, getters, rootGetters }, newRoom) => commit( - 'SET_RECENT_ROOMS', - Array.of(newRoom).concat( - getters.GET_RECENT_ROOMS.filter( - (room) => room.server !== newRoom.server || room.room !== newRoom.room, - ), - ).slice(0, rootGetters.GET_CONFIG.synclounge_max_recent_room_history), - ), - - REMOVE_RECENT_ROOM: ({ commit, getters }, roomToRemove) => commit( - 'SET_RECENT_ROOMS', - getters.GET_RECENT_ROOMS.filter( - (room) => room.server !== roomToRemove.server || room.room !== roomToRemove.room, - ), - ), - ADD_EVENT_HANDLERS: ({ dispatch }) => { const makeHandler = (action) => (data) => dispatch(action, data); diff --git a/src/store/modules/synclounge/getters.js b/src/store/modules/synclounge/getters.js index ee45b3ef..474efb72 100644 --- a/src/store/modules/synclounge/getters.js +++ b/src/store/modules/synclounge/getters.js @@ -60,8 +60,6 @@ export default { GET_SYNC_CANCEL_TOKEN: (state) => state.syncCancelToken, - GET_RECENT_ROOMS: (state) => state.recentRooms, - IS_IN_ROOM: (state) => state.isInRoom, // Note: the host should really always have a playback rate of 1 diff --git a/src/store/modules/synclounge/mutations.js b/src/store/modules/synclounge/mutations.js index a01be765..590e1ff2 100644 --- a/src/store/modules/synclounge/mutations.js +++ b/src/store/modules/synclounge/mutations.js @@ -42,10 +42,6 @@ export default { state.syncCancelToken = token; }, - SET_RECENT_ROOMS: (state, rooms) => { - state.recentRooms = rooms; - }, - SET_IS_IN_ROOM: (state, isInRoom) => { state.isInRoom = isInRoom; }, diff --git a/src/store/modules/synclounge/state.js b/src/store/modules/synclounge/state.js index 0ebf0797..edbffe3a 100644 --- a/src/store/modules/synclounge/state.js +++ b/src/store/modules/synclounge/state.js @@ -10,7 +10,6 @@ const state = () => ({ isAutoHostEnabled: null, serversHealth: null, syncCancelToken: null, - recentRooms: [], isInRoom: false, upnextTimeoutId: null, diff --git a/src/views/AdvancedRoomJoin.vue b/src/views/AdvancedRoomJoin.vue index 291c8366..1c4884e0 100644 --- a/src/views/AdvancedRoomJoin.vue +++ b/src/views/AdvancedRoomJoin.vue @@ -56,54 +56,6 @@ - - Recent Rooms - - - - - - - - - {{ item.name || item.server || 'Custom' }} - - - {{ item.room }} - {{ sinceNow(item.time) }} - - - - - - - Remove - - - - - -