commit: 9df99c5205b1cb560bb25c0dd81cc90acbde4d7f
parent: 855080b89634d7aceacd5dde38893c68a11a3ff0
Author: HJ <30-hj@users.noreply.git.pleroma.social>
Date: Wed, 12 Jun 2019 19:42:25 +0000
Merge branch 'masto-login-fixes' into 'develop'
MastoAPI login
See merge request pleroma/pleroma-fe!805
Diffstat:
3 files changed, 21 insertions(+), 5 deletions(-)
diff --git a/src/components/user_settings/user_settings.vue b/src/components/user_settings/user_settings.vue
@@ -44,6 +44,7 @@
<scope-selector
:showAll="true"
:userDefault="newDefaultScope"
+ :initialScope="newDefaultScope"
:onScopeChange="changeVis"/>
</div>
</div>
diff --git a/src/services/api/api.service.js b/src/services/api/api.service.js
@@ -1,5 +1,4 @@
/* eslint-env browser */
-const LOGIN_URL = '/api/account/verify_credentials.json'
const REGISTRATION_URL = '/api/account/register.json'
const BG_UPDATE_URL = '/api/qvitter/update_background_image.json'
const EXTERNAL_PROFILE_URL = '/api/externalprofile/show.json'
@@ -18,6 +17,7 @@ const ADMIN_USERS_URL = '/api/pleroma/admin/users'
const SUGGESTIONS_URL = '/api/v1/suggestions'
const NOTIFICATION_SETTINGS_URL = '/api/pleroma/notification_settings'
+const MASTODON_LOGIN_URL = '/api/v1/accounts/verify_credentials'
const MASTODON_USER_FAVORITES_TIMELINE_URL = '/api/v1/favourites'
const MASTODON_USER_NOTIFICATIONS_URL = '/api/v1/notifications'
const MASTODON_FAVORITE_URL = id => `/api/v1/statuses/${id}/favourite`
@@ -513,8 +513,7 @@ const fetchPinnedStatuses = ({ id, credentials }) => {
}
const verifyCredentials = (user) => {
- return fetch(LOGIN_URL, {
- method: 'POST',
+ return fetch(MASTODON_LOGIN_URL, {
headers: authHeaders(user)
})
.then((response) => {
@@ -526,6 +525,7 @@ const verifyCredentials = (user) => {
}
}
})
+
.then((data) => data.error ? data : parseUser(data))
}
diff --git a/src/services/entity_normalizer/entity_normalizer.service.js b/src/services/entity_normalizer/entity_normalizer.service.js
@@ -71,6 +71,23 @@ export const parseUser = (data) => {
moderator: data.pleroma.is_moderator,
admin: data.pleroma.is_admin
}
+ // TODO: Clean up in UI? This is duplication from what BE does for qvitterapi
+ if (output.rights.admin) {
+ output.role = 'admin'
+ } else if (output.rights.moderator) {
+ output.role = 'moderator'
+ } else {
+ output.role = 'member'
+ }
+ }
+
+ if (data.source) {
+ output.description = data.source.note
+ output.default_scope = data.source.privacy
+ if (data.source.pleroma) {
+ output.no_rich_text = data.source.pleroma.no_rich_text
+ output.show_role = data.source.pleroma.show_role
+ }
}
// TODO: handle is_local
@@ -105,8 +122,6 @@ export const parseUser = (data) => {
output.muted = data.muted
- // QVITTER ONLY FOR NOW
- // Really only applies to logged in user, really.. I THINK
if (data.rights) {
output.rights = {
moderator: data.rights.delete_others_notice,