You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A clear and concise description of the problem or missing capability...
Currently, the placeholder image https://static.productionready.io/images/smiley-cyrus.jpg shows clearly on all created articles and comments when the user does not have any profile image set (default unless they edit profile after creation).
However, on locations that represent the currently logged in user, which are:
login image next to name on navbar on top right
image next to "Post Comment" button of article pages
the image is either omitted (not ideal IMO, but graceful), or an empty or bogus src= (buggy), behaviour is as follows on some existing implementations:
Here's a screenshot showing the omitted placeholder on top right, present placeholder on article I've created, and bogus placeholder next to "Post Comment":
Describe the solution you'd like
If you have a solution in mind, please describe it.
Frontends should use the placeholder everywhere to represent the currently logged in user. It is very confusing otherwise that you don't see your own placeholder, but that it does show up after posting.
Currently, when the image is unset, backends return for /api/user the value image: null:
This different behavior is needed, because when you go into Settings https://demo.realworld.io/#/settings to edit your image, you should be able to see if the field is empty or not, while everywhere else, the placeholder should be returned.
This difference of behavior is also needed to hide your email from other users.
So, we should just keep the API unchanged, and frontends should just always query the current users's /profile to get the image: data where needed, in addition/in place of /user, except for the Settings form.
Have you considered any alternative solutions or workarounds?
We could also make the API slightly better and make /api/user also return an effectiveImage key with the placeholder if one is not given. This way the login form won't have to set fetch profile as well to store it in local storage.
The text was updated successfully, but these errors were encountered:
🚀 feature request
Relevant scope
What is the scope of this request?
Description
A clear and concise description of the problem or missing capability...Currently, the placeholder image https://static.productionready.io/images/smiley-cyrus.jpg shows clearly on all created articles and comments when the user does not have any profile image set (default unless they edit profile after creation).
However, on locations that represent the currently logged in user, which are:
the image is either omitted (not ideal IMO, but graceful), or an empty or bogus
src=
(buggy), behaviour is as follows on some existing implementations:Related issue: gothinkster/react-redux-realworld-example-app#183
Here's a screenshot showing the omitted placeholder on top right, present placeholder on article I've created, and bogus placeholder next to "Post Comment":
Describe the solution you'd like
If you have a solution in mind, please describe it.Frontends should use the placeholder everywhere to represent the currently logged in user. It is very confusing otherwise that you don't see your own placeholder, but that it does show up after posting.
Currently, when the image is unset, backends return for
/api/user
the valueimage: null
:and
/api/profiles/iu4hfu4iuh3nf383u
gives:This different behavior is needed, because when you go into Settings https://demo.realworld.io/#/settings to edit your image, you should be able to see if the field is empty or not, while everywhere else, the placeholder should be returned.
This difference of behavior is also needed to hide your email from other users.
So, we should just keep the API unchanged, and frontends should just always query the current users's
/profile
to get theimage:
data where needed, in addition/in place of/user
, except for the Settings form.Here's an example of a frontend doing that: https://github.com/cirosantilli/node-express-sequelize-nextjs-realworld-example-app/blob/adb6dbeb92cbdf535f95092d639c706515515c17/components/profile/LoginForm.tsx#L36 and then you use
.effectiveImage
from local storage instead of.image
on most places.Describe alternatives you've considered
Have you considered any alternative solutions or workarounds?We could also make the API slightly better and make
/api/user
also return aneffectiveImage
key with the placeholder if one is not given. This way the login form won't have to set fetch profile as well to store it in local storage.The text was updated successfully, but these errors were encountered: