Continuing the GSoC Adventure with Zulip: New Challenges and Achievements

I’m happy to get the opportunity to work with Zulip as a GSoC contributor again. The folks here are awesome, and the work is very interesting and challenging. This, along with the fact that I had some unfinished projects I wanted to complete, is why I chose this organization again for GSoC.
After having explored many parts of the codebase in last year’s GSoC, I was able to work on more complex projects this time. This year, a major portion of my work is improving Zulip’s frontend node tests. Working with tests requires an intimate knowledge of the modules being tested, and this involves going through past discussions and recent pull requests around that module. I had to go through a large number of functions, understand their logic, and correlate it with the mocks and overrides in the tests in order to further improve them. Along with this, I also worked on many new features, and some improvements in areas like compose box and message list where I already had some expertise.
Here is a description of my work this year. Not all the PRs are merged, but almost all are in a position to get merged soon.
Node tests
The issue Clean up unnecessary use of rewires for node tests explains the downsides of rewiring modules for testing. It proposes we should use organic type-correct data in the tests, and refactor tests or interfaces so that we can test the actual logic without so much mocking of UI code. I’ve opened a series of PRs for this:
I had to touch a large number of tests and gather context around them. I also discovered some flaws in some of the tests and fixed them along the way. This was a very educational issue to work on. It focuses on the philosophy of testing and decisions taken to make such a huge codebase maintainable through tests. Even after all the above PRs, there is still a lot to be done.
Around the compose box
I opened
compose_paste: Don't paste formatted text at md link marker
which is a UX improvement in pasting formatted text after markdown link syntax ([]()
). When pasting a link after the link marker syntax, we want to avoid inserting markdown syntax text and instead just paste the raw text, possibly replacing any text selection.I opened
compose_reply: Empty DM recipient box on forwarding message
which fixes an unexpected change that snuck in a while ago, where on choosing to forward a message, the compose box wrongly retained the participants of the current conversation. No one seemed to recall when this behaviour was introduced, so I had some fun doing a little investigation into the commit history. GitLens helped me a lot with this.Another UX improvement is around pasting large blocks of text in the compose box. I opened compose_paste: Convert large pasted text into uploaded text file where when pasting large amount of text into the compose box (or the message edit box), we show a banner giving an option to put the text into a file and upload it. The banner is only shown if the text is larger than a threshold, and would cause the total message size to exceed the max message length. This was appreciated by many users. There was a minor regression which I fixed in #35476.
After a while it was found that if the text is extremely large, it takes time to perform the paste operation in the text area, so we should rather show a banner and defer the actual pasting until after the user makes a choice to paste. This PR isn’t merged at the time of writing this article.
Around the message list
Message list is one of the areas where we expect everything to work perfectly without any bug since Zulip after all, is a messaging platform.
As a part of Zulip 11, we introduced an option which allows the user to remind themselves about a message at a later point in time. I contributed to one aspect of the feature in the PR message_reminders: Add support for notes, where in the reminder, the user would also be able to see a note helping them jog their memory on why they wanted to be reminded of this message. It was a neat feature, and I collaborated with a core maintainer of Zulip on this. I wrote some tests ensuring the feature doesn’t behave unexpectedly.
I fixed a hard to find bug in viewing message history in message_edit_history: Return early if overlay is closed which was pointed out to me by my buddy-contributor Maneesh during a PR review.
Currently, if a user stars a message but is not connected to the internet, the UI shows the message as starred but since the request to star failed, the message would vanish from the starred messages section on next reload. I opened message_flag_updates: Fix handling of post failures for flag updates for this, where if a request to add/remove a flag to a message fails, we keep track of it and retry it when the network connection is back. Instead of naïvely storing a sequence of failed requests, I keep track of the of effective operations only. For example, if a message is starred and then unstarred, then effectively nothing ever happened to the message and we can save the API calls to add/remove that flag. This makes the whole thing optimized.
Arguably the toughest thing I worked on is message_edit: Show message edit button while saving changes. This is still incomplete, and I hope to finish it in the coming days. There are many corner cases and non-deterministic bugs. I’ve fixed most of them.
Fix glitch when hovering a message as its editing window expires: This bug was hard to notice but common enough to be a priority as we try very hard to have 0 known bugs in the message feed experience.
Previous unfinished projects
There were some PRs which I opened last year but they couldn’t get enough attention to attain completion. I really wanted to see some of these PRs get merged, so I put in some effort in them.
channel: Add option to notify users newly added to a channel: This PR reduces load on the backend when many new users are added to a channel. I had to fix some nasty conflicts since the surrounding code went through significant changes since last year. It felt good to see it merged.
Add support for a per-stream version of the "Default code block programming language": This PR is undergoing some final rounds of review, where we’re mainly adding tests to ensure nothing breaks in the future. It has taught me a lot about Zulip’s event system. I had to resolve a lot of merge conflicts from time to time, as the code around this PR has been a hotspot for changes.
compose: Make it possible to split messages on delimiter: This was my first PR in Zulip, and one of the most significant PRs in helping me understand the codebase and collaboration. In addition to being a very cool feature, it is also interesting to implement. This was a low-priority feature and therefore hasn’t gotten much attention.
activity: Use IdleDetector API when available: I took the issue up last year, but only opened the PR this March. I spent the coding period improving upon it. It is now a mature PR which has gone through reviews by various people, but being a low priority issue (as it is roughly only for Chromium based browsers), it hasn’t been merged yet.
Miscellaneous
Use with and near operators in email topic links: The message links in Zulip’s emails about messages would break if the topic was edited or the message was moved. This PR makes those links immune to those changes by using
with
andnear
operators in the message links. #issues > ✔ 🎯 Links in mails are notwith
links @ 💬 has the full context.internal_url: Exclude stream name from encoded slug if it is too long: #user questions > requests summary by a starting TTRPG community @ 💬 has the context for the PR. I worked on a heuristic which helped estimate if a channel name should be dropped for making the URL ugly. The bulk of a message link comprises the topic name, but we can’t drop that now, since we don’t have topic ids yet.
left_sidebar_navigation_area: Reduce the use of ??: This was a minor improvement to the code quality.
ui_init: Fix bug in argument type: This is a small but very impactful change. A recently merged buggy commit caused errors in the dev environment to see an error each time they switched the topic, much to the annoyance of everyone. It was due to a typing bug, since the module it occured in hasn’t yet migrated to TypeScript. This PR highlights the importance of TypeScript.
Improvements to the logic to avoid sending notification bot DMs on channel sub: This PR highlights how meticulous Zulip is in maintaining its test suite and documentation and ensuring everything is actually correct.
Port topic_link_util.ts to python: I ported the module to the backend since various areas there could benefit from the abstraction this module provided. I had authored the frontend module last year and it was one of the highlights of my previous GSoC.
Improve topic_link_util module: This PR added more features to the
topic_link_util
module in both the frontend and the backend. I introduced support for message links in the backend module, and also supported the recent “empty topics” in both versions of the module.
Apart from these, I also reported various bugs and assisted in fixing some of them. A few of them are:
#issues > ✔ navigating between topics in same channel throws error @ 💬
#issues > ✔ 🎯 DM recipients preserved when forwarding message @ 💬.
My experience this year has been incredibly fulfilling, and I am deeply grateful to both Zulip and GSoC for this opportunity. Despite having other commitments, I learned to manage my time effectively and became more productive. Although I can no longer participate in GSoC as a contributor, I am committed to staying involved with Zulip and continuing to contribute, albeit at a reduced frequency. Open Source is a journey that extends beyond GSoC, and this program has equipped me with the skills and confidence to engage with other projects that could benefit from my contributions. I am eager to give back to the community and hope to apply as a mentor next year, if time permits. This would be a wonderful way to express my gratitude and support future contributors in their open source journeys.
Subscribe to my newsletter
Read articles from Kislay directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by

Kislay
Kislay
I am an Electrical Engineering undergraduate at IIT(BHU) Varanasi, with a keen interest in software development. I am also a (human) language nerd.