Transition to MastoAPI: user profile settings #1952

Closed
tae wants to merge 0 commits from gitlab-mr-iid-682 into develop
Member

Closes #437

This is blocked until the API (/api/v1/accounts/update_credentials) supports these properties

default_scope,
no_rich_text,
hide_follows,
hide_followers,
show_role
Closes #437 ~~This is blocked until the API (`/api/v1/accounts/update_credentials`) supports these properties~~ ``` default_scope, no_rich_text, hide_follows, hide_followers, show_role ```
Owner

what about display name and bio?

what about display name and bio?
Author
Member

well, when clicking the Submit button, they are updated along with the other profile options (except images) altogether. not really needed to make 2 different api calls...

well, when clicking the `Submit` button, they are updated along with the other profile options (except images) altogether. not really needed to make 2 different api calls...
Owner

yeah but, like, you're still using /api/account/update_profile.json

yeah but, like, you're still using `/api/account/update_profile.json`
Owner

also i don't understand the whole refactoring going on there

also i don't understand the whole refactoring going on there
Author
Member

yeah but, like, you're still using /api/account/update_profile.json

What do you mean by this?

> yeah but, like, you're still using `/api/account/update_profile.json` What do you mean by this?
Author
Member

also i don't understand the whole refactoring going on there

because the data format for images which the mastoAPI accepts is different than the one the legacy API accepts.

  • the legacy API accepts data url (e.g, the result of canvas.toDataURL)
  • the mastoAPI accepts file or blob (e.g, the result of canvas.toBlob)
> also i don't understand the whole refactoring going on there because the data format for images which the mastoAPI accepts is different than the one the legacy API accepts. - the legacy API accepts data url (e.g, the result of `canvas.toDataURL`) - the mastoAPI accepts file or blob (e.g, the result of `canvas.toBlob`)
Owner

What do you mean by this?

Issue is about transitioning all profile editing stuff to MastoAPI. Nickname, bio, avatar, banner, background and other options like "hide my followers". This MR only changes avatar and banner update, doesn't handle updating bio and nickname.

>What do you mean by this? Issue is about transitioning all profile editing stuff to MastoAPI. Nickname, bio, avatar, banner, background and other options like "hide my followers". This MR only changes avatar and banner update, doesn't handle updating bio and nickname.
Author
Member

doesn't handle updating bio and nickname.

as I mentioned before, they are updated along with the other profile options (e.g, no_rich_text) altogether triggered by only one user action (i.e, clicking the submit button).

isn't it an overkill to send two API calls to handle one user action regardless we can do it using one call?

> doesn't handle updating bio and nickname. as I mentioned before, they are updated along with the other profile options (e.g, `no_rich_text`) altogether triggered by only one user action (i.e, clicking the submit button). isn't it an overkill to send two API calls to handle one user action regardless we can do it using one call?
Owner

Then remove the

const PROFILE_UPDATE_URL = '/api/account/update_profile.json'
Then remove the ```js const PROFILE_UPDATE_URL = '/api/account/update_profile.json' ```
Author
Member

sorry! that's what we still need to use.

sorry! that's what we still need to use.
Author
Member

there is no mastoapi equivalent to that

which accepts all options of that

there is no mastoapi equivalent to that which accepts all options of that
Owner

Pass options that are accepted and pester BE folk to add missing ones! It's already mentioned in pleroma#674 too

Pass options that are accepted and pester BE folk to add missing ones! It's already mentioned in pleroma#674 too
Owner

@tae take a look at this: pleroma/pleroma#674

can't confirm if it's in develop version of BE tho. Another thing is that default_scope should be in source.privacy - https://docs.joinmastodon.org/api/rest/accounts/#patch-api-v1-accounts-update-credentials

@tae take a look at this: https://git.pleroma.social/pleroma/pleroma/issues/674#note_25875 can't confirm if it's in develop version of BE tho. Another thing is that default_scope should be in `source.privacy` - https://docs.joinmastodon.org/api/rest/accounts/#patch-api-v1-accounts-update-credentials
Member

can't confirm if it's in develop version of BE tho

We don't mark tasks as completed before the solution is in develop

> can't confirm if it's in develop version of BE tho We don't mark tasks as completed before the solution is in develop
Owner

i meant i couldn't find MR and didn't update BE and checked if it's actually working :)

no offense, just extra verification.

i meant i couldn't find MR and didn't update BE and checked if it's actually working :) no offense, just extra verification.
Author
Member

Thanks!

Thanks!
Author
Member

everything works great except updating source[privacy].
@rinpatch could you check why source[privacy] is not updating?

everything works great except updating `source[privacy]`. @rinpatch could you check why `source[privacy]` is not updating?
Member

When updating it should be default_scope, but when recieving it should be source[privacy]

When updating it should be `default_scope`, but when recieving it should be `source[privacy]`
Author
Member

thanks, I will try right away.

thanks, I will try right away.
Author
Member

hmm, it is not working.

  • request payload

Screenshot_at_Apr_27_16-07-26

  • response

Screenshot_at_Apr_27_16-07-50

btw, my instance is up to date.

hmm, it is not working. - request payload ![Screenshot_at_Apr_27_16-07-26](/attachments/8c6ecc9e-21b1-4a34-89b2-cd5ec394f23c) - response ![Screenshot_at_Apr_27_16-07-50](/attachments/f56622a1-8a18-42e6-a680-11eb552a264e) btw, my instance is up to date.
Member

Oh sorry, it really was a mistake on my end. Fixed in pleroma!1100

Oh sorry, it really was a mistake on my end. Fixed in pleroma!1100
Author
Member

thanks 😄

thanks :smile:
Member

@tae should be fixed now

@tae should be fixed now
Author
Member

this is done

this is done
Owner

not sure you need to wrap it in a promise...

not sure you need to wrap it in a promise...
Author
Member

because ImageCropper component accepts submitHandler which returns a promise

because `ImageCropper` component accepts submitHandler which returns a promise
Owner

yeah but you can do just

return that.$store.state.api.backendInteractor.updateAvatar({ avatar })
  .then(...)
  .catch(...)

since .then and .catch return promise.

not sure what's the better approach with .catch though, you could retrow or you could return Promise.reject() or something like it.

yeah but you can do just ```js return that.$store.state.api.backendInteractor.updateAvatar({ avatar }) .then(...) .catch(...) ``` since `.then` and `.catch` return promise. not sure what's the better approach with `.catch` though, you could retrow or you could return `Promise.reject()` or something like it.
Owner

seems to be working fine.

seems to be working fine.
Author
Member
that pattern doesn't work due to this https://git.pleroma.social/pleroma/pleroma-fe/blob/3665c86d709f3a04ae3471d09b84a69c8a8c9172/src/components/user_settings/user_settings.js#L169
Owner

ok, fair enough

ok, fair enough

Pull request closed

Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
pleroma/pleroma-fe!1952
No description provided.