Compare commits
No commits in common. "b30102a45c451818e59dcb6b1cb458813e40ea28" and "ba810b4a2aeb4c5906a5f0a9b42c8749feb77b60" have entirely different histories.
b30102a45c
...
ba810b4a2a
25 changed files with 327 additions and 352 deletions
|
|
@ -1,6 +1,5 @@
|
|||
import { paramsString, promisedRequest } from './helpers.js'
|
||||
|
||||
import { parseChat } from 'src/services/entity_normalizer/entity_normalizer.service.js'
|
||||
import { paramsString, promisedRequest } from './helpers.js'
|
||||
|
||||
const PLEROMA_CHATS_URL = '/api/v1/pleroma/chats'
|
||||
const PLEROMA_CHAT_URL = (id) => `/api/v1/pleroma/chats/by-account-id/${id}`
|
||||
|
|
@ -14,7 +13,7 @@ export const chats = ({ credentials }) =>
|
|||
promisedRequest({
|
||||
url: PLEROMA_CHATS_URL,
|
||||
credentials,
|
||||
}).then(({ data }) => ({
|
||||
}).then((data) => ({
|
||||
chatList: data.map(parseChat).filter((c) => c),
|
||||
}))
|
||||
|
||||
|
|
|
|||
|
|
@ -98,7 +98,6 @@ export const promisedRequest = async ({
|
|||
)
|
||||
.join('&')
|
||||
}
|
||||
|
||||
if (formData || payload) {
|
||||
options.body = formData || JSON.stringify(payload)
|
||||
}
|
||||
|
|
@ -110,37 +109,33 @@ export const promisedRequest = async ({
|
|||
}
|
||||
}
|
||||
|
||||
let response = null
|
||||
const response = await fetch(url, options)
|
||||
|
||||
// 204 is "No content", which fails to parse json (as you'd might think)
|
||||
if (response.ok && response.status === 204) return { _response: response }
|
||||
|
||||
try {
|
||||
response = await fetch(url, options)
|
||||
const data = await (async () => {
|
||||
const [contentType] = response.headers
|
||||
.get('content-type')
|
||||
.split(';')
|
||||
.map((x) => x.toLowerCase().trim())
|
||||
const json = await response.json()
|
||||
|
||||
switch (contentType) {
|
||||
case 'text/plain':
|
||||
return await response.text()
|
||||
case 'application/json':
|
||||
return await response.json()
|
||||
default:
|
||||
return await response.bytes()
|
||||
if (typeof json !== 'object') {
|
||||
return {
|
||||
_response: response,
|
||||
_value: json,
|
||||
}
|
||||
})()
|
||||
}
|
||||
|
||||
const { ok, status } = response
|
||||
json._response = response
|
||||
|
||||
if (ok) {
|
||||
return { response, status, data }
|
||||
} else {
|
||||
if (!response.ok) {
|
||||
throw new StatusCodeError(
|
||||
response.status,
|
||||
data,
|
||||
json,
|
||||
{ url, options },
|
||||
response,
|
||||
)
|
||||
}
|
||||
|
||||
return json
|
||||
} catch (error) {
|
||||
throw new StatusCodeError(
|
||||
response.status,
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
import { concat, each, last, map } from 'lodash'
|
||||
|
||||
import { paramsString, promisedRequest } from './helpers.js'
|
||||
|
||||
import {
|
||||
parseAttachment,
|
||||
parseChat,
|
||||
|
|
@ -11,6 +9,8 @@ import {
|
|||
parseStatus,
|
||||
parseUser,
|
||||
} from 'src/services/entity_normalizer/entity_normalizer.service.js'
|
||||
import { paramsString, promisedRequest } from './helpers.js'
|
||||
|
||||
import { RegistrationError, StatusCodeError } from 'src/services/errors/errors'
|
||||
|
||||
const SUGGESTIONS_URL = '/api/v1/suggestions'
|
||||
|
|
@ -102,7 +102,7 @@ export const fetchUser = ({ id, credentials }) =>
|
|||
promisedRequest({
|
||||
url: `${MASTODON_USER_URL}/${id}`,
|
||||
credentials,
|
||||
}).then(({ data, ...rest }) => ({ ...rest, data: parseUser(data) }))
|
||||
}).then((data) => parseUser(data))
|
||||
|
||||
export const fetchUserByName = ({ name, credentials }) =>
|
||||
promisedRequest({
|
||||
|
|
@ -126,7 +126,7 @@ export const fetchFriends = ({ id, maxId, sinceId, limit = 20, credentials }) =>
|
|||
promisedRequest({
|
||||
url: MASTODON_FOLLOWING_URL(id, { maxId, sinceId, limit }),
|
||||
credentials,
|
||||
}).then(({ data, ...rest }) => ({ ...rest, data: data.map(parseUser) }))
|
||||
}).then((data) => data.map(parseUser))
|
||||
|
||||
export const fetchFollowers = ({
|
||||
id,
|
||||
|
|
@ -143,20 +143,16 @@ export const fetchFollowers = ({
|
|||
withRelationships: true,
|
||||
}),
|
||||
credentials,
|
||||
}).then(({ data, ...rest }) => ({ ...rest, data: data.map(parseUser) }))
|
||||
}).then((data) => data.map(parseUser))
|
||||
|
||||
export const fetchConversation = ({ id, credentials }) =>
|
||||
promisedRequest({
|
||||
url: MASTODON_STATUS_CONTEXT_URL(id),
|
||||
credentials,
|
||||
})
|
||||
.then((result) => ({
|
||||
...result,
|
||||
data: {
|
||||
...result.data,
|
||||
ancestors: result.data.ancestors.map(parseStatus),
|
||||
descendants: result.data.descendants.map(parseStatus),
|
||||
},
|
||||
.then(({ ancestors, descendants }) => ({
|
||||
ancestors: ancestors.map(parseStatus),
|
||||
descendants: descendants.map(parseStatus),
|
||||
}))
|
||||
.catch((error) => {
|
||||
throw new Error('Error fetching timeline', error)
|
||||
|
|
@ -167,7 +163,7 @@ export const fetchStatus = ({ id, credentials }) =>
|
|||
url: MASTODON_STATUS_URL(id),
|
||||
credentials,
|
||||
})
|
||||
.then(({ data, ...rest }) => ({ ...rest, data: parseStatus(data) }))
|
||||
.then((data) => parseStatus(data))
|
||||
.catch((error) => {
|
||||
throw new Error('Error fetching timeline', error)
|
||||
})
|
||||
|
|
@ -177,7 +173,7 @@ export const fetchStatusSource = ({ id, credentials }) =>
|
|||
url: MASTODON_STATUS_SOURCE_URL(id),
|
||||
credentials,
|
||||
})
|
||||
.then(({ data, ...rest }) => ({ ...rest, data: parseSource(data) }))
|
||||
.then((data) => parseSource(data))
|
||||
.catch((error) => {
|
||||
throw new Error('Error fetching timeline', error)
|
||||
})
|
||||
|
|
@ -186,8 +182,9 @@ export const fetchStatusHistory = ({ status, credentials }) =>
|
|||
promisedRequest({
|
||||
url: MASTODON_STATUS_HISTORY_URL(status.id),
|
||||
credentials,
|
||||
}).then(({ data }) => {
|
||||
return [...data].reverse().map((item) => {
|
||||
}).then((data) => {
|
||||
data.reverse()
|
||||
return data.map((item) => {
|
||||
item.originalStatus = status
|
||||
return parseStatus(item)
|
||||
})
|
||||
|
|
@ -280,17 +277,16 @@ export const fetchTimeline = ({
|
|||
return promisedRequest({
|
||||
url: url + paramsString(params),
|
||||
credentials,
|
||||
}).then(async (result) => {
|
||||
}).then(async (data) => {
|
||||
const pagination = parseLinkHeaderPagination(
|
||||
result.response.headers.get('Link'),
|
||||
data._response.headers.get('Link'),
|
||||
{
|
||||
flakeId: timeline !== 'bookmarks' && timeline !== 'notifications',
|
||||
},
|
||||
)
|
||||
|
||||
return {
|
||||
...result,
|
||||
data: result.data.map(isNotifications ? parseNotification : parseStatus),
|
||||
data: data.map(isNotifications ? parseNotification : parseStatus),
|
||||
pagination,
|
||||
}
|
||||
})
|
||||
|
|
@ -305,13 +301,13 @@ export const fetchPinnedStatuses = ({ id, credentials }) =>
|
|||
promisedRequest({
|
||||
url: MASTODON_USER_TIMELINE_URL(id) + '?pinned=true',
|
||||
credentials,
|
||||
}).then(({ data, ...rest }) => ({ ...rest, data: data.map(parseStatus) }))
|
||||
}).then((data) => data.map(parseStatus))
|
||||
|
||||
export const verifyCredentials = ({ credentials }) =>
|
||||
promisedRequest({
|
||||
url: MASTODON_LOGIN_URL,
|
||||
credentials,
|
||||
}).then(({ data, ...rest }) => ({ ...rest, data: parseUser(data) }))
|
||||
}).then((data) => (data.error ? data : parseUser(data)))
|
||||
|
||||
export const suggestions = ({ credentials }) =>
|
||||
promisedRequest({
|
||||
|
|
@ -331,26 +327,25 @@ export const fetchFavoritedByUsers = ({ id, credentials }) =>
|
|||
url: MASTODON_STATUS_FAVORITEDBY_URL(id),
|
||||
method: 'GET',
|
||||
credentials,
|
||||
}).then(({ data, ...rest }) => ({ ...rest, data: parseUser(data) }))
|
||||
}).then((users) => users.map(parseUser))
|
||||
|
||||
export const fetchRebloggedByUsers = ({ id, credentials }) =>
|
||||
promisedRequest({
|
||||
url: MASTODON_STATUS_REBLOGGEDBY_URL(id),
|
||||
method: 'GET',
|
||||
credentials,
|
||||
}).then(({ data, ...rest }) => ({ ...rest, data: parseUser(data) }))
|
||||
}).then((users) => users.map(parseUser))
|
||||
|
||||
export const fetchEmojiReactions = ({ id, credentials }) =>
|
||||
promisedRequest({
|
||||
url: PLEROMA_EMOJI_REACTIONS_URL(id),
|
||||
credentials,
|
||||
}).then(({ data, ...rest }) => ({
|
||||
...rest,
|
||||
data: data.map((r) => {
|
||||
}).then((reactions) =>
|
||||
reactions.map((r) => {
|
||||
r.accounts = r.accounts.map(parseUser)
|
||||
return r
|
||||
}),
|
||||
}))
|
||||
)
|
||||
|
||||
export const searchUsers = ({ credentials, query }) =>
|
||||
promisedRequest({
|
||||
|
|
@ -360,7 +355,7 @@ export const searchUsers = ({ credentials, query }) =>
|
|||
resolve: true,
|
||||
},
|
||||
credentials,
|
||||
}).then(({ data, ...rest }) => ({ ...rest, data: data.map(parseUser) }))
|
||||
}).then((data) => data.map(parseUser))
|
||||
|
||||
export const search2 = ({
|
||||
credentials,
|
||||
|
|
@ -409,10 +404,10 @@ export const search2 = ({
|
|||
url,
|
||||
credentials,
|
||||
})
|
||||
.then(({ data, ...rest }) => {
|
||||
.then((data) => {
|
||||
data.accounts = data.accounts.slice(0, limit).map((u) => parseUser(u))
|
||||
data.statuses = data.statuses.slice(0, limit).map((s) => parseStatus(s))
|
||||
return { ...rest, data }
|
||||
return data
|
||||
})
|
||||
.catch((error) => {
|
||||
throw new Error('Error fetching timeline', error)
|
||||
|
|
|
|||
|
|
@ -1,13 +1,14 @@
|
|||
import { concat, each, last, map } from 'lodash'
|
||||
|
||||
import { paramsString, promisedRequest } from './helpers.js'
|
||||
import { fetchFriends, MASTODON_STATUS_URL } from './public.js'
|
||||
|
||||
import {
|
||||
parseAttachment,
|
||||
parseNotification,
|
||||
parseSource,
|
||||
parseStatus,
|
||||
parseUser,
|
||||
} from 'src/services/entity_normalizer/entity_normalizer.service.js'
|
||||
import { paramsString, promisedRequest } from './helpers.js'
|
||||
import { fetchFriends, MASTODON_STATUS_URL } from './public.js'
|
||||
|
||||
const MUTES_IMPORT_URL = '/api/pleroma/mutes_import'
|
||||
const BLOCKS_IMPORT_URL = '/api/pleroma/blocks_import'
|
||||
|
|
@ -98,42 +99,42 @@ export const favorite = ({ id, credentials }) =>
|
|||
url: MASTODON_FAVORITE_URL(id),
|
||||
method: 'POST',
|
||||
credentials,
|
||||
}).then(({ data, ...rest }) => ({ ...rest, data: parseStatus(data) }))
|
||||
}).then((data) => parseStatus(data))
|
||||
|
||||
export const unfavorite = ({ id, credentials }) =>
|
||||
promisedRequest({
|
||||
url: MASTODON_UNFAVORITE_URL(id),
|
||||
method: 'POST',
|
||||
credentials,
|
||||
}).then(({ data, ...rest }) => ({ ...rest, data: parseStatus(data) }))
|
||||
}).then((data) => parseStatus(data))
|
||||
|
||||
export const retweet = ({ id, credentials }) =>
|
||||
promisedRequest({
|
||||
url: MASTODON_RETWEET_URL(id),
|
||||
method: 'POST',
|
||||
credentials,
|
||||
}).then(({ data, ...rest }) => ({ ...rest, data: parseStatus(data) }))
|
||||
}).then((data) => parseStatus(data))
|
||||
|
||||
export const unretweet = ({ id, credentials }) =>
|
||||
promisedRequest({
|
||||
url: MASTODON_UNRETWEET_URL(id),
|
||||
method: 'POST',
|
||||
credentials,
|
||||
}).then(({ data, ...rest }) => ({ ...rest, data: parseStatus(data) }))
|
||||
}).then((data) => parseStatus(data))
|
||||
|
||||
export const reactWithEmoji = ({ id, emoji, credentials }) =>
|
||||
promisedRequest({
|
||||
url: PLEROMA_EMOJI_REACT_URL(id, emoji),
|
||||
method: 'PUT',
|
||||
credentials,
|
||||
}).then(({ data, ...rest }) => ({ ...rest, data: parseStatus(data) }))
|
||||
}).then(parseStatus)
|
||||
|
||||
export const unreactWithEmoji = ({ id, emoji, credentials }) =>
|
||||
promisedRequest({
|
||||
url: PLEROMA_EMOJI_UNREACT_URL(id, emoji),
|
||||
method: 'DELETE',
|
||||
credentials,
|
||||
}).then(({ data, ...rest }) => ({ ...rest, data: parseStatus(data) }))
|
||||
}).then(parseStatus)
|
||||
|
||||
export const bookmarkStatus = ({ id, credentials, ...options }) =>
|
||||
promisedRequest({
|
||||
|
|
@ -157,28 +158,28 @@ export const pinOwnStatus = ({ id, credentials }) =>
|
|||
url: MASTODON_PIN_OWN_STATUS(id),
|
||||
credentials,
|
||||
method: 'POST',
|
||||
}).then(({ data, ...rest }) => ({ ...rest, data: parseStatus(data) }))
|
||||
}).then((data) => parseStatus(data))
|
||||
|
||||
export const unpinOwnStatus = ({ id, credentials }) =>
|
||||
promisedRequest({
|
||||
url: MASTODON_UNPIN_OWN_STATUS(id),
|
||||
credentials,
|
||||
method: 'POST',
|
||||
}).then(({ data, ...rest }) => ({ ...rest, data: parseStatus(data) }))
|
||||
}).then((data) => parseStatus(data))
|
||||
|
||||
export const muteConversation = ({ id, credentials }) =>
|
||||
promisedRequest({
|
||||
url: MASTODON_MUTE_CONVERSATION(id),
|
||||
credentials,
|
||||
method: 'POST',
|
||||
}).then(({ data, ...rest }) => ({ ...rest, data: parseStatus(data) }))
|
||||
}).then((data) => parseStatus(data))
|
||||
|
||||
export const unmuteConversation = ({ id, credentials }) =>
|
||||
promisedRequest({
|
||||
url: MASTODON_UNMUTE_CONVERSATION(id),
|
||||
credentials,
|
||||
method: 'POST',
|
||||
}).then(({ data, ...rest }) => ({ ...rest, data: parseStatus(data) }))
|
||||
}).then((data) => parseStatus(data))
|
||||
|
||||
export const vote = ({ pollId, choices, credentials }) => {
|
||||
const form = new FormData()
|
||||
|
|
@ -255,7 +256,7 @@ export const postStatus = ({
|
|||
method: 'POST',
|
||||
credentials,
|
||||
headers,
|
||||
}).then(({ data, ...rest }) => ({ ...rest, data: parseStatus(data) }))
|
||||
}).then((data) => (data.error ? data : parseStatus(data)))
|
||||
}
|
||||
|
||||
export const editStatus = ({
|
||||
|
|
@ -298,7 +299,7 @@ export const editStatus = ({
|
|||
formData: form,
|
||||
method: 'PUT',
|
||||
credentials,
|
||||
}).then(({ data, ...rest }) => ({ ...rest, data: parseStatus(data) }))
|
||||
}).then((data) => (data.error ? data : parseStatus(data)))
|
||||
}
|
||||
|
||||
export const deleteStatus = ({ id, credentials }) =>
|
||||
|
|
@ -314,7 +315,7 @@ export const uploadMedia = ({ formData, credentials }) =>
|
|||
formData,
|
||||
method: 'POST',
|
||||
credentials,
|
||||
}).then(({ data, ...rest }) => ({ ...rest, data: parseAttachment(data) }))
|
||||
}).then((data) => parseAttachment(data))
|
||||
|
||||
export const setMediaDescription = ({ id, description, credentials }) =>
|
||||
promisedRequest({
|
||||
|
|
@ -324,7 +325,7 @@ export const setMediaDescription = ({ id, description, credentials }) =>
|
|||
payload: {
|
||||
description,
|
||||
},
|
||||
}).then(({ data, ...rest }) => ({ ...rest, data: parseAttachment(data) }))
|
||||
}).then((data) => parseAttachment(data))
|
||||
|
||||
// #Notifications
|
||||
export const dismissNotification = ({ credentials, id }) =>
|
||||
|
|
@ -455,7 +456,12 @@ export const updateProfileImages = ({
|
|||
credentials,
|
||||
method: 'PATCH',
|
||||
formData: form,
|
||||
}).then(({ data, ...rest }) => ({ ...rest, data: parseUser(data) }))
|
||||
}).then((data) => {
|
||||
if (data.error) {
|
||||
throw new Error(data.error)
|
||||
}
|
||||
return parseUser(data)
|
||||
})
|
||||
}
|
||||
|
||||
export const updateProfile = ({ credentials, params }) => {
|
||||
|
|
@ -483,7 +489,7 @@ export const updateProfile = ({ credentials, params }) => {
|
|||
credentials,
|
||||
method: 'PATCH',
|
||||
formData,
|
||||
}).then(({ data, ...rest }) => ({ ...rest, data: parseUser(data) }))
|
||||
}).then((data) => parseUser(data))
|
||||
}
|
||||
|
||||
export const updateProfileJSON = ({ credentials, params }) =>
|
||||
|
|
@ -492,7 +498,7 @@ export const updateProfileJSON = ({ credentials, params }) =>
|
|||
credentials,
|
||||
payload: params,
|
||||
method: 'PATCH',
|
||||
}).then(({ data, ...rest }) => ({ ...rest, data: parseUser(data) }))
|
||||
}).then((data) => parseUser(data))
|
||||
|
||||
export const changeEmail = ({ credentials, email, password }) => {
|
||||
const form = new FormData()
|
||||
|
|
@ -665,7 +671,7 @@ export const fetchFollowRequests = ({ credentials }) =>
|
|||
promisedRequest({
|
||||
url: MASTODON_FOLLOW_REQUESTS_URL,
|
||||
credentials,
|
||||
}).then(({ data, ...rest }) => ({ ...rest, data: data.map(parseUser) }))
|
||||
}).then((data) => data.map(parseUser))
|
||||
|
||||
export const approveUser = ({ id, credentials }) =>
|
||||
promisedRequest({
|
||||
|
|
@ -695,7 +701,7 @@ export const fetchMutes = ({ maxId, credentials }) =>
|
|||
promisedRequest({
|
||||
url: MASTODON_USER_MUTES_URL({ maxId, withRelationships: true }),
|
||||
credentials,
|
||||
}).then(({ data, ...rest }) => ({ ...rest, data: data.map(parseUser) }))
|
||||
}).then((users) => users.map(parseUser))
|
||||
|
||||
export const muteUser = ({ id, expiresIn, credentials }) => {
|
||||
const payload = {}
|
||||
|
|
@ -722,7 +728,7 @@ export const fetchBlocks = ({ maxId, credentials }) =>
|
|||
promisedRequest({
|
||||
url: MASTODON_USER_BLOCKS_URL({ maxId, withRelationships: true }),
|
||||
credentials,
|
||||
}).then(({ data, ...rest }) => ({ ...rest, data: data.map(parseUser) }))
|
||||
}).then((users) => users.map(parseUser))
|
||||
|
||||
export const blockUser = ({ id, expiresIn, credentials }) => {
|
||||
const payload = {}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import { mapGetters, mapState } from 'vuex'
|
|||
import ChatMessage from 'src/components/chat_message/chat_message.vue'
|
||||
import ChatTitle from 'src/components/chat_title/chat_title.vue'
|
||||
import PostStatusForm from 'src/components/post_status_form/post_status_form.vue'
|
||||
import { WSConnectionStatus } from 'src/api/public.js'
|
||||
import chatService from '../../services/chat_service/chat_service.js'
|
||||
import { buildFakeMessage } from '../../services/chat_utils/chat_utils.js'
|
||||
import { promiseInterval } from '../../services/promise_interval/promise_interval.js'
|
||||
|
|
@ -23,7 +24,6 @@ import {
|
|||
getOrCreateChat,
|
||||
sendChatMessage,
|
||||
} from 'src/api/chats.js'
|
||||
import { WSConnectionStatus } from 'src/api/public.js'
|
||||
|
||||
import { library } from '@fortawesome/fontawesome-svg-core'
|
||||
import { faChevronDown, faChevronLeft } from '@fortawesome/free-solid-svg-icons'
|
||||
|
|
|
|||
|
|
@ -5,16 +5,13 @@ import { mapState } from 'vuex'
|
|||
import QuickFilterSettings from 'src/components/quick_filter_settings/quick_filter_settings.vue'
|
||||
import QuickViewSettings from 'src/components/quick_view_settings/quick_view_settings.vue'
|
||||
import ThreadTree from 'src/components/thread_tree/thread_tree.vue'
|
||||
import { WSConnectionStatus } from 'src/api/public.js'
|
||||
|
||||
import { useOAuthStore } from 'src/stores/oauth.js'
|
||||
import { useInterfaceStore } from 'src/stores/interface'
|
||||
import { useMergedConfigStore } from 'src/stores/merged_config.js'
|
||||
import { useOAuthStore } from 'src/stores/oauth.js'
|
||||
|
||||
import {
|
||||
fetchConversation,
|
||||
fetchStatus,
|
||||
WSConnectionStatus,
|
||||
} from 'src/api/public.js'
|
||||
import { fetchConversation, fetchStatus } from 'src/api/public.js'
|
||||
|
||||
import { library } from '@fortawesome/fontawesome-svg-core'
|
||||
import {
|
||||
|
|
|
|||
|
|
@ -10,9 +10,9 @@ import SharedComputedObject from '../helpers/shared_computed_object.js'
|
|||
import UnitSetting from '../helpers/unit_setting.vue'
|
||||
import Preview from './old_theme_tab/theme_preview.vue'
|
||||
|
||||
import { useOAuthStore } from 'src/stores/oauth.js'
|
||||
import { useInstanceStore } from 'src/stores/instance.js'
|
||||
import { normalizeThemeData, useInterfaceStore } from 'src/stores/interface.js'
|
||||
import { useOAuthStore } from 'src/stores/oauth.js'
|
||||
|
||||
import { updateProfileImages } from 'src/api/user.js'
|
||||
import { newImporter } from 'src/services/export_import/export_import.js'
|
||||
|
|
|
|||
|
|
@ -11,10 +11,10 @@ import IntegerSetting from '../helpers/integer_setting.vue'
|
|||
import SharedComputedObject from '../helpers/shared_computed_object.js'
|
||||
import UnitSetting from '../helpers/unit_setting.vue'
|
||||
|
||||
import { useOAuthStore } from 'src/stores/oauth.js'
|
||||
import { useInstanceStore } from 'src/stores/instance.js'
|
||||
import { useInstanceCapabilitiesStore } from 'src/stores/instance_capabilities.js'
|
||||
import { useMergedConfigStore } from 'src/stores/merged_config.js'
|
||||
import { useOAuthStore } from 'src/stores/oauth.js'
|
||||
import { useSyncConfigStore } from 'src/stores/sync_config.js'
|
||||
|
||||
import { updateProfile } from 'src/api/user.js'
|
||||
|
|
|
|||
|
|
@ -8,11 +8,11 @@ import FloatSetting from '../helpers/float_setting.vue'
|
|||
import SharedComputedObject from '../helpers/shared_computed_object.js'
|
||||
import UnitSetting from '../helpers/unit_setting.vue'
|
||||
|
||||
import { useOAuthStore } from 'src/stores/oauth.js'
|
||||
import { useInstanceStore } from 'src/stores/instance.js'
|
||||
import { useInstanceCapabilitiesStore } from 'src/stores/instance_capabilities.js'
|
||||
import { useLocalConfigStore } from 'src/stores/local_config.js'
|
||||
import { useMergedConfigStore } from 'src/stores/merged_config.js'
|
||||
import { useOAuthStore } from 'src/stores/oauth.js'
|
||||
import { useSyncConfigStore } from 'src/stores/sync_config.js'
|
||||
|
||||
import { updateProfile } from 'src/api/user.js'
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import { Socket } from 'phoenix'
|
||||
|
||||
import { WSConnectionStatus } from 'src/api/public.js'
|
||||
import { maybeShowChatNotification } from '../services/chat_utils/chat_utils.js'
|
||||
|
||||
import { useInstanceStore } from 'src/stores/instance.js'
|
||||
|
|
@ -12,7 +13,6 @@ import {
|
|||
fetchTimeline,
|
||||
getMastodonSocketURI,
|
||||
ProcessedWS,
|
||||
WSConnectionStatus,
|
||||
} from 'src/api/public.js'
|
||||
import followRequestFetcher from 'src/services/follow_request_fetcher/follow_request_fetcher.service'
|
||||
import notificationsFetcher from 'src/services/notifications_fetcher/notifications_fetcher.service.js'
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import { markNotificationsAsSeen } from 'src/api/user.js'
|
||||
import {
|
||||
closeAllDesktopNotifications,
|
||||
closeDesktopNotification,
|
||||
|
|
@ -14,7 +15,7 @@ import { useOAuthStore } from 'src/stores/oauth.js'
|
|||
import { useReportsStore } from 'src/stores/reports.js'
|
||||
import { useSyncConfigStore } from 'src/stores/sync_config.js'
|
||||
|
||||
import { dismissNotification, markNotificationsAsSeen } from 'src/api/user.js'
|
||||
import { dismissNotification } from 'src/api/user.js'
|
||||
|
||||
const emptyNotifications = () => ({
|
||||
desktopNotificationSilence: true,
|
||||
|
|
|
|||
|
|
@ -2,7 +2,10 @@ import { get, set } from 'lodash'
|
|||
|
||||
import { useOAuthStore } from 'src/stores/oauth.js'
|
||||
|
||||
import { updateNotificationSettings, updateProfile } from 'src/api/user.js'
|
||||
import {
|
||||
updateNotificationSettings,
|
||||
updateProfile,
|
||||
} from 'src/api/user.js'
|
||||
|
||||
const defaultApi = ({ rootState, commit }, { path, value }) => {
|
||||
const params = {}
|
||||
|
|
|
|||
|
|
@ -158,7 +158,7 @@ const getLatestScrobble = (state, user) => {
|
|||
state.scrobblesNextFetch[user.id] = Date.now() + 24 * 60 * 60 * 1000
|
||||
if (!scrobblesSupport) return
|
||||
fetchScrobbles({ accountId: user.id })
|
||||
.then(({ data: scrobbles }) => {
|
||||
.then((scrobbles) => {
|
||||
if (scrobbles?.error) {
|
||||
useInstanceCapabilitiesStore().set('pleromaScrobblesAvailable', false)
|
||||
return
|
||||
|
|
@ -627,7 +627,7 @@ const statuses = {
|
|||
})
|
||||
},
|
||||
fetchStatus({ rootState, dispatch }, id) {
|
||||
return fetchStatus({ id }).then(({ data: status }) =>
|
||||
return fetchStatus({ id }).then((status) =>
|
||||
dispatch('addNewStatuses', { statuses: [status] }),
|
||||
)
|
||||
},
|
||||
|
|
@ -635,10 +635,10 @@ const statuses = {
|
|||
return fetchStatusSource({
|
||||
id: status.id,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then(({ data }) => data)
|
||||
})
|
||||
},
|
||||
fetchStatusHistory(_, status) {
|
||||
return fetchStatusHistory({ status }).then(({ data }) => data)
|
||||
return fetchStatusHistory({ status })
|
||||
},
|
||||
deleteStatus({ rootState, commit }, status) {
|
||||
deleteStatus({
|
||||
|
|
@ -670,7 +670,7 @@ const statuses = {
|
|||
favorite({
|
||||
id: status.id,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then(({ data: status }) =>
|
||||
}).then((status) =>
|
||||
commit('setFavoritedConfirm', {
|
||||
status,
|
||||
user: rootState.users.currentUser,
|
||||
|
|
@ -683,7 +683,7 @@ const statuses = {
|
|||
unfavorite({
|
||||
id: status.id,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then(({ data: status }) =>
|
||||
}).then((status) =>
|
||||
commit('setFavoritedConfirm', {
|
||||
status,
|
||||
user: rootState.users.currentUser,
|
||||
|
|
@ -694,7 +694,7 @@ const statuses = {
|
|||
fetchPinnedStatuses({
|
||||
id: userId,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then(({ data: statuses }) =>
|
||||
}).then((statuses) =>
|
||||
dispatch('addNewStatuses', {
|
||||
statuses,
|
||||
timeline: 'user',
|
||||
|
|
@ -708,29 +708,25 @@ const statuses = {
|
|||
return pinOwnStatus({
|
||||
id: statusId,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then(({ data: status }) =>
|
||||
dispatch('addNewStatuses', { statuses: [status] }),
|
||||
)
|
||||
}).then((status) => dispatch('addNewStatuses', { statuses: [status] }))
|
||||
},
|
||||
unpinStatus({ rootState, dispatch }, statusId) {
|
||||
return unpinOwnStatus({
|
||||
id: statusId,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then(({ data: status }) =>
|
||||
dispatch('addNewStatuses', { statuses: [status] }),
|
||||
)
|
||||
}).then((status) => dispatch('addNewStatuses', { statuses: [status] }))
|
||||
},
|
||||
muteConversation({ rootState, commit }, { id: statusId }) {
|
||||
return muteConversation({
|
||||
id: statusId,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then(({ data: status }) => commit('setMutedStatus', status))
|
||||
}).then((status) => commit('setMutedStatus', status))
|
||||
},
|
||||
unmuteConversation({ rootState, commit }, { id: statusId }) {
|
||||
return unmuteConversation({
|
||||
id: statusId,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then(({ data: status }) => commit('setMutedStatus', status))
|
||||
}).then((status) => commit('setMutedStatus', status))
|
||||
},
|
||||
retweet({ rootState, commit }, status) {
|
||||
// Optimistic retweeting...
|
||||
|
|
@ -738,7 +734,7 @@ const statuses = {
|
|||
retweet({
|
||||
id: status.id,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then(({ data: status }) =>
|
||||
}).then((status) =>
|
||||
commit('setRetweetedConfirm', {
|
||||
status: status.retweeted_status,
|
||||
user: rootState.users.currentUser,
|
||||
|
|
@ -751,7 +747,7 @@ const statuses = {
|
|||
unretweet({
|
||||
id: status.id,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then(({ data: status }) =>
|
||||
}).then((status) =>
|
||||
commit('setRetweetedConfirm', {
|
||||
status,
|
||||
user: rootState.users.currentUser,
|
||||
|
|
@ -764,7 +760,7 @@ const statuses = {
|
|||
id: status.id,
|
||||
folder_id: status.bookmark_folder_id,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then(({ data: status }) => {
|
||||
}).then((status) => {
|
||||
commit('setBookmarkedConfirm', { status })
|
||||
})
|
||||
},
|
||||
|
|
@ -773,7 +769,7 @@ const statuses = {
|
|||
unbookmarkStatus({
|
||||
id: status.id,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then(({ data: status }) => {
|
||||
}).then((status) => {
|
||||
commit('setBookmarkedConfirm', { status })
|
||||
})
|
||||
},
|
||||
|
|
@ -793,7 +789,7 @@ const statuses = {
|
|||
id,
|
||||
credentials: useOAuthStore().token,
|
||||
}),
|
||||
]).then(([{ data: favoritedByUsers }, { data: rebloggedByUsers }]) => {
|
||||
]).then(([favoritedByUsers, rebloggedByUsers]) => {
|
||||
commit('addFavs', {
|
||||
id,
|
||||
favoritedByUsers,
|
||||
|
|
@ -836,7 +832,7 @@ const statuses = {
|
|||
return fetchEmojiReactions({
|
||||
id,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then(({ data: emojiReactions }) => {
|
||||
}).then((emojiReactions) => {
|
||||
commit('addEmojiReactionsBy', {
|
||||
id,
|
||||
emojiReactions,
|
||||
|
|
@ -848,7 +844,7 @@ const statuses = {
|
|||
fetchFavoritedByUsers({
|
||||
id,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then(({ data: favoritedByUsers }) =>
|
||||
}).then((favoritedByUsers) =>
|
||||
commit('addFavs', {
|
||||
id,
|
||||
favoritedByUsers,
|
||||
|
|
@ -860,7 +856,7 @@ const statuses = {
|
|||
fetchRebloggedByUsers({
|
||||
id,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then(({ data: rebloggedByUsers }) =>
|
||||
}).then((rebloggedByUsers) =>
|
||||
commit('addRepeats', {
|
||||
id,
|
||||
rebloggedByUsers,
|
||||
|
|
@ -877,7 +873,7 @@ const statuses = {
|
|||
following,
|
||||
type,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then(({ data }) => {
|
||||
}).then((data) => {
|
||||
store.commit('addNewUsers', data.accounts)
|
||||
store.commit(
|
||||
'addNewUsers',
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import {
|
|||
uniq,
|
||||
} from 'lodash'
|
||||
|
||||
import { register } from 'src/api/public.js'
|
||||
import oauthApi from '../services/new_api/oauth.js'
|
||||
import {
|
||||
registerPushNotifications,
|
||||
|
|
@ -36,21 +37,17 @@ import {
|
|||
fetchUser,
|
||||
fetchUserByName,
|
||||
getCaptcha,
|
||||
register,
|
||||
searchUsers,
|
||||
verifyCredentials,
|
||||
} from 'src/api/public.js'
|
||||
import {
|
||||
blockUser as apiBlockUser,
|
||||
muteUser as apiMuteUser,
|
||||
unblockUser as apiUnblockUser,
|
||||
unmuteUser as apiUnmuteUser,
|
||||
fetchBlocks,
|
||||
fetchDomainMutes,
|
||||
fetchMutes,
|
||||
fetchUserInLists,
|
||||
fetchUserRelationship,
|
||||
followUser,
|
||||
muteUser,
|
||||
} from 'src/api/user.js'
|
||||
|
||||
// TODO: Unify with mergeOrAdd in statuses.js
|
||||
|
|
@ -95,7 +92,7 @@ const blockUser = (store, args) => {
|
|||
store.commit('updateUserRelationship', [predictedRelationship])
|
||||
store.commit('addBlockId', id)
|
||||
|
||||
return apiBlockUser({ id, expiresIn }).then(({ data: relationship }) => {
|
||||
return blockUser({ id, expiresIn }).then((relationship) => {
|
||||
store.commit('updateUserRelationship', [relationship])
|
||||
store.commit('addBlockId', id)
|
||||
|
||||
|
|
@ -109,7 +106,7 @@ const blockUser = (store, args) => {
|
|||
}
|
||||
|
||||
const unblockUser = (store, id) => {
|
||||
return apiUnblockUser({ id }).then(({ data: relationship }) =>
|
||||
return unblockUser({ id }).then((relationship) =>
|
||||
store.commit('updateUserRelationship', [relationship]),
|
||||
)
|
||||
}
|
||||
|
|
@ -126,7 +123,7 @@ const editUserNote = (store, { id, comment }) => {
|
|||
)
|
||||
}
|
||||
|
||||
const muteUser = (store, args) => {
|
||||
const localMuteUser = (store, args) => {
|
||||
const id = typeof args === 'object' ? args.id : args
|
||||
const expiresIn = typeof args === 'object' ? args.expiresIn : 0
|
||||
|
||||
|
|
@ -134,11 +131,11 @@ const muteUser = (store, args) => {
|
|||
store.commit('updateUserRelationship', [predictedRelationship])
|
||||
store.commit('addMuteId', id)
|
||||
|
||||
return apiMuteUser({
|
||||
return muteUser({
|
||||
id,
|
||||
expiresIn,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then(({ data: relationship }) => {
|
||||
}).then((relationship) => {
|
||||
store.commit('updateUserRelationship', [relationship])
|
||||
store.commit('addMuteId', id)
|
||||
})
|
||||
|
|
@ -149,7 +146,7 @@ const unmuteUser = (store, id) => {
|
|||
predictedRelationship.muting = false
|
||||
store.commit('updateUserRelationship', [predictedRelationship])
|
||||
|
||||
return apiUnmuteUser({ id }).then(({ data: relationship }) =>
|
||||
return unmuteUser({ id }).then((relationship) =>
|
||||
store.commit('updateUserRelationship', [relationship]),
|
||||
)
|
||||
}
|
||||
|
|
@ -159,9 +156,9 @@ const hideReblogs = (store, userId) => {
|
|||
id: userId,
|
||||
reblogs: false,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then(({ data: relationship }) =>
|
||||
store.commit('updateUserRelationship', [relationship]),
|
||||
)
|
||||
}).then((relationship) => {
|
||||
store.commit('updateUserRelationship', [relationship])
|
||||
})
|
||||
}
|
||||
|
||||
const showReblogs = (store, userId) => {
|
||||
|
|
@ -169,7 +166,7 @@ const showReblogs = (store, userId) => {
|
|||
id: userId,
|
||||
reblogs: true,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then(({ data: relationship }) =>
|
||||
}).then((relationship) =>
|
||||
store.commit('updateUserRelationship', [relationship]),
|
||||
)
|
||||
}
|
||||
|
|
@ -409,24 +406,16 @@ const users = {
|
|||
return fetchUser({
|
||||
id,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then((user) => {
|
||||
store.commit('addNewUsers', [user])
|
||||
return user
|
||||
})
|
||||
.then(({ data: user }) => {
|
||||
store.commit('addNewUsers', [user])
|
||||
return user
|
||||
})
|
||||
.catch((error) => {
|
||||
if (error.statusCode === 404) {
|
||||
console.warn(`User ${id} not found`)
|
||||
} else {
|
||||
throw error
|
||||
}
|
||||
})
|
||||
},
|
||||
fetchUserByName(store, name) {
|
||||
return fetchUserByName({
|
||||
name,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then(({ data: user }) => {
|
||||
}).then((user) => {
|
||||
store.commit('addNewUsers', [user])
|
||||
return user
|
||||
})
|
||||
|
|
@ -436,7 +425,7 @@ const users = {
|
|||
fetchUserRelationship({
|
||||
id,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then(({ data: relationships }) =>
|
||||
}).then((relationships) =>
|
||||
store.commit('updateUserRelationship', relationships),
|
||||
)
|
||||
}
|
||||
|
|
@ -446,9 +435,7 @@ const users = {
|
|||
fetchUserInLists({
|
||||
id,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then(({ data: inLists }) =>
|
||||
store.commit('updateUserInLists', { id, inLists }),
|
||||
)
|
||||
}).then((inLists) => store.commit('updateUserInLists', { id, inLists }))
|
||||
}
|
||||
},
|
||||
fetchBlocks(store, args) {
|
||||
|
|
@ -458,7 +445,7 @@ const users = {
|
|||
return fetchBlocks({
|
||||
maxId,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then(({ data: blocks }) => {
|
||||
}).then((blocks) => {
|
||||
if (reset) {
|
||||
store.commit('saveBlockIds', map(blocks, 'id'))
|
||||
} else {
|
||||
|
|
@ -496,7 +483,7 @@ const users = {
|
|||
return fetchMutes({
|
||||
maxId,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then(({ data: mutes }) => {
|
||||
}).then((mutes) => {
|
||||
if (reset) {
|
||||
store.commit('saveMuteIds', map(mutes, 'id'))
|
||||
} else {
|
||||
|
|
@ -510,7 +497,7 @@ const users = {
|
|||
})
|
||||
},
|
||||
muteUser(store, data) {
|
||||
return muteUser(store, data)
|
||||
return localMuteUser(store, data)
|
||||
},
|
||||
unmuteUser(store, id) {
|
||||
return unmuteUser(store, id)
|
||||
|
|
@ -522,7 +509,7 @@ const users = {
|
|||
return showReblogs(store, id)
|
||||
},
|
||||
muteUsers(store, data = []) {
|
||||
return Promise.all(data.map((d) => muteUser(store, d)))
|
||||
return Promise.all(data.map((d) => localMuteUser(store, d)))
|
||||
},
|
||||
unmuteUsers(store, ids = []) {
|
||||
return Promise.all(ids.map((d) => unmuteUser(store, d)))
|
||||
|
|
@ -530,7 +517,7 @@ const users = {
|
|||
fetchDomainMutes(store) {
|
||||
return fetchDomainMutes({
|
||||
credentials: useOAuthStore().token,
|
||||
}).then(({ data: domainMutes }) => {
|
||||
}).then((domainMutes) => {
|
||||
store.commit('saveDomainMutes', domainMutes)
|
||||
return domainMutes
|
||||
})
|
||||
|
|
@ -554,7 +541,7 @@ const users = {
|
|||
id,
|
||||
maxId,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then(({ data: friends }) => {
|
||||
}).then((friends) => {
|
||||
commit('addNewUsers', friends)
|
||||
commit('saveFriendIds', { id, friendIds: map(friends, 'id') })
|
||||
return friends
|
||||
|
|
@ -567,7 +554,7 @@ const users = {
|
|||
id,
|
||||
maxId,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then(({ data: followers }) => {
|
||||
}).then((followers) => {
|
||||
commit('addNewUsers', followers)
|
||||
commit('saveFollowerIds', { id, followerIds: map(followers, 'id') })
|
||||
return followers
|
||||
|
|
@ -584,7 +571,7 @@ const users = {
|
|||
id,
|
||||
notify: true,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then(({ data: relationship }) =>
|
||||
}).then((relationship) =>
|
||||
commit('updateUserRelationship', [relationship]),
|
||||
)
|
||||
},
|
||||
|
|
@ -593,7 +580,7 @@ const users = {
|
|||
id,
|
||||
notify: false,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then(({ data: relationship }) =>
|
||||
}).then((relationship) =>
|
||||
commit('updateUserRelationship', [relationship]),
|
||||
)
|
||||
},
|
||||
|
|
@ -659,7 +646,7 @@ const users = {
|
|||
return searchUsers({
|
||||
query,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then(({ data: users }) => {
|
||||
}).then((users) => {
|
||||
commit('addNewUsers', users)
|
||||
return users
|
||||
})
|
||||
|
|
@ -670,7 +657,7 @@ const users = {
|
|||
|
||||
try {
|
||||
const token = await oauthStore.ensureAppToken()
|
||||
const { data } = await register({
|
||||
const data = await register({
|
||||
credentials: token,
|
||||
params: { ...userInfo },
|
||||
})
|
||||
|
|
@ -694,7 +681,7 @@ const users = {
|
|||
getCaptcha(store) {
|
||||
return getCaptcha({
|
||||
credentials: useOAuthStore().token,
|
||||
}).then(({ data }) => data)
|
||||
})
|
||||
},
|
||||
|
||||
logout(store) {
|
||||
|
|
@ -740,128 +727,135 @@ const users = {
|
|||
verifyCredentials({
|
||||
credentials: useOAuthStore().token,
|
||||
})
|
||||
.then(({ data: user }) => {
|
||||
// user.credentials = userCredentials
|
||||
user.credentials = accessToken
|
||||
user.blockIds = []
|
||||
user.muteIds = []
|
||||
user.domainMutes = []
|
||||
commit('setCurrentUser', user)
|
||||
.then((data) => {
|
||||
if (!data.error) {
|
||||
const user = data
|
||||
// user.credentials = userCredentials
|
||||
user.credentials = accessToken
|
||||
user.blockIds = []
|
||||
user.muteIds = []
|
||||
user.domainMutes = []
|
||||
commit('setCurrentUser', user)
|
||||
|
||||
useSyncConfigStore()
|
||||
.initSyncConfig(user)
|
||||
.then(() => {
|
||||
useInterfaceStore()
|
||||
.applyTheme()
|
||||
.catch((e) => {
|
||||
console.error('Error setting theme', e)
|
||||
})
|
||||
useSyncConfigStore()
|
||||
.initSyncConfig(user)
|
||||
.then(() => {
|
||||
useInterfaceStore()
|
||||
.applyTheme()
|
||||
.catch((e) => {
|
||||
console.error('Error setting theme', e)
|
||||
})
|
||||
})
|
||||
useUserHighlightStore().initUserHighlight(user)
|
||||
commit('addNewUsers', [user])
|
||||
|
||||
useEmojiStore().fetchEmoji()
|
||||
|
||||
getNotificationPermission().then((permission) =>
|
||||
useInterfaceStore().setNotificationPermission(permission),
|
||||
)
|
||||
|
||||
// Do server-side storage migrations
|
||||
|
||||
// Debug snippet to clean up storage and reset migrations
|
||||
/*
|
||||
// Reset wordfilter
|
||||
Object.keys(
|
||||
useSyncConfigStore().prefsStorage.simple.muteFilters
|
||||
).forEach(key => {
|
||||
useSyncConfigStore().unsetSimplePrefAndSave({ path: 'muteFilters.' + key, value: null })
|
||||
})
|
||||
useUserHighlightStore().initUserHighlight(user)
|
||||
commit('addNewUsers', [user])
|
||||
|
||||
useEmojiStore().fetchEmoji()
|
||||
// Reset flag to 0 to re-run migrations
|
||||
useSyncConfigStore().setFlag({ flag: 'configMigration', value: 0 })
|
||||
/**/
|
||||
|
||||
getNotificationPermission().then((permission) =>
|
||||
useInterfaceStore().setNotificationPermission(permission),
|
||||
)
|
||||
if (user.token) {
|
||||
dispatch('setWsToken', user.token)
|
||||
|
||||
// Do server-side storage migrations
|
||||
// Initialize the shout socket.
|
||||
dispatch('initializeSocket')
|
||||
}
|
||||
|
||||
// Debug snippet to clean up storage and reset migrations
|
||||
/*
|
||||
// Reset wordfilter
|
||||
Object.keys(
|
||||
useSyncConfigStore().prefsStorage.simple.muteFilters
|
||||
).forEach(key => {
|
||||
useSyncConfigStore().unsetSimplePrefAndSave({ path: 'muteFilters.' + key, value: null })
|
||||
})
|
||||
const startPolling = () => {
|
||||
// Start getting fresh posts.
|
||||
dispatch('startFetchingTimeline', { timeline: 'friends' })
|
||||
|
||||
// Reset flag to 0 to re-run migrations
|
||||
useSyncConfigStore().setFlag({ flag: 'configMigration', value: 0 })
|
||||
/**/
|
||||
// Start fetching notifications
|
||||
dispatch('startFetchingNotifications')
|
||||
|
||||
if (user.token) {
|
||||
dispatch('setWsToken', user.token)
|
||||
if (
|
||||
useInstanceCapabilitiesStore().pleromaChatMessagesAvailable
|
||||
) {
|
||||
// Start fetching chats
|
||||
dispatch('startFetchingChats')
|
||||
}
|
||||
}
|
||||
|
||||
// Initialize the shout socket.
|
||||
dispatch('initializeSocket')
|
||||
}
|
||||
useListsStore().startFetching()
|
||||
useBookmarkFoldersStore().startFetching()
|
||||
|
||||
const startPolling = () => {
|
||||
// Start getting fresh posts.
|
||||
dispatch('startFetchingTimeline', { timeline: 'friends' })
|
||||
if (user.locked) {
|
||||
dispatch('startFetchingFollowRequests')
|
||||
}
|
||||
|
||||
// Start fetching notifications
|
||||
dispatch('startFetchingNotifications')
|
||||
if (useMergedConfigStore().mergedConfig.useStreamingApi) {
|
||||
dispatch('fetchTimeline', {
|
||||
timeline: 'friends',
|
||||
sinceId: null,
|
||||
})
|
||||
dispatch('fetchNotifications', { sinceId: null })
|
||||
dispatch('enableMastoSockets', true)
|
||||
.catch((error) => {
|
||||
console.error(
|
||||
'Failed initializing MastoAPI Streaming socket',
|
||||
error,
|
||||
)
|
||||
})
|
||||
.then(() => {
|
||||
dispatch('fetchChats', { latest: true })
|
||||
setTimeout(
|
||||
() => dispatch('setNotificationsSilence', false),
|
||||
10000,
|
||||
)
|
||||
})
|
||||
} else {
|
||||
startPolling()
|
||||
}
|
||||
|
||||
if (useInstanceCapabilitiesStore().pleromaChatMessagesAvailable) {
|
||||
// Start fetching chats
|
||||
dispatch('startFetchingChats')
|
||||
// Get user mutes
|
||||
dispatch('fetchMutes')
|
||||
|
||||
useInterfaceStore().setLayoutWidth(windowWidth())
|
||||
useInterfaceStore().setLayoutHeight(windowHeight())
|
||||
|
||||
// Fetch our friends
|
||||
fetchFriends({ id: user.id }).then((friends) =>
|
||||
commit('addNewUsers', friends),
|
||||
)
|
||||
} else {
|
||||
const response = data.error
|
||||
// Authentication failed
|
||||
commit('endLogin')
|
||||
|
||||
// remove authentication token on client/authentication errors
|
||||
if ([400, 401, 403, 422].includes(response.status)) {
|
||||
useOAuthStore().clearToken()
|
||||
}
|
||||
|
||||
if (response.status === 401) {
|
||||
reject(new Error('Wrong username or password'))
|
||||
} else {
|
||||
reject(new Error('An error occurred, please try again'))
|
||||
}
|
||||
}
|
||||
|
||||
useListsStore().startFetching()
|
||||
useBookmarkFoldersStore().startFetching()
|
||||
|
||||
if (user.locked) {
|
||||
dispatch('startFetchingFollowRequests')
|
||||
}
|
||||
|
||||
if (useMergedConfigStore().mergedConfig.useStreamingApi) {
|
||||
dispatch('fetchTimeline', {
|
||||
timeline: 'friends',
|
||||
sinceId: null,
|
||||
})
|
||||
dispatch('fetchNotifications', { sinceId: null })
|
||||
dispatch('enableMastoSockets', true)
|
||||
.catch((error) => {
|
||||
console.error(
|
||||
'Failed initializing MastoAPI Streaming socket',
|
||||
error,
|
||||
)
|
||||
})
|
||||
.then(() => {
|
||||
dispatch('fetchChats', { latest: true })
|
||||
setTimeout(
|
||||
() => dispatch('setNotificationsSilence', false),
|
||||
10000,
|
||||
)
|
||||
})
|
||||
} else {
|
||||
startPolling()
|
||||
}
|
||||
|
||||
// Get user mutes
|
||||
dispatch('fetchMutes')
|
||||
|
||||
useInterfaceStore().setLayoutWidth(windowWidth())
|
||||
useInterfaceStore().setLayoutHeight(windowHeight())
|
||||
|
||||
// Fetch our friends
|
||||
fetchFriends({ id: user.id }).then(({ data: friends }) =>
|
||||
commit('addNewUsers', friends),
|
||||
)
|
||||
commit('endLogin')
|
||||
resolve()
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error(error)
|
||||
|
||||
// Authentication failed
|
||||
commit('endLogin')
|
||||
|
||||
// remove authentication token on client/authentication errors
|
||||
if ([400, 401, 403, 422].includes(error.statusCode)) {
|
||||
useOAuthStore().clearToken()
|
||||
}
|
||||
|
||||
commit('endLogin')
|
||||
if (error.tatusCode === 401) {
|
||||
throw new Error('Wrong username or password', error)
|
||||
} else {
|
||||
throw new Error('An error occurred, please try again', error)
|
||||
}
|
||||
reject(new Error('Failed to connect to server, try again'))
|
||||
})
|
||||
})
|
||||
},
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import { fetchTimeline } from 'src/api/public.js'
|
||||
import { promiseInterval } from '../promise_interval/promise_interval.js'
|
||||
|
||||
import { useInstanceStore } from 'src/stores/instance.js'
|
||||
|
|
@ -5,8 +6,6 @@ import { useInstanceCapabilitiesStore } from 'src/stores/instance_capabilities.j
|
|||
import { useInterfaceStore } from 'src/stores/interface.js'
|
||||
import { useMergedConfigStore } from 'src/stores/merged_config.js'
|
||||
|
||||
import { fetchTimeline } from 'src/api/public.js'
|
||||
|
||||
const update = ({ store, notifications, older }) => {
|
||||
store.dispatch('addNewNotifications', { notifications, older })
|
||||
}
|
||||
|
|
@ -98,7 +97,6 @@ const fetchNotifications = ({ store, args, older }) => {
|
|||
throw new Error(`${response.status} ${response.statusText}`)
|
||||
}
|
||||
}
|
||||
|
||||
const notifications = response.data
|
||||
update({ store, notifications, older })
|
||||
return notifications
|
||||
|
|
|
|||
|
|
@ -37,16 +37,15 @@ const postStatus = ({
|
|||
preview,
|
||||
idempotencyKey,
|
||||
})
|
||||
.then(({ data }) => {
|
||||
if (preview) return data
|
||||
|
||||
store.dispatch('addNewStatuses', {
|
||||
statuses: [data],
|
||||
timeline: 'friends',
|
||||
showImmediately: true,
|
||||
noIdUpdate: true, // To prevent missing notices on next pull.
|
||||
})
|
||||
|
||||
.then((data) => {
|
||||
if (!data.error && !preview) {
|
||||
store.dispatch('addNewStatuses', {
|
||||
statuses: [data],
|
||||
timeline: 'friends',
|
||||
showImmediately: true,
|
||||
noIdUpdate: true, // To prevent missing notices on next pull.
|
||||
})
|
||||
}
|
||||
return data
|
||||
})
|
||||
.catch((err) => {
|
||||
|
|
@ -68,7 +67,7 @@ const editStatus = ({
|
|||
}) => {
|
||||
const mediaIds = map(media, 'id')
|
||||
|
||||
return apiEditStatus({
|
||||
return editStatus({
|
||||
id: statusId,
|
||||
credentials: store.state.users.currentUser.credentials,
|
||||
status,
|
||||
|
|
@ -78,14 +77,15 @@ const editStatus = ({
|
|||
mediaIds,
|
||||
contentType,
|
||||
})
|
||||
.then(({ data }) => {
|
||||
store.dispatch('addNewStatuses', {
|
||||
statuses: [data],
|
||||
timeline: 'friends',
|
||||
showImmediately: true,
|
||||
noIdUpdate: true, // To prevent missing notices on next pull.
|
||||
})
|
||||
|
||||
.then((data) => {
|
||||
if (!data.error) {
|
||||
store.dispatch('addNewStatuses', {
|
||||
statuses: [data],
|
||||
timeline: 'friends',
|
||||
showImmediately: true,
|
||||
noIdUpdate: true, // To prevent missing notices on next pull.
|
||||
})
|
||||
}
|
||||
return data
|
||||
})
|
||||
.catch((err) => {
|
||||
|
|
@ -98,14 +98,12 @@ const editStatus = ({
|
|||
|
||||
const uploadMedia = ({ store, formData }) => {
|
||||
const credentials = store.state.users.currentUser.credentials
|
||||
return apiUploadMedia({ credentials, formData }).then(({ data }) => data)
|
||||
return apiUploadMedia({ credentials, formData })
|
||||
}
|
||||
|
||||
const setMediaDescription = ({ store, id, description }) => {
|
||||
const credentials = store.state.users.currentUser.credentials
|
||||
return apiSetMediaDescription({ credentials, id, description }).then(
|
||||
({ data }) => data,
|
||||
)
|
||||
return apiSetMediaDescription({ credentials, id, description })
|
||||
}
|
||||
|
||||
const statusPosterService = {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import { camelCase } from 'lodash'
|
||||
|
||||
import { fetchTimeline } from 'src/api/public.js'
|
||||
import { promiseInterval } from '../promise_interval/promise_interval.js'
|
||||
|
||||
import { useInstanceStore } from 'src/stores/instance.js'
|
||||
|
|
@ -7,8 +8,6 @@ import { useInstanceCapabilitiesStore } from 'src/stores/instance_capabilities.j
|
|||
import { useInterfaceStore } from 'src/stores/interface.js'
|
||||
import { useMergedConfigStore } from 'src/stores/merged_config.js'
|
||||
|
||||
import { fetchTimeline } from 'src/api/public.js'
|
||||
|
||||
const update = ({
|
||||
store,
|
||||
statuses,
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ export const useAdminSettingsStore = defineStore('adminSettings', {
|
|||
loadAdminStuff() {
|
||||
getInstanceDBConfig({
|
||||
credentials: useOAuthStore().token,
|
||||
}).then(({ data: backendDbConfig }) => {
|
||||
}).then((backendDbConfig) => {
|
||||
if (backendDbConfig.error) {
|
||||
if (backendDbConfig.error.status === 400) {
|
||||
backendDbConfig.error.json().then((errorJson) => {
|
||||
|
|
@ -106,7 +106,7 @@ export const useAdminSettingsStore = defineStore('adminSettings', {
|
|||
if (this.descriptions === null) {
|
||||
getInstanceConfigDescriptions({
|
||||
credentials: useOAuthStore().token,
|
||||
}).then(({ data: backendDescriptions }) =>
|
||||
}).then((backendDescriptions) =>
|
||||
this.setInstanceAdminDescriptions({
|
||||
credentials: useOAuthStore().token,
|
||||
backendDescriptions,
|
||||
|
|
@ -251,7 +251,7 @@ export const useAdminSettingsStore = defineStore('adminSettings', {
|
|||
.then(() =>
|
||||
getInstanceDBConfig({
|
||||
credentials: useOAuthStore().token,
|
||||
}).then(({ data }) => data),
|
||||
}),
|
||||
)
|
||||
.then((backendDbConfig) =>
|
||||
this.setInstanceAdminSettings({
|
||||
|
|
@ -294,7 +294,7 @@ export const useAdminSettingsStore = defineStore('adminSettings', {
|
|||
.then(() =>
|
||||
getInstanceDBConfig({
|
||||
credentials: useOAuthStore().token,
|
||||
}).then(({ data }) => data),
|
||||
}),
|
||||
)
|
||||
.then((backendDbConfig) =>
|
||||
this.setInstanceAdminSettings({
|
||||
|
|
@ -326,7 +326,7 @@ export const useAdminSettingsStore = defineStore('adminSettings', {
|
|||
.then(() =>
|
||||
getInstanceDBConfig({
|
||||
credentials: useOAuthStore().token,
|
||||
}).then(({ data }) => data),
|
||||
}),
|
||||
)
|
||||
.then((backendDbConfig) =>
|
||||
this.setInstanceAdminSettings({ backendDbConfig }),
|
||||
|
|
@ -337,9 +337,7 @@ export const useAdminSettingsStore = defineStore('adminSettings', {
|
|||
loadFrontendsStuff() {
|
||||
getAvailableFrontends({
|
||||
credentials: useOAuthStore().token,
|
||||
}).then(({ data: frontends }) =>
|
||||
this.setAvailableFrontends({ frontends }),
|
||||
)
|
||||
}).then((frontends) => this.setAvailableFrontends({ frontends }))
|
||||
},
|
||||
|
||||
setAvailableFrontends({ frontends }) {
|
||||
|
|
@ -357,14 +355,12 @@ export const useAdminSettingsStore = defineStore('adminSettings', {
|
|||
installFrontend() {
|
||||
return installFrontend({
|
||||
credentials: useOAuthStore().token,
|
||||
}).then(({ data }) => data)
|
||||
})
|
||||
},
|
||||
|
||||
// Statuses stuff
|
||||
async fetchStatuses(opts) {
|
||||
const {
|
||||
data: { total, activities },
|
||||
} = await listStatuses({
|
||||
const { total, activities } = await listStatuses({
|
||||
credentials: useOAuthStore().token,
|
||||
opts,
|
||||
})
|
||||
|
|
@ -379,21 +375,20 @@ export const useAdminSettingsStore = defineStore('adminSettings', {
|
|||
}
|
||||
},
|
||||
async changeStatusScope(opts) {
|
||||
const { data } = await changeStatusScope({
|
||||
const raw = await changeStatusScope({
|
||||
credentials: useOAuthStore().token,
|
||||
opts,
|
||||
})
|
||||
const status = parseStatus(data)
|
||||
const status = parseStatus(raw)
|
||||
|
||||
await window.vuex.dispatch('addNewStatuses', { statuses: [status] })
|
||||
},
|
||||
|
||||
// Users stuff
|
||||
async fetchUsers(opts) {
|
||||
const {
|
||||
data: { users, count },
|
||||
} = await listUsers({
|
||||
const { users, count } = await listUsers({
|
||||
credentials: useOAuthStore().token,
|
||||
|
||||
opts,
|
||||
})
|
||||
|
||||
|
|
@ -417,8 +412,7 @@ export const useAdminSettingsStore = defineStore('adminSettings', {
|
|||
credentials: useOAuthStore().token,
|
||||
screen_name,
|
||||
})
|
||||
|
||||
window.vuex.commit('updateUserAdminData', { user: result.data })
|
||||
window.vuex.commit('updateUserAdminData', { user: result })
|
||||
},
|
||||
async deleteUsers({ users }) {
|
||||
const screen_names = users.map((u) => u.screen_name)
|
||||
|
|
@ -429,7 +423,7 @@ export const useAdminSettingsStore = defineStore('adminSettings', {
|
|||
screen_names,
|
||||
})
|
||||
|
||||
resultUserIds.data.forEach((userId) => {
|
||||
resultUserIds.forEach((userId) => {
|
||||
window.vuex.dispatch(
|
||||
'markStatusesAsDeleted',
|
||||
(status) => userId === status.user.id,
|
||||
|
|
@ -445,7 +439,7 @@ export const useAdminSettingsStore = defineStore('adminSettings', {
|
|||
return resendConfirmationEmail({
|
||||
credentials: useOAuthStore().token,
|
||||
screen_names,
|
||||
}).then(({ data }) => data)
|
||||
})
|
||||
},
|
||||
requirePasswordChange({ users }) {
|
||||
const screen_names = users.map((u) => u.screen_name)
|
||||
|
|
@ -453,7 +447,7 @@ export const useAdminSettingsStore = defineStore('adminSettings', {
|
|||
return requirePasswordChange({
|
||||
credentials: useOAuthStore().token,
|
||||
screen_names,
|
||||
}).then(({ data }) => data)
|
||||
})
|
||||
},
|
||||
// Singular only!
|
||||
disableMFA({ user }) {
|
||||
|
|
@ -462,7 +456,7 @@ export const useAdminSettingsStore = defineStore('adminSettings', {
|
|||
return disableMFA({
|
||||
credentials: useOAuthStore().token,
|
||||
screen_name,
|
||||
}).then(({ data }) => data)
|
||||
})
|
||||
},
|
||||
async setUsersTags({ users, tags, value }) {
|
||||
const screen_names = users.map((u) => u.screen_name)
|
||||
|
|
@ -504,7 +498,7 @@ export const useAdminSettingsStore = defineStore('adminSettings', {
|
|||
value,
|
||||
})
|
||||
|
||||
resultUsers.data.forEach((user) => {
|
||||
resultUsers.forEach((user) => {
|
||||
window.vuex.commit('updateUserAdminData', { user })
|
||||
})
|
||||
},
|
||||
|
|
@ -518,7 +512,7 @@ export const useAdminSettingsStore = defineStore('adminSettings', {
|
|||
value,
|
||||
})
|
||||
|
||||
resultUsers.data.forEach((user) => {
|
||||
resultUsers.forEach((user) => {
|
||||
window.vuex.commit('updateUserAdminData', { user })
|
||||
})
|
||||
},
|
||||
|
|
@ -544,31 +538,27 @@ export const useAdminSettingsStore = defineStore('adminSettings', {
|
|||
screen_names,
|
||||
})
|
||||
|
||||
resultUsers.data.forEach((user) => {
|
||||
resultUsers.forEach((user) => {
|
||||
window.vuex.commit('updateUserAdminData', { user })
|
||||
})
|
||||
},
|
||||
reloadEmoji() {
|
||||
return reloadEmoji({ credentials: useOAuthStore().token }).then(
|
||||
({ data }) => data,
|
||||
)
|
||||
return reloadEmoji({ credentials: useOAuthStore().token })
|
||||
},
|
||||
importEmojiFromFS() {
|
||||
return importEmojiFromFS({ credentials: useOAuthStore().token }).then(
|
||||
({ data }) => data,
|
||||
)
|
||||
return importEmojiFromFS({ credentials: useOAuthStore().token })
|
||||
},
|
||||
listEmojiPacks(params) {
|
||||
return listEmojiPacks({
|
||||
...params,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then(({ data }) => data)
|
||||
credentials: useOAuthStore().token
|
||||
})
|
||||
},
|
||||
listRemoteEmojiPacks(params) {
|
||||
return listRemoteEmojiPacks({
|
||||
...params,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then(({ data }) => data)
|
||||
})
|
||||
},
|
||||
addNewEmojiFile({ packName, file, shortcode, filename }) {
|
||||
return addNewEmojiFile({
|
||||
|
|
@ -577,7 +567,7 @@ export const useAdminSettingsStore = defineStore('adminSettings', {
|
|||
shortcode,
|
||||
filename,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then(({ data }) => data)
|
||||
})
|
||||
},
|
||||
downloadRemoteEmojiPack({ instance, packName, as }) {
|
||||
return downloadRemoteEmojiPack({
|
||||
|
|
@ -585,33 +575,33 @@ export const useAdminSettingsStore = defineStore('adminSettings', {
|
|||
packName,
|
||||
as,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then(({ data }) => data)
|
||||
})
|
||||
},
|
||||
downloadRemoteEmojiPackZIP({ url, packName }) {
|
||||
return downloadRemoteEmojiPackZIP({
|
||||
url,
|
||||
packName,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then(({ data }) => data)
|
||||
})
|
||||
},
|
||||
createEmojiPack({ name }) {
|
||||
return createEmojiPack({
|
||||
name,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then(({ data }) => data)
|
||||
})
|
||||
},
|
||||
deleteEmojiPack({ name }) {
|
||||
return createEmojiPack({
|
||||
name,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then(({ data }) => data)
|
||||
})
|
||||
},
|
||||
saveEmojiPackMetadata({ name, newData }) {
|
||||
return createEmojiPack({
|
||||
name,
|
||||
newData,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then(({ data }) => data)
|
||||
})
|
||||
},
|
||||
},
|
||||
})
|
||||
|
|
|
|||
|
|
@ -44,16 +44,15 @@ export const useAnnouncementsStore = defineStore('announcements', {
|
|||
|
||||
const fetchAnnouncements = async () => {
|
||||
if (!isAdmin) {
|
||||
const result = await getAnnouncements({
|
||||
return getAnnouncements({
|
||||
credentials: useOAuthStore().token,
|
||||
})
|
||||
return result.data
|
||||
}
|
||||
|
||||
const { data: all } = await adminGetAnnouncements({
|
||||
const all = await adminGetAnnouncements({
|
||||
credentials: useOAuthStore().token,
|
||||
})
|
||||
const { data: visible } = await getAnnouncements({
|
||||
const visible = await getAnnouncements({
|
||||
credentials: useOAuthStore().token,
|
||||
})
|
||||
const visibleObject = visible.reduce((a, c) => {
|
||||
|
|
|
|||
|
|
@ -31,7 +31,10 @@ export const useBookmarkFoldersStore = defineStore('bookmarkFolders', {
|
|||
this.fetcher = fetchBookmarkFolders({
|
||||
credentials: useOAuthStore().token,
|
||||
})
|
||||
.then(({ data: folders }) => this.setBookmarkFolders(folders))
|
||||
.then(
|
||||
(folders) => this.setBookmarkFolders(folders),
|
||||
(rej) => console.error(rej),
|
||||
)
|
||||
.catch((e) => {
|
||||
console.error(e)
|
||||
})
|
||||
|
|
@ -58,7 +61,7 @@ export const useBookmarkFoldersStore = defineStore('bookmarkFolders', {
|
|||
name,
|
||||
emoji,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then(({ data: folder }) => {
|
||||
}).then((folder) => {
|
||||
this.setBookmarkFolder(folder)
|
||||
return folder
|
||||
})
|
||||
|
|
@ -69,7 +72,7 @@ export const useBookmarkFoldersStore = defineStore('bookmarkFolders', {
|
|||
folderId,
|
||||
name,
|
||||
emoji,
|
||||
}).then(({ data: folder }) => {
|
||||
}).then((folder) => {
|
||||
this.setBookmarkFolder(folder)
|
||||
return folder
|
||||
})
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
import { merge } from 'lodash'
|
||||
import { defineStore } from 'pinia'
|
||||
|
||||
import { useInstanceStore } from 'src/stores/instance.js'
|
||||
import { useOAuthStore } from 'src/stores/oauth.js'
|
||||
import { useInstanceStore } from 'src/stores/instance.js'
|
||||
|
||||
import { listEmojiPacks } from 'src/api/public.js'
|
||||
import { ensureFinalFallback } from 'src/i18n/languages.js'
|
||||
import { listEmojiPacks } from 'src/api/public.js'
|
||||
|
||||
import { annotationsLoader } from 'virtual:pleroma-fe/emoji-annotations'
|
||||
|
||||
|
|
@ -188,8 +188,7 @@ export const useEmojiStore = defineStore('emoji', {
|
|||
this.adminPacksLocalLoading = true
|
||||
this.adminPacksLocal = await this.getAdminPacks(
|
||||
useInstanceStore().server,
|
||||
(params) =>
|
||||
listEmojiPacks({
|
||||
(params) => listEmojiPacks({
|
||||
...params,
|
||||
credentials: useOAuthStore().token,
|
||||
}),
|
||||
|
|
@ -222,13 +221,14 @@ export const useEmojiStore = defineStore('emoji', {
|
|||
instance,
|
||||
page: i,
|
||||
pageSize,
|
||||
}).then((pageData) => {
|
||||
if (pageData.error !== undefined) {
|
||||
return Promise.reject(pageData.error)
|
||||
}
|
||||
})
|
||||
.then((pageData) => {
|
||||
if (pageData.error !== undefined) {
|
||||
return Promise.reject(pageData.error)
|
||||
}
|
||||
|
||||
return pageData.packs
|
||||
}),
|
||||
return pageData.packs
|
||||
}),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -11,11 +11,10 @@ import {
|
|||
LOCAL_DEFAULT_CONFIG_DEFINITIONS,
|
||||
validateSetting,
|
||||
} from '../modules/default_config_state.js'
|
||||
import { fetchKnownDomains } from 'src/api/public.js'
|
||||
|
||||
import { useInterfaceStore } from 'src/stores/interface.js'
|
||||
|
||||
import { fetchKnownDomains } from 'src/api/public.js'
|
||||
|
||||
const REMOTE_INTERACTION_URL = '/main/ostatus'
|
||||
|
||||
const ROOT_STATE_DEFINITIONS = {
|
||||
|
|
|
|||
|
|
@ -38,7 +38,10 @@ export const useListsStore = defineStore('lists', {
|
|||
this.fetcher = fetchLists({
|
||||
credentials: useOAuthStore().token,
|
||||
})
|
||||
.then(({ data: lists }) => this.setLists(lists))
|
||||
.then(
|
||||
(lists) => this.setLists(lists),
|
||||
(rej) => console.error(rej),
|
||||
)
|
||||
.catch((e) => {
|
||||
console.error(e)
|
||||
})
|
||||
|
|
|
|||
|
|
@ -20,11 +20,10 @@ import { toRaw } from 'vue'
|
|||
|
||||
import { CURRENT_UPDATE_COUNTER } from 'src/components/update_notification/update_notification.js'
|
||||
|
||||
import { useOAuthStore } from 'src/stores/oauth.js'
|
||||
import { useInstanceStore } from 'src/stores/instance.js'
|
||||
import { useLocalConfigStore } from 'src/stores/local_config.js'
|
||||
import { useOAuthStore } from 'src/stores/oauth.js'
|
||||
|
||||
import { updateProfileJSON } from 'src/api/user.js'
|
||||
import { storage } from 'src/lib/storage.js'
|
||||
import {
|
||||
makeUndefined,
|
||||
|
|
@ -33,6 +32,7 @@ import {
|
|||
validateSetting,
|
||||
} from 'src/modules/default_config_state.js'
|
||||
import { oldDefaultConfigSync } from 'src/modules/old_default_config_state.js'
|
||||
import { updateProfileJSON } from 'src/api/user.js'
|
||||
|
||||
export const VERSION = 2
|
||||
export const NEW_USER_DATE = new Date('2026-03-16') // date of writing this, basically
|
||||
|
|
|
|||
|
|
@ -16,8 +16,8 @@ import { toRaw } from 'vue'
|
|||
|
||||
import { useOAuthStore } from 'src/stores/oauth.js'
|
||||
|
||||
import { updateProfileJSON } from 'src/api/user.js'
|
||||
import { storage } from 'src/lib/storage.js'
|
||||
import { updateProfileJSON } from 'src/api/user.js'
|
||||
|
||||
export const NEW_USER_DATE = new Date('2022-08-04') // date of writing this, basically
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue