Allow remove of banner, avatar images issue #353 #2146

Closed
wyatt777 wants to merge 22 commits from gitlab-mr-iid-879 into develop
Member

Added in new backend API calls to do this.

Added in new backend API calls to do this.
Owner

dangerous change, why?

dangerous change, why?
Owner

hard coded file names seems like quite the no-no

hard coded file names seems like quite the no-no
Owner

this isn't a clone

this isn't a clone
Owner

seems like a very hacky way of achieving the reset tbh

seems like a very hacky way of achieving the reset tbh
Owner

also indexOf === -1 instead of includes()

also `indexOf === -1` instead of `includes()`
Owner

also if (boolean) { return true } else { return false } all over the place

also `if (boolean) { return true } else { return false }` all over the place
Owner

i'd rather make user avatar component handle undefined correctly instead of (temporarily?) setting it to semi-hardcoded string

i'd rather make user avatar component handle undefined correctly instead of (temporarily?) setting it to semi-hardcoded string
Owner

what's a "blank user"? is it a BE bug?

what's a "blank user"? is it a BE bug?
Owner

"the X image" sounds weird to me

"the X image" sounds weird to me
Owner

hold on, those aren't in Mastodon API, are those pleroma extensions? why are they in /api/v1/ ?

hold on, those aren't in Mastodon API, are those pleroma extensions? why are they in /api/v1/ ?
Owner

Yes these are Pleroma extensions to the Mastodon API

Yes these are Pleroma extensions to the Mastodon API
Author
Member

This is min-width for buttons only on settings. Did you think dangerous because you thought it was for all buttons? That would be. The smallest button is Submit and it looks fine at this width.

The new button Reset Avatar looks better at this width in English. Would need to check it for all other languages.

This is min-width for buttons only on settings. Did you think dangerous because you thought it was for all buttons? That would be. The smallest button is Submit and it looks fine at this width. The new button Reset Avatar looks better at this width in English. Would need to check it for all other languages.
Author
Member

It sends back User data with everything as undefined. Will double check if it is something I did and if not post it as an issue on the merged BE branch. I would really like it to return the same way that the other API works.

It sends back User data with everything as undefined. Will double check if it is something I did and if not post it as an issue on the merged BE branch. I would really like it to return the same way that the other API works.
Author
Member

Fixed the two issue by @hj . @shpuld What do you recommend?

Fixed the two issue by @hj . @shpuld What do you recommend?
Author
Member

I looked into user_avatar component. It seems to not be working..

I made a fix locally and realized changing that will only affect one location. Changing profile_image_url will change Avatars in all locations. The original request should be another issue for that component.

I looked into user_avatar component. It seems to not be working.. I made a fix locally and realized changing that will only affect one location. Changing `profile_image_url` will change Avatars in all locations. The original request should be another issue for that component.
Author
Member

Ha! Any suggestions? Just avatar?

Ha! Any suggestions? Just avatar?
Author
Member

Actually images/avi.png is hardcoded in multiple places across FE. I guess we could eventually move it to a setting and change all of those locations.

Actually `images/avi.png` is hardcoded in multiple places across FE. I guess we could eventually move it to a setting and change all of those locations.
Author
Member

Please look at submitAvatar. I would like to set it like that. But the backend is returning a user with everything undefined. For now, I will make it just change the user state.

Please look at submitAvatar. I would like to set it like that. But the backend is returning a user with everything undefined. For now, I will make it just change the user state.
Author
Member

Moving this to BE. Seems to be a bug there.

Moving this to BE. Seems to be a bug there.
Author
Member

@shpuld changed the hardcoded places for /images/avi.png across FE. @hj Switched to includes() and made boolean switches one liners.

@shpuld changed the hardcoded places for `/images/avi.png` across FE. @hj Switched to `includes()` and made boolean switches one liners.
Owner

yea

yea
Author
Member

k

k
Author
Member

pushed.

pushed.
Owner

"looks better" is very questionable, and should be accompanied with screenshots and probably other relevant changes. Which seems like out of scope for this task

"looks better" is very questionable, and should be accompanied with screenshots and probably other relevant changes. Which seems like out of scope for this task
Owner

what do you mean, one location? you should change profile_image_url to undefined as well as other things like banner and background. Relevant components must be taught how to handle this situation.

what do you mean, one location? you should change `profile_image_url` to `undefined` as well as other things like banner and background. Relevant components must be taught how to handle this situation.
Owner

what do you mean "everything undefined"? what's everything? this (with bad endpoint path) sounds like a BE bug, and we should not fix BE's bugs on FE, at least in most cases.

what do you mean "**everything** undefined"? what's **everything**? this (with bad endpoint path) sounds like a BE bug, and we should not fix BE's bugs on FE, at least in most cases.
Author
Member

ok. Will reset it back to 10em.

ok. Will reset it back to 10em.
Author
Member

It means I get an object back where all of the fields within that object are not defined. i.e. user_id: undefined. Yes, it would be better if the endpoint returned the same way that submitAvatar returns.

It means I get an object back where all of the fields within that object are not defined. i.e. user_id: undefined. Yes, it would be better if the endpoint returned the same way that submitAvatar returns.
Author
Member

I do not think you are understanding this one. We have a component user_avatar when I change the code to work properly on undefined, it works. However, the image sample within the settings is not defined within user_avatar. It is set by the state profile_image_url. Image in the component will change for user_avatar, but the image sample within settings will not. This tells me it is more straightforward to set the profile_image_url; this is a state and that is what state's are meant to do.

I do not think you are understanding this one. We have a component user_avatar when I change the code to work properly on undefined, it works. However, the image sample within the settings is not defined within user_avatar. It is set by the state profile_image_url. Image in the component will change for user_avatar, but the image sample within settings will not. This tells me it is more straightforward to set the profile_image_url; this is a state and that is what state's are meant to do.
Author
Member

Actually I see what you want now. All locations where these images might occur you want me to make sure they can handle the case that they are undefined? This also seems a bit out of scope because they might occur in multiple components, but would be happy to do it.

Actually I see what you want now. All locations where these images might occur you want me to make sure they can handle the case that they are undefined? This also seems a bit out of scope because they might occur in multiple components, but would be happy to do it.
Author
Member

At 12em
Image_2019-07-11_at_11.03.58_PM

At 10em
Image_2019-07-11_at_11.05.20_PM

The only side effect is that min-width for button on settings get slightly longer, this means that the 'submit' button gets slightly longer. My wife says I might be A-blood type because I prefer that the button sizes match each other 😄 Reverting this because it seems out of scope for this task.

At 12em ![Image_2019-07-11_at_11.03.58_PM](/attachments/b48887fb-90f4-46b2-a02b-fb31153dab30) At 10em ![Image_2019-07-11_at_11.05.20_PM](/attachments/c92481a3-0180-4a3e-9ee9-f238379f1bee) The only side effect is that min-width for button on settings get slightly longer, this means that the 'submit' button gets slightly longer. My wife says I might be A-blood type because I prefer that the button sizes match each other :smile: Reverting this because it seems out of scope for this task.
Owner

report this to BE then, and while they're at it they should probably change to /api/pleroma endpoints instead of /api/v1.

on topic of "clones" - as shp mentioned - this isn't a clone - you're just mutating same object. I'm not sure you even need to update users in this case. calling it a clone is a misnomer.

report this to BE then, and while they're at it they should probably change to `/api/pleroma` endpoints instead of `/api/v1`. on topic of "clones" - as shp mentioned - this isn't a clone - you're just mutating same object. I'm not sure you even need to update users in this case. calling it a clone is a misnomer.
Owner

profile banner is used in user card only. user avatar has its own component. profile background is used in one place only, maybe two. I don't think it's that big of a task and it's closely related to this one.

Although, I really do wonder how users what users without an avatar are represented, i think they might have the default string instead of an undefined.

profile banner is used in user card only. user avatar has its own component. profile background is used in one place only, maybe two. I don't think it's that big of a task and it's closely related to this one. Although, I really do wonder how users what users without an avatar are represented, i think they might have the default string instead of an undefined.
Owner

why are they in /api/v1 tho?

why are they in /api/v1 tho?
Author
Member

That sounds correct. 1 to 2 locations for each. Will do that and push it.,

That sounds correct. 1 to 2 locations for each. Will do that and push it.,
Author
Member

Do need to update user state or set images to undefined. But agree on everything else. Will look into the changes for this.

Do need to update user state or set images to undefined. But agree on everything else. Will look into the changes for this.
Owner

Because it's an extension to the Mastodon API. We're keeping it in that namespace and Mastodon can follow our lead or not, doesn't matter to us. This is Marlboro country now :cowboy:

edit: not that different from adding the bookmarks stuff into the Mastodon API namespace but upstream Mastodon doesn't have it either

Because it's an extension to the Mastodon API. We're keeping it in that namespace and Mastodon can follow our lead or not, doesn't matter to us. This is Marlboro country now :cowboy: edit: not that different from adding the bookmarks stuff into the Mastodon API namespace but upstream Mastodon doesn't have it either
Owner

we had other extensions to mastodon api and they reside in /api/pleroma why this one different?

what are you going to do when they actually implement those endpoint but differently? huh?

we had other extensions to mastodon api and they reside in `/api/pleroma` why this one different? what are you going to do when they actually implement those endpoint but differently? huh?
Author
Member

These images can now handle null inputs.

These images can now handle null inputs.
Author
Member

Removed the name clone. Still updates the user state to set images to null. Mentioned the empty user object on the original BE issue.

Removed the name clone. Still updates the user state to set images to null. Mentioned the empty user object on the original BE issue.
Member

I agree with hj, all the previous api extensions were under /api/pleroma or /api/v1/pleroma if they used mastoapi entities, there is no reason this one should be different

I agree with hj, all the previous api extensions were under `/api/pleroma` or `/api/v1/pleroma` if they used mastoapi entities, there is no reason this one should be different
Owner

i feel like those could be made into a computed property

i feel like those could be made into a computed property
Owner

Are we always going to be scared of what Mastodon may or may not do or are we going to start moving the API forward ourselves and make Mastodon implement our features?

This should have been brought up before it was merged, but we can change it.

Are we always going to be scared of what Mastodon may or may not do or are we going to start moving the API forward ourselves and make Mastodon implement *our* features? This should have been brought up before it was merged, but we can change it.
Member

I think we should namespace our extensions. Since I merged this the other day, we can simply change the namespacing.

I think we should namespace our extensions. Since I merged this the other day, we can simply change the namespacing.
Owner

@feld it's not about being scared, it's about being careful at what we do and how we do. They might implement """"""""our"""""""" features different on same or slightly different endpoints, with different behaviors, and then BE (and FE) will have to change it because we also want compatibility with apps.

And hey, since we are on topic of "make Mastodon implement our features" let's go back to QvitterAPI, it's so much better than MastodonAPI and just expect that Mastodon will support that because reasons

@feld it's not about being scared, it's about being careful at what we do and how we do. They might implement """"""""our"""""""" features different on same or slightly different endpoints, with different behaviors, and then BE (and FE) will have to change it because we also want compatibility with apps. And hey, since we are on topic of "make Mastodon implement our features" let's go back to QvitterAPI, it's so much better than MastodonAPI and just expect that Mastodon will support that because reasons
Owner

There are few clients except PleromaFE that implemented that API, which is the problem. Mastodon's client API is the only client API with adoption which is why we added it in the first place.

There are few clients except PleromaFE that implemented that API, which is the problem. Mastodon's client API is the only client API with adoption which is why we added it in the first place.
Owner

i take it those "few" clients are again, the ones that (((we))) "control".

this again just an example of not thinking ahead enough. No idea why it wasn't brought up, i remember people being very uncooperative in regards of "extending the API"

i take it those "few" clients are again, the ones that (((we))) "control". this again just an example of not thinking ahead enough. No idea why it wasn't brought up, i remember people being very uncooperative in regards of "extending the API"
Author
Member

Possibly. Currently the user presses a button and a confirmation window appears. Interactions like button clicks are normally methods in Vue.

More details?

Possibly. Currently the user presses a button and a confirmation window appears. Interactions like button clicks are normally methods in Vue. More details?
Author
Member

Changed API names to /api/v1/pleroma to match backend.

Changed API names to `/api/v1/pleroma` to match backend.
Owner

i'm talking about avatarImgSrc (src) and bannerImgSrc (src)

i'm talking about `avatarImgSrc (src)` and `bannerImgSrc (src)`
Owner

those are used to fallback to default when user's avatar is undefined, could easily become computed properties:

  bannerImg () {
    const original = user.profile_image_url_original
    return original || this.defaultBanner
  }
those are used to fallback to default when user's avatar is `undefined`, could easily become computed properties: ``` bannerImg () { const original = user.profile_image_url_original return original || this.defaultBanner } ```
Author
Member

That makes sense. Changes made 😃

That makes sense. Changes made :smiley:
Owner

if you use a template literal it's more clear that it's a string we're dealing with

if you use a template literal it's more clear that it's a string we're dealing with
Owner

why do we have the argument if no one ever uses it?

why do we have the argument if no one ever uses it?
Author
Member

changed

changed
Author
Member

removed! :)

removed! :)
Member

Has the BE issue been resolved? Is there an issue I can look at? I tried searching and didn't find anything that seemed relevant.

Has the BE issue been resolved? Is there an issue I can look at? I tried searching and didn't find anything that seemed relevant.
Author
Member

yes, I am rebasing to get this pushed.

yes, I am rebasing to get this pushed.
Author
Member

@shpuld I rebased this for review. In the test the Firefox browser keeps failing. Any idea why that may happen?

@shpuld I rebased this for review. In the test the Firefox browser keeps failing. Any idea why that may happen?
Owner

CI is borked rn

CI is borked rn
Member

It may be solved if shm size set 2g
https://github.com/karma-runner/karma-firefox-launcher/issues/104#issuecomment-522371253

For example, setting DOCKER_SHM_SIZE in Settings -> CI / CD -> Variables?

It may be solved if shm size set 2g\ https://github.com/karma-runner/karma-firefox-launcher/issues/104#issuecomment-522371253 For example, setting `DOCKER_SHM_SIZE` in Settings -> CI / CD -> Variables?
Author
Member

Thanks!
In any case, this is ready for review @hj @shpuld .

Thanks! In any case, this is ready for review @hj @shpuld .
Author
Member

@shpuld @hj this one is still ready for checking :)

@shpuld @hj this one is still ready for checking :)
Member

This line seems to break the Who to follow panel.

This line seems to break the _Who to follow_ panel.
Member
This works well: https://git.pleroma.social/hakabahitoyo/pleroma-fe/commit/269304d3c28e096d45ac4a490bf2657c4e14cacc.
Author
Member

I need to resolve the merge conflicts and will change that. Thanks!

I need to resolve the merge conflicts and will change that. Thanks!
Owner

I'm branching off of this branch to fix the conflicts and to make some things look prettier at #2423

I'm branching off of this branch to fix the conflicts and to make some things look prettier at #2423

Pull request closed

Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
8 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!2146
No description provided.