Commit 0dad4a4a authored by HJ's avatar HJ 🐼

Merge remote-tracking branch 'upstream/develop' into otp-support

* upstream/develop:
  Apply suggestion to src/services/entity_normalizer/entity_normalizer.service.js
  i18n/Update Japanese translation
  mastoapi login works
parents 39f80fbf 9df99c52
Pipeline #13116 passed with stages
in 5 minutes and 44 seconds
......@@ -44,6 +44,7 @@
<scope-selector
:showAll="true"
:userDefault="newDefaultScope"
:initialScope="newDefaultScope"
:onScopeChange="changeVis"/>
</div>
</div>
......
This diff is collapsed.
This diff is collapsed.
/* 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'
......@@ -25,6 +24,7 @@ const MFA_SETUP_OTP_URL = '/api/pleroma/profile/mfa/setup/totp'
const MFA_CONFIRM_OTP_URL = '/api/pleroma/profile/mfa/confirm/totp'
const MFA_DISABLE_OTP_URL = '/api/pleroma/profile/mfa/totp'
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`
......@@ -520,8 +520,7 @@ const fetchPinnedStatuses = ({ id, credentials }) => {
}
const verifyCredentials = (user) => {
return fetch(LOGIN_URL, {
method: 'POST',
return fetch(MASTODON_LOGIN_URL, {
headers: authHeaders(user)
})
.then((response) => {
......@@ -533,6 +532,7 @@ const verifyCredentials = (user) => {
}
}
})
.then((data) => data.error ? data : parseUser(data))
}
......
......@@ -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,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment