Merge branch 'develop' into 'muting-fixes'
# Conflicts: # src/components/status/status.js
This commit is contained in:
commit
1306fac38f
27 changed files with 724 additions and 79 deletions
|
@ -4,7 +4,6 @@ import 'whatwg-fetch'
|
|||
import { RegistrationError, StatusCodeError } from '../errors/errors'
|
||||
|
||||
/* eslint-env browser */
|
||||
const EXTERNAL_PROFILE_URL = '/api/externalprofile/show.json'
|
||||
const QVITTER_USER_NOTIFICATIONS_READ_URL = '/api/qvitter/statuses/notifications/read.json'
|
||||
const BLOCKS_IMPORT_URL = '/api/pleroma/blocks_import'
|
||||
const FOLLOW_IMPORT_URL = '/api/pleroma/follow_import'
|
||||
|
@ -220,14 +219,6 @@ const authHeaders = (accessToken) => {
|
|||
}
|
||||
}
|
||||
|
||||
const externalProfile = ({ profileUrl, credentials }) => {
|
||||
let url = `${EXTERNAL_PROFILE_URL}?profileurl=${profileUrl}`
|
||||
return fetch(url, {
|
||||
headers: authHeaders(credentials),
|
||||
method: 'GET'
|
||||
}).then((data) => data.json())
|
||||
}
|
||||
|
||||
const followUser = ({ id, credentials }) => {
|
||||
let url = MASTODON_FOLLOW_URL(id)
|
||||
return fetch(url, {
|
||||
|
@ -966,7 +957,6 @@ const apiService = {
|
|||
updateBg,
|
||||
updateProfile,
|
||||
updateBanner,
|
||||
externalProfile,
|
||||
importBlocks,
|
||||
importFollows,
|
||||
deleteAccount,
|
||||
|
|
|
@ -127,8 +127,6 @@ const backendInteractorService = credentials => {
|
|||
const updateBanner = ({ banner }) => apiService.updateBanner({ credentials, banner })
|
||||
const updateProfile = ({ params }) => apiService.updateProfile({ credentials, params })
|
||||
|
||||
const externalProfile = (profileUrl) => apiService.externalProfile({ profileUrl, credentials })
|
||||
|
||||
const importBlocks = (file) => apiService.importBlocks({ file, credentials })
|
||||
const importFollows = (file) => apiService.importFollows({ file, credentials })
|
||||
|
||||
|
@ -194,7 +192,6 @@ const backendInteractorService = credentials => {
|
|||
updateBg,
|
||||
updateBanner,
|
||||
updateProfile,
|
||||
externalProfile,
|
||||
importBlocks,
|
||||
importFollows,
|
||||
deleteAccount,
|
||||
|
|
|
@ -9,10 +9,7 @@ const fetchUser = (attempt, user, store) => new Promise((resolve, reject) => {
|
|||
if (!following && !(locked && sent) && attempt <= 3) {
|
||||
// If we BE reports that we still not following that user - retry,
|
||||
// increment attempts by one
|
||||
return fetchUser(++attempt, user, store)
|
||||
} else {
|
||||
// If we run out of attempts, just return whatever status is.
|
||||
return sent
|
||||
fetchUser(++attempt, user, store)
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -23,7 +20,7 @@ export const requestFollow = (user, store) => new Promise((resolve, reject) => {
|
|||
|
||||
if (updated.following || (user.locked && user.requested)) {
|
||||
// If we get result immediately or the account is locked, just stop.
|
||||
resolve({ sent: updated.requested })
|
||||
resolve()
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -35,8 +32,8 @@ export const requestFollow = (user, store) => new Promise((resolve, reject) => {
|
|||
// Recursive Promise, it will call itself up to 3 times.
|
||||
|
||||
return fetchUser(1, user, store)
|
||||
.then((sent) => {
|
||||
resolve({ sent })
|
||||
.then(() => {
|
||||
resolve()
|
||||
})
|
||||
})
|
||||
})
|
||||
|
|
18
src/services/new_api/password_reset.js
Normal file
18
src/services/new_api/password_reset.js
Normal file
|
@ -0,0 +1,18 @@
|
|||
import { reduce } from 'lodash'
|
||||
|
||||
const MASTODON_PASSWORD_RESET_URL = `/auth/password`
|
||||
|
||||
const resetPassword = ({ instance, email }) => {
|
||||
const params = { email }
|
||||
const query = reduce(params, (acc, v, k) => {
|
||||
const encoded = `${k}=${encodeURIComponent(v)}`
|
||||
return `${acc}&${encoded}`
|
||||
}, '')
|
||||
const url = `${instance}${MASTODON_PASSWORD_RESET_URL}?${query}`
|
||||
|
||||
return window.fetch(url, {
|
||||
method: 'POST'
|
||||
})
|
||||
}
|
||||
|
||||
export default resetPassword
|
|
@ -22,7 +22,7 @@ const setStyle = (href, commit) => {
|
|||
***/
|
||||
const head = document.head
|
||||
const body = document.body
|
||||
body.style.display = 'none'
|
||||
body.classList.add('hidden')
|
||||
const cssEl = document.createElement('link')
|
||||
cssEl.setAttribute('rel', 'stylesheet')
|
||||
cssEl.setAttribute('href', href)
|
||||
|
@ -46,7 +46,7 @@ const setStyle = (href, commit) => {
|
|||
head.appendChild(styleEl)
|
||||
// const styleSheet = styleEl.sheet
|
||||
|
||||
body.style.display = 'initial'
|
||||
body.classList.remove('hidden')
|
||||
}
|
||||
|
||||
cssEl.addEventListener('load', setDynamic)
|
||||
|
@ -75,7 +75,7 @@ const applyTheme = (input, commit) => {
|
|||
const { rules, theme } = generatePreset(input)
|
||||
const head = document.head
|
||||
const body = document.body
|
||||
body.style.display = 'none'
|
||||
body.classList.add('hidden')
|
||||
|
||||
const styleEl = document.createElement('style')
|
||||
head.appendChild(styleEl)
|
||||
|
@ -86,7 +86,7 @@ const applyTheme = (input, commit) => {
|
|||
styleSheet.insertRule(`body { ${rules.colors} }`, 'index-max')
|
||||
styleSheet.insertRule(`body { ${rules.shadows} }`, 'index-max')
|
||||
styleSheet.insertRule(`body { ${rules.fonts} }`, 'index-max')
|
||||
body.style.display = 'initial'
|
||||
body.classList.remove('hidden')
|
||||
|
||||
// commit('setOption', { name: 'colors', value: htmlColors })
|
||||
// commit('setOption', { name: 'radii', value: radii })
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue