diff options
Diffstat (limited to 'src/modules')
| -rw-r--r-- | src/modules/api.js | 4 | ||||
| -rw-r--r-- | src/modules/config.js | 4 | ||||
| -rw-r--r-- | src/modules/instance.js | 5 | ||||
| -rw-r--r-- | src/modules/shout.js (renamed from src/modules/chat.js) | 7 | ||||
| -rw-r--r-- | src/modules/users.js | 7 |
5 files changed, 16 insertions, 11 deletions
diff --git a/src/modules/api.js b/src/modules/api.js index 8654b90a..54f94356 100644 --- a/src/modules/api.js +++ b/src/modules/api.js @@ -255,12 +255,12 @@ const api = { initializeSocket ({ dispatch, commit, state, rootState }) { // Set up websocket connection const token = state.wsToken - if (rootState.instance.chatAvailable && typeof token !== 'undefined' && state.socket === null) { + if (rootState.instance.shoutAvailable && typeof token !== 'undefined' && state.socket === null) { const socket = new Socket('/socket', { params: { token } }) socket.connect() commit('setSocket', socket) - dispatch('initializeChat', socket) + dispatch('initializeShout', socket) } }, disconnectFromSocket ({ commit, state }) { diff --git a/src/modules/config.js b/src/modules/config.js index 0f596750..33e2cb50 100644 --- a/src/modules/config.js +++ b/src/modules/config.js @@ -21,6 +21,7 @@ export const defaultState = { customThemeSource: undefined, hideISP: false, hideInstanceWallpaper: false, + hideShoutbox: false, // bad name: actually hides posts of muted USERS hideMutedPosts: undefined, // instance default collapseMessageWithSubject: undefined, // instance default @@ -93,7 +94,8 @@ const config = { const { defaultConfig } = rootGetters return { ...defaultConfig, - ...state + // Do not override with undefined + ...Object.fromEntries(Object.entries(state).filter(([k, v]) => v !== undefined)) } } }, diff --git a/src/modules/instance.js b/src/modules/instance.js index 96de73ca..539b9c66 100644 --- a/src/modules/instance.js +++ b/src/modules/instance.js @@ -19,7 +19,6 @@ const defaultState = { defaultBanner: '/images/banner.png', background: '/static/aurora_borealis.jpg', collapseMessageWithSubject: false, - disableChat: false, greentext: false, hideFilteredStatuses: false, hideMutedPosts: false, @@ -57,7 +56,7 @@ const defaultState = { knownDomains: [], // Feature-set, apparently, not everything here is reported... - chatAvailable: false, + shoutAvailable: false, pleromaChatMessagesAvailable: false, gopherAvailable: false, mediaProxyAvailable: false, @@ -107,7 +106,7 @@ const instance = { case 'name': dispatch('setPageTitle') break - case 'chatAvailable': + case 'shoutAvailable': if (value) { dispatch('initializeSocket') } diff --git a/src/modules/chat.js b/src/modules/shout.js index ffeb272b..507a4d83 100644 --- a/src/modules/chat.js +++ b/src/modules/shout.js @@ -1,4 +1,4 @@ -const chat = { +const shout = { state: { messages: [], channel: { state: '' } @@ -16,9 +16,8 @@ const chat = { } }, actions: { - initializeChat (store, socket) { + initializeShout (store, socket) { const channel = socket.channel('chat:public') - channel.on('new_msg', (msg) => { store.commit('addMessage', msg) }) @@ -31,4 +30,4 @@ const chat = { } } -export default chat +export default shout diff --git a/src/modules/users.js b/src/modules/users.js index 8a764a16..fb92cc91 100644 --- a/src/modules/users.js +++ b/src/modules/users.js @@ -246,6 +246,11 @@ export const getters = { } return result }, + findUserByUrl: state => query => { + return state.users + .find(u => u.statusnet_profile_url && + u.statusnet_profile_url.toLowerCase() === query.toLowerCase()) + }, relationship: state => id => { const rel = id && state.relationships[id] return rel || { id, loading: true } @@ -531,7 +536,7 @@ const users = { if (user.token) { store.dispatch('setWsToken', user.token) - // Initialize the chat socket. + // Initialize the shout socket. store.dispatch('initializeSocket') } |
