nodebb-plugin-blog-comments icon indicating copy to clipboard operation
nodebb-plugin-blog-comments copied to clipboard

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

Open Torqu3Wr3nch opened this issue 5 years ago • 1 comments

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!

Torqu3Wr3nch avatar Nov 18 '19 18:11 Torqu3Wr3nch

same problem!

simontaosim avatar Mar 16 '20 20:03 simontaosim