Hacktoberfest: Part 2

Sean Prashad
Open Source @ Seneca

--

Familiar faces

The abundance of leaves on the ground signals that we are venturing further into October, and coincidentally, another week of Hacktoberfest. The community so far has nearly 50k participating repositories and over 150k pull requests opened:

My stats are available at hacktoberfest.digitalocean.com/stats/SeanPrashad!

Glancing at that graph makes me realize that I’m a speck somewhere in it all. It truly is amazing to think that I am part of something much bigger — that I as a student, have made an impact, no matter how small. And so armed with that confidence, I knew that it was time to dive once more into the sea known as GitHub.

Familiar Faces

Many of my contributions in the OSS realm have been for Mozilla — owners of Firefox, Rust, Pocket and 1,879+ other projects. In particular, I’ve thoroughly enjoyed giving a hand to the AMO community. The amount of patience and commitment displayed time and time again has been the key to my success:

Mathieu Pillard — AMO Developer
Andreas Wagner — AMO Developer
Kumar McMillan — AMO Developer
Stuart Colville — AMO Manager
Matthew Riley MacPherson — Former AMO Developer
Ioana — QA Team Lead
William Durand — AMO Developer

The list of individuals doesn’t just end there — there are many others like Alexandra, Caitlin, Rebecca, and Bob who are all helping behind the scenes. And so, this time around I wanted to return to familiar faces and help out where I could — next stop, AMO 🦊

Choosing a Feature

The contrib:welcome label helps to identify issues that don’t interfere with AMO’s release cycle and are beginner friendly. There was one in particular that was interesting to me — users could currently “flag” their own review:

Attempting to flag my own review 🤪

Essentially, this means that I can post a 5/5 review with a nice comment and then flag it for being inappropriate.

While the current behaviour pops up a tooltip saying “You cannot flag your own review”, it would make more sense to completely hide that button altogether, right?

Being 110% against self-induced harm, I sought out a solution to hide the flag button for reviews written by the same user:

Hiding the “flag” button for reviews made by the current user 👍🏽

Submitting a Fix

The fix was quite simple and involved only a single line of code:

flaggable && review

became

flaggable && review && siteuser && siteUser.id !== review.userId

All we needed to do was check if the review belonged to the current user, and if so, simply hide the flag button:

Ironically, the hard part was fixing up adjacent tests that broke after introducing this new behaviour. One key thing was to look at other tests that had been written. By doing so, I found breadcrumbs from similar tests that allowed me to copy-pasta and modify them accordingly.

Fast-forward many hours later and my PR is now armed with a green checkmark from Travis and ready for a review:

Final Thoughts

I’ve come to learn that growth doesn’t just happen in new scenarios, but old ones as well. Interacting with new projects put my previously gained skills to the test (as well as my comfort zone). Revisiting past projects allows me to practice what else I’ve learned whilst I was gone. I consider it healthy to venture out and experience new things but to also reconnect with those who took you in when you first started.

Cheers,

Sean 👨🏽‍💻

--

--