New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LinkTag: correctly display organization avatar #13928
LinkTag: correctly display organization avatar #13928
Conversation
Thank you for opening this PR! We appreciate you! For all pull requests coming from third-party forks we will need to A Forem Team member will review this contribution and get back to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey Meg, thanks for the PR! 💯 It looks great! Just a couple nitpicks — and one of them is just a suggestion that I'm not even sure is feasible. 😂
Admittedly I haven't watched the full stream so I don't know if y'all talked about these changes or not. Either way, it was great to see a Ruby for Good friend come through my GitHub notifications. 🙌🏼
db/schema.rb
Outdated
t.datetime "updated_at", precision: 6, null: false | ||
t.integer "user_id" | ||
t.integer "user_id", null: false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't look like there are any migrations included here. Can we remove the diff for db/schema.rb
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure thing! I think that was automatically added when I ran the migrations. (I couldn't get Docker to cooperate with me so I ended up building locally instead.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@meg-gutshall I fixed this for you so we can get this PR merged 😃
app/views/articles/_liquid.html.erb
Outdated
<% if article.organization %> | ||
<a href='<%= article.organization.path %>' class='ltag__link__link'> | ||
<div class='ltag__link__org__pic'> | ||
<img src='<%= Images::Profile.call(article.organization.profile_image_url, length: 150) %>' alt='<%= "#{article.organization.name} image" %>'> | ||
<div class='ltag__link__user__pic'> | ||
<img src='<%= Images::Profile.call(article.user.profile_image_url, length: 150) %>' alt='<%= "#{article.user.username} image" %>'> | ||
</div> | ||
</div> | ||
</div> | ||
</a> | ||
</a> | ||
<a href='<%= article.path %>' class='ltag__link__link'> | ||
<div class='ltag__link__content'> | ||
<h2><%= title %></h2> | ||
<h3><%= article.user.name %> for <%= article.organization.name %> ・ <%= article.readable_publish_date %> ・ <%= article.reading_time < 2 ? 1 : article.reading_time %> min read</h3> | ||
<div class='ltag__link__taglist'> | ||
<% article.tag_list.each do |t| %> | ||
<span class='ltag__link__tag'>#<%= t %></span> | ||
<% end %> | ||
</div> | ||
</div> | ||
</a> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it make sense to put something like this above and share more of the markup between the if
and else
blocks?
<% owner = article.organization || article.user %>
[same as existing markup but change `article.user` -> `owner`]
And then we could scope the if
block down to just the part where it shows the org+user vs user avatars. Maybe it's that I don't do enough front-end work anymore, but I'm not super great at seeing what's different between two 20-line chunks of HTML. 🙂
Note: I tried to add a suggested-change block here to make the change a 2-click operation for you but apparently GitHub doesn't support that when lines have been deleted in the existing diff. 😕
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, I'll give this another go and see what I can do. I was fading when I got this in last night so I can probably refactor a bit in here.
Oh hi there @jgaskins! Yes, so lovely to see another gooder! 😁 BTW, when I tried to run the RSpec tests last night before submitting, I saw that the test db hadn't been created in the initial setup. Is there a different command I need to run for that? Thank you for the helpful feedback! I will try to make time this weekend to submit an update. |
Hmm, did you use our |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested this locally and it's working great!
I made sure there's no regression for links in posts published before the changes, as well as for newly added ones, and all looks good to me 👍
I just have a couple of very minor change requests to enhance the experience for screen reader users. Let me know if you have any questions, and thanks very much for these changes!
Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
@aitchiss I appreciate the work you put into the testing portion of this! I agree that alt tag content sounds much better. I've accepted both of your suggested changes. @citizen428 I did run
|
@meg-gutshall - this is looking great - thanks for making those tweaks! I noticed there are some specs failing
Thanks again - once the specs are passing I think this is good to go 🚀 |
Hi @meg-gutshall thanks for all your work on this PR so far, it's much appreciated! 🥇 Is there anything we can do to help you push this over the finish line? |
Hi @aitchiss and @citizen428! Thank you for your help and patience. I'm finishing up a coding bootcamp with a deadline of 6/30 (and just starting my final project today 😬 ) so I need to prioritize that. I can finish up this PR in early July if that's okay with you. If it can't wait, I'm okay with co-authoring this PR. I feel like @aitchiss should get co-author recognition if she hasn't already for her suggested changes. Please let me know how you would like to proceed! |
I'm fine either way, I'll leave it up to @aitchiss 😃 |
That's exciting about your final project @meg-gutshall! We're not in any rush, but I think there's only a teeny change to the specs needed, so I'm happy to have a look at that and then hopefully we can get this merged 😄 You've already done 99.9% - happy to help push it over the line! |
…ag-company-avatars-11880
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I pushed up that small change to fix the specs, and all seems to be passing now 🎉
Nice work on this one! ✨
Woohoo! Thanks for the contribution Meg🎉 And thanks team for all the help 🙏 |
Nice to see this completed @meg-gutshall! I'm going to link the stream to this PR for folks to see it come full circle. Thanks again for your contribution to the Forem codebase! 😎 |
What type of PR is this? (check all applicable)
Description
This was part of the Live Code Pairing series with @nickytonline and @cmgorton. For this stream we worked on fixing the way avatars appear in liquid tag links when a post is written by a user, but under an organization account. The avatar was not rendering as displayed on the front page, it was only showing the user's avatar.
Related Tickets & Documents
Fixes #11880
QA Instructions, Screenshots, Recordings
This is what we were looking for on the Liquid tags:
This is the issue that we were seeing:
Here is the fix:
Here's an alternate with the author pointing solely to the organization:
UI accessibility concerns?
The images still retain
alt
tags and they're both wrapped in the hyperlink that will redirect to the article's author.Added tests?
[Forem core team only] How will this change be communicated?
Will this PR introduce a change that impacts Forem members or creators, the
development process, or any of our internal teams? If so, please note how you
will share this change with the people who need to know about it.
Admin Guide, or
Storybook (for Crayons components)
or in a forem.dev post
replace this line with details on why this change doesn't need to be
shared
[optional] Are there any post deployment tasks we need to perform?
[optional] What gif best describes this PR or how it makes you feel?