Merge remote-tracking branch 'origin/develop' into vue3-again
* origin/develop: (475 commits) Apply 1 suggestion(s) to 1 file(s) Update dependency @ungap/event-target to v0.2.3 Update package.json fix broken icons after FA upgrade Update Font Awesome Update dependency webpack-dev-middleware to v3.7.3 Update dependency vuelidate to v0.7.7 Pin dependency @kazvmoe-infra/pinch-zoom-element to 1.2.0 lint Make media modal buttons larger Add English translation for hide tooltip Add hide button to media modal Lint Prevent hiding media viewer if swiped over SwipeClick Fix webkit image blurs Fix video in media modal not displaying properly Add changelog for https://git.pleroma.social/pleroma/pleroma-fe/-/merge_requests/1403 Remove image box-shadow in media modal Clean up debug code for image pinch zoom Bump @kazvmoe-infra/pinch-zoom-element to 1.2.0 on npm ...
This commit is contained in:
commit
cd4ad2df11
184 changed files with 11589 additions and 3790 deletions
|
@ -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 }) {
|
||||
|
|
|
@ -10,18 +10,26 @@ const browserLocale = (window.navigator.language || 'en').split('-')[0]
|
|||
*/
|
||||
export const multiChoiceProperties = [
|
||||
'postContentType',
|
||||
'subjectLineBehavior'
|
||||
'subjectLineBehavior',
|
||||
'conversationDisplay', // tree | linear
|
||||
'conversationOtherRepliesButton', // below | inside
|
||||
'mentionLinkDisplay' // short | full_for_remote | full
|
||||
]
|
||||
|
||||
export const defaultState = {
|
||||
expertLevel: 0, // used to track which settings to show and hide
|
||||
colors: {},
|
||||
theme: undefined,
|
||||
customTheme: undefined,
|
||||
customThemeSource: undefined,
|
||||
hideISP: false,
|
||||
hideInstanceWallpaper: false,
|
||||
hideShoutbox: false,
|
||||
// bad name: actually hides posts of muted USERS
|
||||
hideMutedPosts: undefined, // instance default
|
||||
hideMutedThreads: undefined, // instance default
|
||||
hideWordFilteredPosts: undefined, // instance default
|
||||
muteBotStatuses: undefined, // instance default
|
||||
collapseMessageWithSubject: undefined, // instance default
|
||||
padEmoji: true,
|
||||
hideAttachments: false,
|
||||
|
@ -33,9 +41,10 @@ export const defaultState = {
|
|||
loopVideoSilentOnly: true,
|
||||
streaming: false,
|
||||
emojiReactionsOnTimeline: true,
|
||||
alwaysShowNewPostButton: false,
|
||||
autohideFloatingPostButton: false,
|
||||
pauseOnUnfocused: true,
|
||||
stopGifs: false,
|
||||
stopGifs: true,
|
||||
replyVisibility: 'all',
|
||||
notificationVisibility: {
|
||||
follows: true,
|
||||
|
@ -53,6 +62,7 @@ export const defaultState = {
|
|||
interfaceLanguage: browserLocale,
|
||||
hideScopeNotice: false,
|
||||
useStreamingApi: false,
|
||||
sidebarRight: undefined, // instance default
|
||||
scopeCopy: undefined, // instance default
|
||||
subjectLineBehavior: undefined, // instance default
|
||||
alwaysShowSubjectInput: undefined, // instance default
|
||||
|
@ -62,12 +72,25 @@ export const defaultState = {
|
|||
hideFilteredStatuses: undefined, // instance default
|
||||
playVideosInModal: false,
|
||||
useOneClickNsfw: false,
|
||||
useContainFit: false,
|
||||
useContainFit: true,
|
||||
greentext: undefined, // instance default
|
||||
useAtIcon: undefined, // instance default
|
||||
mentionLinkDisplay: undefined, // instance default
|
||||
mentionLinkShowTooltip: undefined, // instance default
|
||||
mentionLinkShowAvatar: undefined, // instance default
|
||||
mentionLinkFadeDomain: undefined, // instance default
|
||||
mentionLinkShowYous: undefined, // instance default
|
||||
mentionLinkBoldenYou: undefined, // instance default
|
||||
hidePostStats: undefined, // instance default
|
||||
hideBotIndication: undefined, // instance default
|
||||
hideUserStats: undefined, // instance default
|
||||
virtualScrolling: undefined, // instance default
|
||||
sensitiveByDefault: undefined // instance default
|
||||
sensitiveByDefault: undefined, // instance default
|
||||
conversationDisplay: undefined, // instance default
|
||||
conversationTreeAdvanced: undefined, // instance default
|
||||
conversationOtherRepliesButton: undefined, // instance default
|
||||
conversationTreeFadeAncestors: undefined, // instance default
|
||||
maxDepthInThread: undefined // instance default
|
||||
}
|
||||
|
||||
// caching the instance default properties
|
||||
|
@ -91,7 +114,8 @@ const config = {
|
|||
const { defaultConfig } = rootGetters
|
||||
return {
|
||||
...defaultConfig,
|
||||
...state
|
||||
// Do not override with undefined
|
||||
...Object.fromEntries(Object.entries(state).filter(([k, v]) => v !== undefined))
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
@ -18,13 +18,24 @@ const defaultState = {
|
|||
defaultBanner: '/images/banner.png',
|
||||
background: '/static/aurora_borealis.jpg',
|
||||
collapseMessageWithSubject: false,
|
||||
disableChat: false,
|
||||
greentext: false,
|
||||
useAtIcon: false,
|
||||
mentionLinkDisplay: 'short',
|
||||
mentionLinkShowTooltip: true,
|
||||
mentionLinkShowAvatar: false,
|
||||
mentionLinkFadeDomain: true,
|
||||
mentionLinkShowYous: false,
|
||||
mentionLinkBoldenYou: true,
|
||||
hideFilteredStatuses: false,
|
||||
// bad name: actually hides posts of muted USERS
|
||||
hideMutedPosts: false,
|
||||
hideMutedThreads: true,
|
||||
hideWordFilteredPosts: false,
|
||||
hidePostStats: false,
|
||||
hideBotIndication: false,
|
||||
hideSitename: false,
|
||||
hideUserStats: false,
|
||||
muteBotStatuses: false,
|
||||
loginMethod: 'password',
|
||||
logo: '/static/logo.svg',
|
||||
logoMargin: '.2em',
|
||||
|
@ -43,6 +54,11 @@ const defaultState = {
|
|||
theme: 'pleroma-dark',
|
||||
virtualScrolling: true,
|
||||
sensitiveByDefault: false,
|
||||
conversationDisplay: 'linear',
|
||||
conversationTreeAdvanced: false,
|
||||
conversationOtherRepliesButton: 'below',
|
||||
conversationTreeFadeAncestors: false,
|
||||
maxDepthInThread: 6,
|
||||
|
||||
// Nasty stuff
|
||||
customEmoji: [],
|
||||
|
@ -56,7 +72,7 @@ const defaultState = {
|
|||
knownDomains: [],
|
||||
|
||||
// Feature-set, apparently, not everything here is reported...
|
||||
chatAvailable: false,
|
||||
shoutAvailable: false,
|
||||
pleromaChatMessagesAvailable: false,
|
||||
gopherAvailable: false,
|
||||
mediaProxyAvailable: false,
|
||||
|
@ -97,6 +113,9 @@ const instance = {
|
|||
return instanceDefaultProperties
|
||||
.map(key => [key, state[key]])
|
||||
.reduce((acc, [key, value]) => ({ ...acc, [key]: value }), {})
|
||||
},
|
||||
instanceDomain (state) {
|
||||
return new URL(state.server).hostname
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
|
@ -106,7 +125,7 @@ const instance = {
|
|||
case 'name':
|
||||
dispatch('setPageTitle')
|
||||
break
|
||||
case 'chatAvailable':
|
||||
case 'shoutAvailable':
|
||||
if (value) {
|
||||
dispatch('initializeSocket')
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import fileTypeService from '../services/file_type/file_type.service.js'
|
||||
const supportedTypes = new Set(['image', 'video', 'audio', 'flash'])
|
||||
|
||||
const mediaViewer = {
|
||||
state: {
|
||||
|
@ -10,7 +11,7 @@ const mediaViewer = {
|
|||
setMedia (state, media) {
|
||||
state.media = media
|
||||
},
|
||||
setCurrent (state, index) {
|
||||
setCurrentMedia (state, index) {
|
||||
state.activated = true
|
||||
state.currentIndex = index
|
||||
},
|
||||
|
@ -22,13 +23,13 @@ const mediaViewer = {
|
|||
setMedia ({ commit }, attachments) {
|
||||
const media = attachments.filter(attachment => {
|
||||
const type = fileTypeService.fileType(attachment.mimetype)
|
||||
return type === 'image' || type === 'video' || type === 'audio'
|
||||
return supportedTypes.has(type)
|
||||
})
|
||||
commit('setMedia', media)
|
||||
},
|
||||
setCurrent ({ commit, state }, current) {
|
||||
setCurrentMedia ({ commit, state }, current) {
|
||||
const index = state.media.indexOf(current)
|
||||
commit('setCurrent', index || 0)
|
||||
commit('setCurrentMedia', index || 0)
|
||||
},
|
||||
closeMediaViewer ({ commit }) {
|
||||
commit('close')
|
||||
|
|
137
src/modules/serverSideConfig.js
Normal file
137
src/modules/serverSideConfig.js
Normal file
|
@ -0,0 +1,137 @@
|
|||
import { get, set } from 'lodash'
|
||||
|
||||
const defaultApi = ({ rootState, commit }, { path, value }) => {
|
||||
const params = {}
|
||||
set(params, path, value)
|
||||
return rootState
|
||||
.api
|
||||
.backendInteractor
|
||||
.updateProfile({ params })
|
||||
.then(result => {
|
||||
commit('addNewUsers', [result])
|
||||
commit('setCurrentUser', result)
|
||||
})
|
||||
}
|
||||
|
||||
const notificationsApi = ({ rootState, commit }, { path, value, oldValue }) => {
|
||||
const settings = {}
|
||||
set(settings, path, value)
|
||||
return rootState
|
||||
.api
|
||||
.backendInteractor
|
||||
.updateNotificationSettings({ settings })
|
||||
.then(result => {
|
||||
if (result.status === 'success') {
|
||||
commit('confirmServerSideOption', { name, value })
|
||||
} else {
|
||||
commit('confirmServerSideOption', { name, value: oldValue })
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Map that stores relation between path for reading (from user profile),
|
||||
* for writing (into API) an what API to use.
|
||||
*
|
||||
* Shorthand - instead of { get, set, api? } object it's possible to use string
|
||||
* in case default api is used and get = set
|
||||
*
|
||||
* If no api is specified, defaultApi is used (see above)
|
||||
*/
|
||||
export const settingsMap = {
|
||||
'defaultScope': 'source.privacy',
|
||||
'defaultNSFW': 'source.sensitive', // BROKEN: pleroma/pleroma#2837
|
||||
'stripRichContent': {
|
||||
get: 'source.pleroma.no_rich_text',
|
||||
set: 'no_rich_text'
|
||||
},
|
||||
// Privacy
|
||||
'locked': 'locked',
|
||||
'acceptChatMessages': {
|
||||
get: 'pleroma.accepts_chat_messages',
|
||||
set: 'accepts_chat_messages'
|
||||
},
|
||||
'allowFollowingMove': {
|
||||
get: 'pleroma.allow_following_move',
|
||||
set: 'allow_following_move'
|
||||
},
|
||||
'discoverable': 'source.discoverable',
|
||||
'hideFavorites': {
|
||||
get: 'pleroma.hide_favorites',
|
||||
set: 'hide_favorites'
|
||||
},
|
||||
'hideFollowers': {
|
||||
get: 'pleroma.hide_followers',
|
||||
set: 'hide_followers'
|
||||
},
|
||||
'hideFollows': {
|
||||
get: 'pleroma.hide_follows',
|
||||
set: 'hide_follows'
|
||||
},
|
||||
'hideFollowersCount': {
|
||||
get: 'pleroma.hide_followers_count',
|
||||
set: 'hide_followers_count'
|
||||
},
|
||||
'hideFollowsCount': {
|
||||
get: 'pleroma.hide_follows_count',
|
||||
set: 'hide_follows_count'
|
||||
},
|
||||
// NotificationSettingsAPIs
|
||||
'webPushHideContents': {
|
||||
get: 'pleroma.notification_settings.hide_notification_contents',
|
||||
set: 'hide_notification_contents',
|
||||
api: notificationsApi
|
||||
},
|
||||
'blockNotificationsFromStrangers': {
|
||||
get: 'pleroma.notification_settings.block_from_strangers',
|
||||
set: 'block_from_strangers',
|
||||
api: notificationsApi
|
||||
}
|
||||
}
|
||||
|
||||
export const defaultState = Object.fromEntries(Object.keys(settingsMap).map(key => [key, null]))
|
||||
|
||||
const serverSideConfig = {
|
||||
state: { ...defaultState },
|
||||
mutations: {
|
||||
confirmServerSideOption (state, { name, value }) {
|
||||
set(state, name, value)
|
||||
},
|
||||
wipeServerSideOption (state, { name }) {
|
||||
set(state, name, null)
|
||||
},
|
||||
wipeAllServerSideOptions (state) {
|
||||
Object.keys(settingsMap).forEach(key => {
|
||||
set(state, key, null)
|
||||
})
|
||||
},
|
||||
// Set the settings based on their path location
|
||||
setCurrentUser (state, user) {
|
||||
Object.entries(settingsMap).forEach((map) => {
|
||||
const [name, value] = map
|
||||
const { get: path = value } = value
|
||||
set(state, name, get(user._original, path))
|
||||
})
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
setServerSideOption ({ rootState, state, commit, dispatch }, { name, value }) {
|
||||
const oldValue = get(state, name)
|
||||
const map = settingsMap[name]
|
||||
if (!map) throw new Error('Invalid server-side setting')
|
||||
const { set: path = map, api = defaultApi } = map
|
||||
commit('wipeServerSideOption', { name })
|
||||
|
||||
api({ rootState, commit }, { path, value, oldValue })
|
||||
.catch((e) => {
|
||||
console.warn('Error setting server-side option:', e)
|
||||
commit('confirmServerSideOption', { name, value: oldValue })
|
||||
})
|
||||
},
|
||||
logout ({ commit }) {
|
||||
commit('wipeAllServerSideOptions')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default serverSideConfig
|
|
@ -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
|
|
@ -245,6 +245,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 }
|
||||
|
@ -387,7 +392,7 @@ const users = {
|
|||
toggleActivationStatus ({ rootState, commit }, { user }) {
|
||||
const api = user.deactivated ? rootState.api.backendInteractor.activateUser : rootState.api.backendInteractor.deactivateUser
|
||||
api({ user })
|
||||
.then(({ deactivated }) => commit('updateActivationStatus', { user, deactivated }))
|
||||
.then((user) => { let deactivated = !user.is_active; commit('updateActivationStatus', { user, deactivated }) })
|
||||
},
|
||||
registerPushNotifications (store) {
|
||||
const token = store.state.currentUser.credentials
|
||||
|
@ -530,7 +535,7 @@ const users = {
|
|||
if (user.token) {
|
||||
store.dispatch('setWsToken', user.token)
|
||||
|
||||
// Initialize the chat socket.
|
||||
// Initialize the shout socket.
|
||||
store.dispatch('initializeSocket')
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue