Fix merge conflicts
This commit is contained in:
commit
081aa0fd05
167 changed files with 3481 additions and 2487 deletions
|
|
@ -78,7 +78,7 @@ const MASTODON_PIN_OWN_STATUS = id => `/api/v1/statuses/${id}/pin`
|
|||
const MASTODON_UNPIN_OWN_STATUS = id => `/api/v1/statuses/${id}/unpin`
|
||||
const MASTODON_MUTE_CONVERSATION = id => `/api/v1/statuses/${id}/mute`
|
||||
const MASTODON_UNMUTE_CONVERSATION = id => `/api/v1/statuses/${id}/unmute`
|
||||
const MASTODON_SEARCH_2 = `/api/v2/search`
|
||||
const MASTODON_SEARCH_2 = '/api/v2/search'
|
||||
const MASTODON_USER_SEARCH_URL = '/api/v1/accounts/search'
|
||||
const MASTODON_DOMAIN_BLOCKS_URL = '/api/v1/domain_blocks'
|
||||
const MASTODON_STREAMING = '/api/v1/streaming'
|
||||
|
|
@ -86,7 +86,7 @@ const MASTODON_KNOWN_DOMAIN_LIST_URL = '/api/v1/instance/peers'
|
|||
const PLEROMA_EMOJI_REACTIONS_URL = id => `/api/v1/pleroma/statuses/${id}/reactions`
|
||||
const PLEROMA_EMOJI_REACT_URL = (id, emoji) => `/api/v1/pleroma/statuses/${id}/reactions/${emoji}`
|
||||
const PLEROMA_EMOJI_UNREACT_URL = (id, emoji) => `/api/v1/pleroma/statuses/${id}/reactions/${emoji}`
|
||||
const PLEROMA_CHATS_URL = `/api/v1/pleroma/chats`
|
||||
const PLEROMA_CHATS_URL = '/api/v1/pleroma/chats'
|
||||
const PLEROMA_CHAT_URL = id => `/api/v1/pleroma/chats/by-account-id/${id}`
|
||||
const PLEROMA_CHAT_MESSAGES_URL = id => `/api/v1/pleroma/chats/${id}/messages`
|
||||
const PLEROMA_CHAT_READ_URL = id => `/api/v1/pleroma/chats/${id}/read`
|
||||
|
|
@ -95,7 +95,7 @@ const PLEROMA_BACKUP_URL = '/api/v1/pleroma/backups'
|
|||
|
||||
const oldfetch = window.fetch
|
||||
|
||||
let fetch = (url, options) => {
|
||||
const fetch = (url, options) => {
|
||||
options = options || {}
|
||||
const baseUrl = ''
|
||||
const fullUrl = baseUrl + url
|
||||
|
|
@ -107,7 +107,7 @@ const promisedRequest = ({ method, url, params, payload, credentials, headers =
|
|||
const options = {
|
||||
method,
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
Accept: 'application/json',
|
||||
'Content-Type': 'application/json',
|
||||
...headers
|
||||
}
|
||||
|
|
@ -231,16 +231,16 @@ const getCaptcha = () => fetch('/api/pleroma/captcha').then(resp => resp.json())
|
|||
|
||||
const authHeaders = (accessToken) => {
|
||||
if (accessToken) {
|
||||
return { 'Authorization': `Bearer ${accessToken}` }
|
||||
return { Authorization: `Bearer ${accessToken}` }
|
||||
} else {
|
||||
return { }
|
||||
}
|
||||
}
|
||||
|
||||
const followUser = ({ id, credentials, ...options }) => {
|
||||
let url = MASTODON_FOLLOW_URL(id)
|
||||
const url = MASTODON_FOLLOW_URL(id)
|
||||
const form = {}
|
||||
if (options.reblogs !== undefined) { form['reblogs'] = options.reblogs }
|
||||
if (options.reblogs !== undefined) { form.reblogs = options.reblogs }
|
||||
return fetch(url, {
|
||||
body: JSON.stringify(form),
|
||||
headers: {
|
||||
|
|
@ -252,7 +252,7 @@ const followUser = ({ id, credentials, ...options }) => {
|
|||
}
|
||||
|
||||
const unfollowUser = ({ id, credentials }) => {
|
||||
let url = MASTODON_UNFOLLOW_URL(id)
|
||||
const url = MASTODON_UNFOLLOW_URL(id)
|
||||
return fetch(url, {
|
||||
headers: authHeaders(credentials),
|
||||
method: 'POST'
|
||||
|
|
@ -294,7 +294,7 @@ const unblockUser = ({ id, credentials }) => {
|
|||
}
|
||||
|
||||
const approveUser = ({ id, credentials }) => {
|
||||
let url = MASTODON_APPROVE_USER_URL(id)
|
||||
const url = MASTODON_APPROVE_USER_URL(id)
|
||||
return fetch(url, {
|
||||
headers: authHeaders(credentials),
|
||||
method: 'POST'
|
||||
|
|
@ -302,7 +302,7 @@ const approveUser = ({ id, credentials }) => {
|
|||
}
|
||||
|
||||
const denyUser = ({ id, credentials }) => {
|
||||
let url = MASTODON_DENY_USER_URL(id)
|
||||
const url = MASTODON_DENY_USER_URL(id)
|
||||
return fetch(url, {
|
||||
headers: authHeaders(credentials),
|
||||
method: 'POST'
|
||||
|
|
@ -310,13 +310,13 @@ const denyUser = ({ id, credentials }) => {
|
|||
}
|
||||
|
||||
const fetchUser = ({ id, credentials }) => {
|
||||
let url = `${MASTODON_USER_URL}/${id}`
|
||||
const url = `${MASTODON_USER_URL}/${id}`
|
||||
return promisedRequest({ url, credentials })
|
||||
.then((data) => parseUser(data))
|
||||
}
|
||||
|
||||
const fetchUserRelationship = ({ id, credentials }) => {
|
||||
let url = `${MASTODON_USER_RELATIONSHIPS_URL}/?id=${id}`
|
||||
const url = `${MASTODON_USER_RELATIONSHIPS_URL}/?id=${id}`
|
||||
return fetch(url, { headers: authHeaders(credentials) })
|
||||
.then((response) => {
|
||||
return new Promise((resolve, reject) => response.json()
|
||||
|
|
@ -335,7 +335,7 @@ const fetchFriends = ({ id, maxId, sinceId, limit = 20, credentials }) => {
|
|||
maxId && `max_id=${maxId}`,
|
||||
sinceId && `since_id=${sinceId}`,
|
||||
limit && `limit=${limit}`,
|
||||
`with_relationships=true`
|
||||
'with_relationships=true'
|
||||
].filter(_ => _).join('&')
|
||||
|
||||
url = url + (args ? '?' + args : '')
|
||||
|
|
@ -345,6 +345,7 @@ const fetchFriends = ({ id, maxId, sinceId, limit = 20, credentials }) => {
|
|||
}
|
||||
|
||||
const exportFriends = ({ id, credentials }) => {
|
||||
// eslint-disable-next-line no-async-promise-executor
|
||||
return new Promise(async (resolve, reject) => {
|
||||
try {
|
||||
let friends = []
|
||||
|
|
@ -370,7 +371,7 @@ const fetchFollowers = ({ id, maxId, sinceId, limit = 20, credentials }) => {
|
|||
maxId && `max_id=${maxId}`,
|
||||
sinceId && `since_id=${sinceId}`,
|
||||
limit && `limit=${limit}`,
|
||||
`with_relationships=true`
|
||||
'with_relationships=true'
|
||||
].filter(_ => _).join('&')
|
||||
|
||||
url += args ? '?' + args : ''
|
||||
|
|
@ -387,7 +388,7 @@ const fetchFollowRequests = ({ credentials }) => {
|
|||
}
|
||||
|
||||
const fetchConversation = ({ id, credentials }) => {
|
||||
let urlContext = MASTODON_STATUS_CONTEXT_URL(id)
|
||||
const urlContext = MASTODON_STATUS_CONTEXT_URL(id)
|
||||
return fetch(urlContext, { headers: authHeaders(credentials) })
|
||||
.then((data) => {
|
||||
if (data.ok) {
|
||||
|
|
@ -403,7 +404,7 @@ const fetchConversation = ({ id, credentials }) => {
|
|||
}
|
||||
|
||||
const fetchStatus = ({ id, credentials }) => {
|
||||
let url = MASTODON_STATUS_URL(id)
|
||||
const url = MASTODON_STATUS_URL(id)
|
||||
return fetch(url, { headers: authHeaders(credentials) })
|
||||
.then((data) => {
|
||||
if (data.ok) {
|
||||
|
|
@ -452,7 +453,7 @@ const tagUser = ({ tag, credentials, user }) => {
|
|||
|
||||
return fetch(TAG_USER_URL, {
|
||||
method: 'PUT',
|
||||
headers: headers,
|
||||
headers,
|
||||
body: JSON.stringify(form)
|
||||
})
|
||||
}
|
||||
|
|
@ -469,7 +470,7 @@ const untagUser = ({ tag, credentials, user }) => {
|
|||
|
||||
return fetch(TAG_USER_URL, {
|
||||
method: 'DELETE',
|
||||
headers: headers,
|
||||
headers,
|
||||
body: JSON.stringify(body)
|
||||
})
|
||||
}
|
||||
|
|
@ -522,7 +523,7 @@ const deleteUser = ({ credentials, user }) => {
|
|||
|
||||
return fetch(`${ADMIN_USERS_URL}?nickname=${screenName}`, {
|
||||
method: 'DELETE',
|
||||
headers: headers
|
||||
headers
|
||||
})
|
||||
}
|
||||
|
||||
|
|
@ -541,7 +542,7 @@ const fetchTimeline = ({
|
|||
friends: MASTODON_USER_HOME_TIMELINE_URL,
|
||||
dms: MASTODON_DIRECT_MESSAGES_TIMELINE_URL,
|
||||
notifications: MASTODON_USER_NOTIFICATIONS_URL,
|
||||
'publicAndExternal': MASTODON_PUBLIC_TIMELINE,
|
||||
publicAndExternal: MASTODON_PUBLIC_TIMELINE,
|
||||
user: MASTODON_USER_TIMELINE_URL,
|
||||
media: MASTODON_USER_TIMELINE_URL,
|
||||
favorites: MASTODON_USER_FAVORITES_TIMELINE_URL,
|
||||
|
|
@ -715,7 +716,7 @@ const postStatus = ({
|
|||
form.append('preview', 'true')
|
||||
}
|
||||
|
||||
let postHeaders = authHeaders(credentials)
|
||||
const postHeaders = authHeaders(credentials)
|
||||
if (idempotencyKey) {
|
||||
postHeaders['idempotency-key'] = idempotencyKey
|
||||
}
|
||||
|
|
@ -1068,7 +1069,7 @@ const vote = ({ pollId, choices, credentials }) => {
|
|||
method: 'POST',
|
||||
credentials,
|
||||
payload: {
|
||||
choices: choices
|
||||
choices
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
@ -1128,8 +1129,8 @@ const reportUser = ({ credentials, userId, statusIds, comment, forward }) => {
|
|||
url: MASTODON_REPORT_USER_URL,
|
||||
method: 'POST',
|
||||
payload: {
|
||||
'account_id': userId,
|
||||
'status_ids': statusIds,
|
||||
account_id: userId,
|
||||
status_ids: statusIds,
|
||||
comment,
|
||||
forward
|
||||
},
|
||||
|
|
@ -1151,7 +1152,7 @@ const searchUsers = ({ credentials, query }) => {
|
|||
|
||||
const search2 = ({ credentials, q, resolve, limit, offset, following }) => {
|
||||
let url = MASTODON_SEARCH_2
|
||||
let params = []
|
||||
const params = []
|
||||
|
||||
if (q) {
|
||||
params.push(['q', encodeURIComponent(q)])
|
||||
|
|
@ -1175,7 +1176,7 @@ const search2 = ({ credentials, q, resolve, limit, offset, following }) => {
|
|||
|
||||
params.push(['with_relationships', true])
|
||||
|
||||
let queryString = map(params, (param) => `${param[0]}=${param[1]}`).join('&')
|
||||
const queryString = map(params, (param) => `${param[0]}=${param[1]}`).join('&')
|
||||
url += `?${queryString}`
|
||||
|
||||
return fetch(url, { headers: authHeaders(credentials) })
|
||||
|
|
@ -1332,12 +1333,12 @@ export const handleMastoWS = (wsEvent) => {
|
|||
}
|
||||
|
||||
export const WSConnectionStatus = Object.freeze({
|
||||
'JOINED': 1,
|
||||
'CLOSED': 2,
|
||||
'ERROR': 3,
|
||||
'DISABLED': 4,
|
||||
'STARTING': 5,
|
||||
'STARTING_INITIAL': 6
|
||||
JOINED: 1,
|
||||
CLOSED: 2,
|
||||
ERROR: 3,
|
||||
DISABLED: 4,
|
||||
STARTING: 5,
|
||||
STARTING_INITIAL: 6
|
||||
})
|
||||
|
||||
const chats = ({ credentials }) => {
|
||||
|
|
@ -1375,11 +1376,11 @@ const chatMessages = ({ id, credentials, maxId, sinceId, limit = 20 }) => {
|
|||
|
||||
const sendChatMessage = ({ id, content, mediaId = null, idempotencyKey, credentials }) => {
|
||||
const payload = {
|
||||
'content': content
|
||||
content
|
||||
}
|
||||
|
||||
if (mediaId) {
|
||||
payload['media_id'] = mediaId
|
||||
payload.media_id = mediaId
|
||||
}
|
||||
|
||||
const headers = {}
|
||||
|
|
@ -1391,7 +1392,7 @@ const sendChatMessage = ({ id, content, mediaId = null, idempotencyKey, credenti
|
|||
return promisedRequest({
|
||||
url: PLEROMA_CHAT_MESSAGES_URL(id),
|
||||
method: 'POST',
|
||||
payload: payload,
|
||||
payload,
|
||||
credentials,
|
||||
headers
|
||||
})
|
||||
|
|
@ -1402,7 +1403,7 @@ const readChat = ({ id, lastReadId, credentials }) => {
|
|||
url: PLEROMA_CHAT_READ_URL(id),
|
||||
method: 'POST',
|
||||
payload: {
|
||||
'last_read_id': lastReadId
|
||||
last_read_id: lastReadId
|
||||
},
|
||||
credentials
|
||||
})
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ const empty = (chatId) => {
|
|||
messages: [],
|
||||
newMessageCount: 0,
|
||||
lastSeenMessageId: '0',
|
||||
chatId: chatId,
|
||||
chatId,
|
||||
minId: undefined,
|
||||
maxId: undefined
|
||||
}
|
||||
|
|
@ -101,7 +101,7 @@ const add = (storage, { messages: newMessages, updateMaxId = true }) => {
|
|||
storage.messages = storage.messages.filter(msg => msg.id !== message.id)
|
||||
}
|
||||
Object.assign(fakeMessage, message, { error: false })
|
||||
delete fakeMessage['fakeId']
|
||||
delete fakeMessage.fakeId
|
||||
storage.idIndex[fakeMessage.id] = fakeMessage
|
||||
delete storage.idIndex[message.fakeId]
|
||||
|
||||
|
|
@ -178,7 +178,7 @@ const getView = (storage) => {
|
|||
id: date.getTime().toString()
|
||||
})
|
||||
|
||||
previousMessage['isTail'] = true
|
||||
previousMessage.isTail = true
|
||||
currentMessageChainId = undefined
|
||||
afterDate = true
|
||||
}
|
||||
|
|
@ -193,15 +193,15 @@ const getView = (storage) => {
|
|||
|
||||
// end a message chian
|
||||
if ((nextMessage && nextMessage.account_id) !== message.account_id) {
|
||||
object['isTail'] = true
|
||||
object.isTail = true
|
||||
currentMessageChainId = undefined
|
||||
}
|
||||
|
||||
// start a new message chain
|
||||
if ((previousMessage && previousMessage.data && previousMessage.data.account_id) !== message.account_id || afterDate) {
|
||||
currentMessageChainId = _.uniqueId()
|
||||
object['isHead'] = true
|
||||
object['messageChainId'] = currentMessageChainId
|
||||
object.isHead = true
|
||||
object.messageChainId = currentMessageChainId
|
||||
}
|
||||
|
||||
result.push(object)
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ export const buildFakeMessage = ({ content, chatId, attachments, userId, idempot
|
|||
chat_id: chatId,
|
||||
created_at: new Date(),
|
||||
id: `${new Date().getTime()}`,
|
||||
attachments: attachments,
|
||||
attachments,
|
||||
account_id: userId,
|
||||
idempotency_key: idempotencyKey,
|
||||
emojis: [],
|
||||
|
|
|
|||
|
|
@ -144,11 +144,13 @@ export const invert = (rgb) => {
|
|||
*/
|
||||
export const hex2rgb = (hex) => {
|
||||
const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex)
|
||||
return result ? {
|
||||
r: parseInt(result[1], 16),
|
||||
g: parseInt(result[2], 16),
|
||||
b: parseInt(result[3], 16)
|
||||
} : null
|
||||
return result
|
||||
? {
|
||||
r: parseInt(result[1], 16),
|
||||
g: parseInt(result[2], 16),
|
||||
b: parseInt(result[3], 16)
|
||||
}
|
||||
: null
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ export const addPositionToWords = (words) => {
|
|||
}
|
||||
|
||||
export const splitByWhitespaceBoundary = (str) => {
|
||||
let result = []
|
||||
const result = []
|
||||
let currentWord = ''
|
||||
for (let i = 0; i < str.length; i++) {
|
||||
const currentChar = str[i]
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ export const relativeTime = (date, nowThreshold = 1) => {
|
|||
if (typeof date === 'string') date = Date.parse(date)
|
||||
const round = Date.now() > date ? Math.floor : Math.ceil
|
||||
const d = Math.abs(Date.now() - date)
|
||||
let r = { num: round(d / YEAR), key: 'time.unit.years' }
|
||||
const r = { num: round(d / YEAR), key: 'time.unit.years' }
|
||||
if (d < nowThreshold * SECOND) {
|
||||
r.num = 0
|
||||
r.key = 'time.now'
|
||||
|
|
|
|||
|
|
@ -39,9 +39,9 @@ const qvitterStatusType = (status) => {
|
|||
|
||||
export const parseUser = (data) => {
|
||||
const output = {}
|
||||
const masto = data.hasOwnProperty('acct')
|
||||
const masto = Object.prototype.hasOwnProperty.call(data, 'acct')
|
||||
// case for users in "mentions" property for statuses in MastoAPI
|
||||
const mastoShort = masto && !data.hasOwnProperty('avatar')
|
||||
const mastoShort = masto && !Object.prototype.hasOwnProperty.call(data, 'avatar')
|
||||
|
||||
output.id = String(data.id)
|
||||
output._original = data // used for server-side settings
|
||||
|
|
@ -225,7 +225,7 @@ export const parseUser = (data) => {
|
|||
|
||||
export const parseAttachment = (data) => {
|
||||
const output = {}
|
||||
const masto = !data.hasOwnProperty('oembed')
|
||||
const masto = !Object.prototype.hasOwnProperty.call(data, 'oembed')
|
||||
|
||||
if (masto) {
|
||||
// Not exactly same...
|
||||
|
|
@ -256,7 +256,7 @@ export const parseSource = (data) => {
|
|||
|
||||
export const parseStatus = (data) => {
|
||||
const output = {}
|
||||
const masto = data.hasOwnProperty('account')
|
||||
const masto = Object.prototype.hasOwnProperty.call(data, 'account')
|
||||
|
||||
if (masto) {
|
||||
output.favorited = data.favourited
|
||||
|
|
@ -387,10 +387,10 @@ export const parseStatus = (data) => {
|
|||
|
||||
export const parseNotification = (data) => {
|
||||
const mastoDict = {
|
||||
'favourite': 'like',
|
||||
'reblog': 'repeat'
|
||||
favourite: 'like',
|
||||
reblog: 'repeat'
|
||||
}
|
||||
const masto = !data.hasOwnProperty('ntype')
|
||||
const masto = !Object.prototype.hasOwnProperty.call(data, 'ntype')
|
||||
const output = {}
|
||||
|
||||
if (masto) {
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ export class RegistrationError extends Error {
|
|||
// the error is probably a JSON object with a single key, "errors", whose value is another JSON object containing the real errors
|
||||
if (typeof error === 'string') {
|
||||
error = JSON.parse(error)
|
||||
// eslint-disable-next-line
|
||||
if (error.hasOwnProperty('error')) {
|
||||
error = JSON.parse(error.error)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,11 @@
|
|||
import utf8 from 'utf8'
|
||||
|
||||
export const newExporter = ({
|
||||
filename = 'data',
|
||||
getExportedObject
|
||||
}) => ({
|
||||
exportData () {
|
||||
const stringified = JSON.stringify(getExportedObject(), null, 2) // Pretty-print and indent with 2 spaces
|
||||
const stringified = utf8.encode(JSON.stringify(getExportedObject(), null, 2)) // Pretty-print and indent with 2 spaces
|
||||
|
||||
// Create an invisible link with a data url and simulate a click
|
||||
const e = document.createElement('a')
|
||||
|
|
|
|||
|
|
@ -1,15 +1,14 @@
|
|||
const fileSizeFormat = (num) => {
|
||||
var exponent
|
||||
var unit
|
||||
var units = ['B', 'KiB', 'MiB', 'GiB', 'TiB']
|
||||
const fileSizeFormat = (numArg) => {
|
||||
const units = ['B', 'KiB', 'MiB', 'GiB', 'TiB']
|
||||
let num = numArg
|
||||
if (num < 1) {
|
||||
return num + ' ' + units[0]
|
||||
}
|
||||
|
||||
exponent = Math.min(Math.floor(Math.log(num) / Math.log(1024)), units.length - 1)
|
||||
const exponent = Math.min(Math.floor(Math.log(num) / Math.log(1024)), units.length - 1)
|
||||
num = (num / Math.pow(1024, exponent)).toFixed(2) * 1
|
||||
unit = units[exponent]
|
||||
return { num: num, unit: unit }
|
||||
const unit = units[exponent]
|
||||
return { num, unit }
|
||||
}
|
||||
const fileSizeFormatService = {
|
||||
fileSizeFormat
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ export const convertHtmlToLines = (html = '') => {
|
|||
// All block-level elements that aren't empty elements, i.e. not <hr>
|
||||
const nonEmptyElements = new Set(visualLineElements)
|
||||
// Difference
|
||||
for (let elem of emptyElements) {
|
||||
for (const elem of emptyElements) {
|
||||
nonEmptyElements.delete(elem)
|
||||
}
|
||||
|
||||
|
|
@ -56,7 +56,7 @@ export const convertHtmlToLines = (html = '') => {
|
|||
...emptyElements.values()
|
||||
])
|
||||
|
||||
let buffer = [] // Current output buffer
|
||||
const buffer = [] // Current output buffer
|
||||
const level = [] // How deep we are in tags and which tags were there
|
||||
let textBuffer = '' // Current line content
|
||||
let tagBuffer = null // Current tag buffer, if null = we are not currently reading a tag
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ export const processTextForEmoji = (text, emojis, processor) => {
|
|||
if (char === ':') {
|
||||
const next = text.slice(i + 1)
|
||||
let found = false
|
||||
for (let emoji of emojis) {
|
||||
for (const emoji of emojis) {
|
||||
if (next.slice(0, emoji.shortcode.length + 1) === (emoji.shortcode + ':')) {
|
||||
found = emoji
|
||||
break
|
||||
|
|
|
|||
|
|
@ -3,9 +3,9 @@ import ISO6391 from 'iso-639-1'
|
|||
import _ from 'lodash'
|
||||
|
||||
const specialLanguageCodes = {
|
||||
'ja_easy': 'ja',
|
||||
'zh_Hant': 'zh-HANT',
|
||||
'zh': 'zh-Hans'
|
||||
ja_easy: 'ja',
|
||||
zh_Hant: 'zh-HANT',
|
||||
zh: 'zh-Hans'
|
||||
}
|
||||
|
||||
const internalToBrowserLocale = code => specialLanguageCodes[code] || code
|
||||
|
|
@ -14,16 +14,16 @@ const internalToBackendLocale = code => internalToBrowserLocale(code).replace('_
|
|||
|
||||
const getLanguageName = (code) => {
|
||||
const specialLanguageNames = {
|
||||
'ja_easy': 'やさしいにほんご',
|
||||
'zh': '简体中文',
|
||||
'zh_Hant': '繁體中文'
|
||||
ja_easy: 'やさしいにほんご',
|
||||
zh: '简体中文',
|
||||
zh_Hant: '繁體中文'
|
||||
}
|
||||
const languageName = specialLanguageNames[code] || ISO6391.getNativeName(code)
|
||||
const browserLocale = internalToBrowserLocale(code)
|
||||
return languageName.charAt(0).toLocaleUpperCase(browserLocale) + languageName.slice(1)
|
||||
}
|
||||
|
||||
const languages = _.map(languagesObject.languages, (code) => ({ code: code, name: getLanguageName(code) })).sort((a, b) => a.name.localeCompare(b.name))
|
||||
const languages = _.map(languagesObject.languages, (code) => ({ code, name: getLanguageName(code) })).sort((a, b) => a.name.localeCompare(b.name))
|
||||
|
||||
const localeService = {
|
||||
internalToBrowserLocale,
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { reduce } from 'lodash'
|
||||
|
||||
const MASTODON_PASSWORD_RESET_URL = `/auth/password`
|
||||
const MASTODON_PASSWORD_RESET_URL = '/auth/password'
|
||||
|
||||
const resetPassword = ({ instance, email }) => {
|
||||
const params = { email }
|
||||
|
|
|
|||
|
|
@ -12,20 +12,20 @@ const fetchAndUpdate = ({ store, credentials, older = false, since }) => {
|
|||
const timelineData = rootState.statuses.notifications
|
||||
const hideMutedPosts = getters.mergedConfig.hideMutedPosts
|
||||
|
||||
args['withMuted'] = !hideMutedPosts
|
||||
args.withMuted = !hideMutedPosts
|
||||
|
||||
args['timeline'] = 'notifications'
|
||||
args.timeline = 'notifications'
|
||||
if (older) {
|
||||
if (timelineData.minId !== Number.POSITIVE_INFINITY) {
|
||||
args['until'] = timelineData.minId
|
||||
args.until = timelineData.minId
|
||||
}
|
||||
return fetchNotifications({ store, args, older })
|
||||
} else {
|
||||
// fetch new notifications
|
||||
if (since === undefined && timelineData.maxId !== Number.POSITIVE_INFINITY) {
|
||||
args['since'] = timelineData.maxId
|
||||
args.since = timelineData.maxId
|
||||
} else if (since !== null) {
|
||||
args['since'] = since
|
||||
args.since = since
|
||||
}
|
||||
const result = fetchNotifications({ store, args, older })
|
||||
|
||||
|
|
@ -38,7 +38,7 @@ const fetchAndUpdate = ({ store, credentials, older = false, since }) => {
|
|||
const readNotifsIds = notifications.filter(n => n.seen).map(n => n.id)
|
||||
const numUnseenNotifs = notifications.length - readNotifsIds.length
|
||||
if (numUnseenNotifs > 0 && readNotifsIds.length > 0) {
|
||||
args['since'] = Math.max(...readNotifsIds)
|
||||
args.since = Math.max(...readNotifsIds)
|
||||
fetchNotifications({ store, args, older })
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ function deleteSubscriptionFromBackEnd (token) {
|
|||
method: 'DELETE',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Authorization': `Bearer ${token}`
|
||||
Authorization: `Bearer ${token}`
|
||||
}
|
||||
}).then((response) => {
|
||||
if (!response.ok) throw new Error('Bad status code from server.')
|
||||
|
|
@ -56,7 +56,7 @@ function sendSubscriptionToBackEnd (subscription, token, notificationVisibility)
|
|||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Authorization': `Bearer ${token}`
|
||||
Authorization: `Bearer ${token}`
|
||||
},
|
||||
body: JSON.stringify({
|
||||
subscription,
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ import { LAYERS, DEFAULT_OPACITY, SLOT_INHERITANCE } from './pleromafe.js'
|
|||
export const CURRENT_VERSION = 3
|
||||
|
||||
export const getLayersArray = (layer, data = LAYERS) => {
|
||||
let array = [layer]
|
||||
const array = [layer]
|
||||
let parent = data[layer]
|
||||
while (parent) {
|
||||
array.unshift(parent)
|
||||
|
|
@ -138,6 +138,7 @@ export const topoSort = (
|
|||
if (depsA === depsB || (depsB !== 0 && depsA !== 0)) return ai - bi
|
||||
if (depsA === 0 && depsB !== 0) return -1
|
||||
if (depsB === 0 && depsA !== 0) return 1
|
||||
return 0 // failsafe, shouldn't happen?
|
||||
}).map(({ data }) => data)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -34,20 +34,20 @@ const fetchAndUpdate = ({
|
|||
const loggedIn = !!rootState.users.currentUser
|
||||
|
||||
if (older) {
|
||||
args['until'] = until || timelineData.minId
|
||||
args.until = until || timelineData.minId
|
||||
} else {
|
||||
if (since === undefined) {
|
||||
args['since'] = timelineData.maxId
|
||||
args.since = timelineData.maxId
|
||||
} else if (since !== null) {
|
||||
args['since'] = since
|
||||
args.since = since
|
||||
}
|
||||
}
|
||||
|
||||
args['userId'] = userId
|
||||
args['tag'] = tag
|
||||
args['withMuted'] = !hideMutedPosts
|
||||
args.userId = userId
|
||||
args.tag = tag
|
||||
args.withMuted = !hideMutedPosts
|
||||
if (loggedIn && ['friends', 'public', 'publicAndExternal'].includes(timeline)) {
|
||||
args['replyVisibility'] = replyVisibility
|
||||
args.replyVisibility = replyVisibility
|
||||
}
|
||||
|
||||
const numStatusesBeforeFetch = timelineData.statuses.length
|
||||
|
|
@ -60,7 +60,7 @@ const fetchAndUpdate = ({
|
|||
|
||||
const { data: statuses, pagination } = response
|
||||
if (!older && statuses.length >= 20 && !timelineData.loading && numStatusesBeforeFetch > 0) {
|
||||
store.dispatch('queueFlush', { timeline: timeline, id: timelineData.maxId })
|
||||
store.dispatch('queueFlush', { timeline, id: timelineData.maxId })
|
||||
}
|
||||
update({ store, statuses, timeline, showImmediately, userId, pagination })
|
||||
return { statuses, pagination }
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ const highlightStyle = (prefs) => {
|
|||
'linear-gradient(to right,',
|
||||
`${solidColor} ,`,
|
||||
`${solidColor} 2px,`,
|
||||
`transparent 6px`
|
||||
'transparent 6px'
|
||||
].join(' '),
|
||||
backgroundPosition: '0 0',
|
||||
...customProps
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue