DEV Community

Cover image for Working on the second contribution to Dev.to part 1
Rembrandt Reyes (He/Him)
Rembrandt Reyes (He/Him)

Posted on

Working on the second contribution to Dev.to part 1

Ok so I made my first contribution to Dev.to and now I am excited to work on my second one! Decided that I would go for one with medium difficulty, and me being me, I want to clear out older issues. Looked through some of the older issues and landed on this one

Tag/Mention Users in Post #152

TASK or Feature

Request or User Story

I write an article about knowledge I exchange with someone that was inspiring. I want to be able to tag/mentions the user to create more engagement and be nice to the person that I learned from. I can type their username and they will be notified when the article is public, people will be able to link to their profile from my posts and see their posts

Definition of Done

Maybe implementing something like @(username)? It tags the person with a link to their profile.

Asked and made sure that the issue is still relevant and got the thumbs-up. I got assigned and I am on my way to figuring a solution out for this issue.

The Acceptance Criteria:

  • Be able to @username in a post
  • Tagging the person in a post will send them a notification.
  • The @username will link to the user's profile page.
  • If user @themselves do not send a notification to post owner

Full disclosure: I am no Ruby expert, and the time I have spent within Ruby code is very minimal. So most of my time today was spent googling, playing around with different code components, and running RSpec tests. You can find a lot of useful information in tests :).

Before I got started I checked to see if the ability to @username is possible, and what do you know @rembrandtreyes seems to work in a post, and it doesn't send me a notification. So job done right? Ehh, sorta. I still have to check other factors.

I have to see if @username someone else will send a notification. I am not quite sure how I can do that. I was going to create a dummy account on Github to create a test account on Dev.to, but before I get to that I figured I would jump into the code and see what is currently there for notifications.

I found app/services/notifications/new_mention/send.rb and looks like we are only sending notifications for comments.

Also found spec/services/notifications/new_mention/send_spec.rb helpful since it confirms that they are only testing comment @username mentions

Found this create_all.rb file which has a create_mention_for(user) method.

Cool! So I think I am on the right track and, to be honest between work work and working on Dev my brain is kinda fried. There is only so much info my mind can retain. So I think I will leave these files open to test and get back to this another day. So stay tuned! I will be updating you all soon.

Happy Open Sourcing :D

Top comments (0)