Merge branch 'mastoapi-login-and-config-fixes' into 'develop'
Mastoapi login and config fixes See merge request pleroma/pleroma-fe!833
This commit is contained in:
commit
ac46de3972
11 changed files with 35 additions and 58 deletions
|
@ -1,5 +1,8 @@
|
||||||
# v1.0
|
# v1.0
|
||||||
## Removed features/radically changed behavior
|
## Removed features/radically changed behavior
|
||||||
|
### formattingOptionsEnabled
|
||||||
|
as of !833 `formattingOptionsEnabled` is no longer available and instead FE check for available post formatting options and enables formatting control if there's more than one option.
|
||||||
|
|
||||||
### minimalScopesMode
|
### minimalScopesMode
|
||||||
As of !633, `scopeOptions` is no longer available and instead is changed for `minimalScopesMode` (default: `false`)
|
As of !633, `scopeOptions` is no longer available and instead is changed for `minimalScopesMode` (default: `false`)
|
||||||
|
|
||||||
|
|
|
@ -100,7 +100,6 @@ const setSettings = async ({ apiConfig, staticConfig, store }) => {
|
||||||
copyInstanceOption('redirectRootLogin')
|
copyInstanceOption('redirectRootLogin')
|
||||||
copyInstanceOption('showInstanceSpecificPanel')
|
copyInstanceOption('showInstanceSpecificPanel')
|
||||||
copyInstanceOption('minimalScopesMode')
|
copyInstanceOption('minimalScopesMode')
|
||||||
copyInstanceOption('formattingOptionsEnabled')
|
|
||||||
copyInstanceOption('hideMutedPosts')
|
copyInstanceOption('hideMutedPosts')
|
||||||
copyInstanceOption('collapseMessageWithSubject')
|
copyInstanceOption('collapseMessageWithSubject')
|
||||||
copyInstanceOption('scopeCopy')
|
copyInstanceOption('scopeCopy')
|
||||||
|
|
|
@ -174,9 +174,6 @@ const PostStatusForm = {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
formattingOptionsEnabled () {
|
|
||||||
return this.$store.state.instance.formattingOptionsEnabled
|
|
||||||
},
|
|
||||||
postFormats () {
|
postFormats () {
|
||||||
return this.$store.state.instance.postFormats || []
|
return this.$store.state.instance.postFormats || []
|
||||||
},
|
},
|
||||||
|
|
|
@ -58,7 +58,7 @@
|
||||||
>
|
>
|
||||||
</textarea>
|
</textarea>
|
||||||
<div class="visibility-tray">
|
<div class="visibility-tray">
|
||||||
<div class="text-format" v-if="formattingOptionsEnabled">
|
<div class="text-format" v-if="postFormats.length > 1">
|
||||||
<label for="post-content-type" class="select">
|
<label for="post-content-type" class="select">
|
||||||
<select id="post-content-type" v-model="newStatus.contentType" class="form-control">
|
<select id="post-content-type" v-model="newStatus.contentType" class="form-control">
|
||||||
<option v-for="postFormat in postFormats" :key="postFormat" :value="postFormat">
|
<option v-for="postFormat in postFormats" :key="postFormat" :value="postFormat">
|
||||||
|
@ -68,6 +68,11 @@
|
||||||
<i class="icon-down-open"></i>
|
<i class="icon-down-open"></i>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="text-format" v-if="postFormats.length === 1">
|
||||||
|
<span class="only-format">
|
||||||
|
{{$t(`post_status.content_type["${postFormats[0]}"]`)}}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
<scope-selector
|
<scope-selector
|
||||||
:showAll="showAllScopes"
|
:showAll="showAllScopes"
|
||||||
|
@ -173,6 +178,14 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.text-format {
|
||||||
|
.only-format {
|
||||||
|
color: $fallback--faint;
|
||||||
|
color: var(--faint, $fallback--faint);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
.error {
|
.error {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
|
@ -102,7 +102,7 @@
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li v-if="postFormats.length > 0">
|
||||||
<div>
|
<div>
|
||||||
{{$t('settings.post_status_content_type')}}
|
{{$t('settings.post_status_content_type')}}
|
||||||
<label for="postContentType" class="select">
|
<label for="postContentType" class="select">
|
||||||
|
|
|
@ -46,7 +46,9 @@ const UserSettings = {
|
||||||
pickAvatarBtnVisible: true,
|
pickAvatarBtnVisible: true,
|
||||||
bannerUploading: false,
|
bannerUploading: false,
|
||||||
backgroundUploading: false,
|
backgroundUploading: false,
|
||||||
|
banner: null,
|
||||||
bannerPreview: null,
|
bannerPreview: null,
|
||||||
|
background: null,
|
||||||
backgroundPreview: null,
|
backgroundPreview: null,
|
||||||
bannerUploadError: null,
|
bannerUploadError: null,
|
||||||
backgroundUploadError: null,
|
backgroundUploadError: null,
|
||||||
|
@ -198,22 +200,12 @@ const UserSettings = {
|
||||||
},
|
},
|
||||||
submitBg () {
|
submitBg () {
|
||||||
if (!this.backgroundPreview) { return }
|
if (!this.backgroundPreview) { return }
|
||||||
let img = this.backgroundPreview
|
let background = this.background
|
||||||
// eslint-disable-next-line no-undef
|
|
||||||
let imginfo = new Image()
|
|
||||||
let cropX, cropY, cropW, cropH
|
|
||||||
imginfo.src = img
|
|
||||||
cropX = 0
|
|
||||||
cropY = 0
|
|
||||||
cropW = imginfo.width
|
|
||||||
cropH = imginfo.width
|
|
||||||
this.backgroundUploading = true
|
this.backgroundUploading = true
|
||||||
this.$store.state.api.backendInteractor.updateBg({params: {img, cropX, cropY, cropW, cropH}}).then((data) => {
|
this.$store.state.api.backendInteractor.updateBg({ background }).then((data) => {
|
||||||
if (!data.error) {
|
if (!data.error) {
|
||||||
let clone = JSON.parse(JSON.stringify(this.$store.state.users.currentUser))
|
this.$store.commit('addNewUsers', [data])
|
||||||
clone.background_image = data.url
|
this.$store.commit('setCurrentUser', data)
|
||||||
this.$store.commit('addNewUsers', [clone])
|
|
||||||
this.$store.commit('setCurrentUser', clone)
|
|
||||||
this.backgroundPreview = null
|
this.backgroundPreview = null
|
||||||
} else {
|
} else {
|
||||||
this.backgroundUploadError = this.$t('upload.error.base') + data.error
|
this.backgroundUploadError = this.$t('upload.error.base') + data.error
|
||||||
|
|
|
@ -16,7 +16,6 @@ const defaultState = {
|
||||||
redirectRootNoLogin: '/main/all',
|
redirectRootNoLogin: '/main/all',
|
||||||
redirectRootLogin: '/main/friends',
|
redirectRootLogin: '/main/friends',
|
||||||
showInstanceSpecificPanel: false,
|
showInstanceSpecificPanel: false,
|
||||||
formattingOptionsEnabled: false,
|
|
||||||
alwaysShowSubjectInput: true,
|
alwaysShowSubjectInput: true,
|
||||||
hideMutedPosts: false,
|
hideMutedPosts: false,
|
||||||
collapseMessageWithSubject: false,
|
collapseMessageWithSubject: false,
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
/* eslint-env browser */
|
/* eslint-env browser */
|
||||||
const BG_UPDATE_URL = '/api/qvitter/update_background_image.json'
|
|
||||||
const EXTERNAL_PROFILE_URL = '/api/externalprofile/show.json'
|
const EXTERNAL_PROFILE_URL = '/api/externalprofile/show.json'
|
||||||
const QVITTER_USER_NOTIFICATIONS_READ_URL = '/api/qvitter/statuses/notifications/read.json'
|
const QVITTER_USER_NOTIFICATIONS_READ_URL = '/api/qvitter/statuses/notifications/read.json'
|
||||||
const BLOCKS_IMPORT_URL = '/api/pleroma/blocks_import'
|
const BLOCKS_IMPORT_URL = '/api/pleroma/blocks_import'
|
||||||
|
@ -25,7 +24,6 @@ const MFA_DISABLE_OTP_URL = '/api/pleroma/profile/mfa/totp'
|
||||||
|
|
||||||
const MASTODON_LOGIN_URL = '/api/v1/accounts/verify_credentials'
|
const MASTODON_LOGIN_URL = '/api/v1/accounts/verify_credentials'
|
||||||
const MASTODON_REGISTRATION_URL = '/api/v1/accounts'
|
const MASTODON_REGISTRATION_URL = '/api/v1/accounts'
|
||||||
const GET_BACKGROUND_HACK = '/api/account/verify_credentials.json'
|
|
||||||
const MASTODON_USER_FAVORITES_TIMELINE_URL = '/api/v1/favourites'
|
const MASTODON_USER_FAVORITES_TIMELINE_URL = '/api/v1/favourites'
|
||||||
const MASTODON_USER_NOTIFICATIONS_URL = '/api/v1/notifications'
|
const MASTODON_USER_NOTIFICATIONS_URL = '/api/v1/notifications'
|
||||||
const MASTODON_FAVORITE_URL = id => `/api/v1/statuses/${id}/favourite`
|
const MASTODON_FAVORITE_URL = id => `/api/v1/statuses/${id}/favourite`
|
||||||
|
@ -133,22 +131,16 @@ const updateAvatar = ({credentials, avatar}) => {
|
||||||
.then((data) => parseUser(data))
|
.then((data) => parseUser(data))
|
||||||
}
|
}
|
||||||
|
|
||||||
const updateBg = ({credentials, params}) => {
|
const updateBg = ({ credentials, background }) => {
|
||||||
let url = BG_UPDATE_URL
|
|
||||||
|
|
||||||
const form = new FormData()
|
const form = new FormData()
|
||||||
|
form.append('pleroma_background_image', background)
|
||||||
each(params, (value, key) => {
|
return fetch(MASTODON_PROFILE_UPDATE_URL, {
|
||||||
if (value) {
|
|
||||||
form.append(key, value)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
return fetch(url, {
|
|
||||||
headers: authHeaders(credentials),
|
headers: authHeaders(credentials),
|
||||||
method: 'POST',
|
method: 'PATCH',
|
||||||
body: form
|
body: form
|
||||||
}).then((data) => data.json())
|
})
|
||||||
|
.then((data) => data.json())
|
||||||
|
.then((data) => parseUser(data))
|
||||||
}
|
}
|
||||||
|
|
||||||
const updateBanner = ({credentials, banner}) => {
|
const updateBanner = ({credentials, banner}) => {
|
||||||
|
@ -544,26 +536,6 @@ const verifyCredentials = (user) => {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.then((data) => data.error ? data : parseUser(data))
|
.then((data) => data.error ? data : parseUser(data))
|
||||||
.then((mastoUser) => {
|
|
||||||
// REMOVE WHEN BE SUPPORTS background_image
|
|
||||||
return fetch(GET_BACKGROUND_HACK, {
|
|
||||||
method: 'POST',
|
|
||||||
headers: authHeaders(user)
|
|
||||||
})
|
|
||||||
.then((response) => {
|
|
||||||
if (response.ok) {
|
|
||||||
return response.json()
|
|
||||||
} else {
|
|
||||||
return {}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
/* eslint-disable camelcase */
|
|
||||||
.then(({ background_image }) => ({
|
|
||||||
...mastoUser,
|
|
||||||
background_image
|
|
||||||
}))
|
|
||||||
/* eslint-enable camelcase */
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const favorite = ({ id, credentials }) => {
|
const favorite = ({ id, credentials }) => {
|
||||||
|
|
|
@ -105,7 +105,7 @@ const backendInteractorService = (credentials) => {
|
||||||
const getCaptcha = () => apiService.getCaptcha()
|
const getCaptcha = () => apiService.getCaptcha()
|
||||||
const register = (params) => apiService.register({ credentials, params })
|
const register = (params) => apiService.register({ credentials, params })
|
||||||
const updateAvatar = ({avatar}) => apiService.updateAvatar({credentials, avatar})
|
const updateAvatar = ({avatar}) => apiService.updateAvatar({credentials, avatar})
|
||||||
const updateBg = ({params}) => apiService.updateBg({credentials, params})
|
const updateBg = ({ background }) => apiService.updateBg({ credentials, background })
|
||||||
const updateBanner = ({banner}) => apiService.updateBanner({credentials, banner})
|
const updateBanner = ({banner}) => apiService.updateBanner({credentials, banner})
|
||||||
const updateProfile = ({params}) => apiService.updateProfile({credentials, params})
|
const updateProfile = ({params}) => apiService.updateProfile({credentials, params})
|
||||||
|
|
||||||
|
|
|
@ -60,6 +60,9 @@ export const parseUser = (data) => {
|
||||||
if (data.pleroma) {
|
if (data.pleroma) {
|
||||||
const relationship = data.pleroma.relationship
|
const relationship = data.pleroma.relationship
|
||||||
|
|
||||||
|
output.background_image = data.pleroma.background_image
|
||||||
|
output.token = data.pleroma.chat_token
|
||||||
|
|
||||||
if (relationship) {
|
if (relationship) {
|
||||||
output.follows_you = relationship.followed_by
|
output.follows_you = relationship.followed_by
|
||||||
output.following = relationship.following
|
output.following = relationship.following
|
||||||
|
|
|
@ -8,7 +8,6 @@
|
||||||
"redirectRootLogin": "/main/friends",
|
"redirectRootLogin": "/main/friends",
|
||||||
"chatDisabled": false,
|
"chatDisabled": false,
|
||||||
"showInstanceSpecificPanel": false,
|
"showInstanceSpecificPanel": false,
|
||||||
"formattingOptionsEnabled": false,
|
|
||||||
"collapseMessageWithSubject": false,
|
"collapseMessageWithSubject": false,
|
||||||
"scopeCopy": true,
|
"scopeCopy": true,
|
||||||
"subjectLineBehavior": "email",
|
"subjectLineBehavior": "email",
|
||||||
|
|
Loading…
Reference in a new issue