ClaireRoush / ReactGirlySocialNetwork

A smol social network for cuties!!
https://rgsn.live
4 stars 1 forks source link

add a default avatar to display when there is none #68

Open froggy-jpg opened 1 month ago

OlegSuperBro commented 4 weeks ago

it actually exist already, but only on new users. In backend models, user model we have this line userAvatar: { type: String, default: "/static/images/default_user_avatar.png", required: false }, it don't work if user didn't had avatar before update (update commits 77b9d7ae14459ed4bbb393ea49014da6a243f10f and 262577aee10cbe8472539554f1e8b27999a0169d)

froggy-jpg commented 4 weeks ago

i see. does that work as a fallback avatar when the user specified one doesnt load or is it only displayed when user didnt specify an avatar?

OlegSuperBro commented 4 weeks ago

it works only if user didn't changed avatar after registration. I think we need add image check on frontend and backend to not allow users set empty avatar value

froggy-jpg commented 3 weeks ago

yeah that what i meant to say, i think it would be good to have a fallback avatar because empty ones when an avatar failes to load look out of place and weird

OlegSuperBro commented 3 weeks ago

don't we have to don't allow setting avatar to nothing on frontend? Right now we don't have too much users, we can run script to set default avatar for everyone who don't have it/is deleted

froggy-jpg commented 3 weeks ago

no i dont mean that, i mean when it fails to fetch the avatar set by the user we default it to something else

OlegSuperBro commented 3 weeks ago

I don't think it's a good idea. For the user it can look weird. Just imagine if you just uploaded your new avatar but it's just not saved at the backend for some reason. You will see like you have set an avatar, but it displays the default one because the database has a record for the new avatar but the file doesn't exist. IMHO we should just set the default avatar for everyone who doesn't have it and implement things that prevents any way to set empty avatar

froggy-jpg commented 3 weeks ago

yeah and thats a good thing, having a default avatar would be better than having a blank square, it looks bad

OlegSuperBro commented 3 weeks ago

i'm thinking about it. Why are images stored as full urls and not just filenames? i think this requires rewriting how image file saved and db records written

froggy-jpg commented 3 weeks ago

you gotta take it up with our girlboss :nail_care: @ClaireRoush

froggy-jpg commented 3 weeks ago

i suggest we do it the same way we do as with the spinny frog @OlegSuperBro