psychobunny / nodebb-plugin-blog-comments

Lets NodeBB act as a comments engine/widget for your blog
BSD 2-Clause "Simplified" License
98 stars 55 forks source link

Broken Comment User CSS Avatar When Logged In vs Not Logged In #87

Open Torqu3Wr3nch opened 4 years ago

Torqu3Wr3nch commented 4 years ago

Hi everyone,

I believe I've identified an issue with this plug in when used with the Ghost platform. When logged into nodebb and viewing comments on a Ghost blog, if the user has not uploaded an avatar (which most users haven't), the "image" next to their comment displays as a broken image. If you are not logged in, the CSS avatar displays correctly.

This can be seen on my blog in the comments at https://engineerworkshop.com/2019/08/14/how-to-set-up-vlans-on-an-l3-switch-hp-1910-with-pfsense/

Looking at the page with developer tools, it appears that, when logged in, the script is trying to populate the user comment image with an img tag. However, when not logged in, the script uses the more appropriate inline styling since the user doesn't have an uploaded image avatar:

image

I did some preliminary investigation and I believe the source of this problem is coming from the template:

https://github.com/psychobunny/nodebb-plugin-blog-comments/blob/ed0156594a44c6429743e314e9b5a313fad60730/public/templates/comments/comments.tpl#L32-L40

Is user.picture not null for some reason when logged in (even as a different user) and therefore the template is attempting to insert an img tag?

It makes the comments section look clunky to registered users so thank you for your help in advance!

simontaosim commented 4 years ago

same problem!