Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
This is the final work product of Zeeshan Equbal for Google Summer of Code'21 with Zulip

Work Product: Google Summer of Code 2021 with Zulip

Project Description

Title

Improving Zulip’s terminal interface.

Abstract

Zulip-terminal is the official terminal client for Zulip which has been actively developing for the past few years and has already reached a certain level where it’s no longer considered a temporary client. It still has a long way to go to match the level of web-app, in terms of feature enhancements. So, my primary objective this summer would be to provide more feature support to Zulip-terminal and improve upon the existing ones by fixing bugs and potentially adding and improving upon the test suite.

Mentors

Repository

zulip/zulip-terminal

Overview

Over the summer, I worked on several high-priority issues, including Migrating to the new quoting style #514 which was implemented via #854, improvements and additions to the Stream Info popup such as Stream members section, extra fields related to stream settings and a configurable Visual notification checkbox all via [#856, #878, #880, #900, and #1080]. A lot of bugfixes were merged that fixed Wildcard mentions not shown in the mentions narrow #1038, Buggy Quote rendering logic #942, and WSL detection bug #1059 among others. Several feature enhancements were also pushed that added Support for opening messages in browser #991, Support for renaming topic of messages with (no topic) #946, but the most important feature that I worked on was Adding support for reacting to messages #913, which also needed a preparatory PR to Migrate our emoji storage to couple original+aliases together #1084, and was based on the work of Kaustubh Nair from the previous GSoC.

In these past few months, I have learned a lot; from writing maintainable code and proper unit-tests to the need of extensive code-reviews and putting up comprehensible pull requests - all thanks to my mentors, Neil and Preet. :)

Work Product

Summary

Merged Pull Requests

Display mouse selection hint for the entire View #1085

This was a bugfix PR which fixed two bugs related to displaying selection hints in the footer, by migrating related mouse_event from MessageBox to View so that the hint is displayed when the user performs mouse_drag event anywhere inside the terminal window. It also fixed the case when the hint got stuck in the footer if the mouse was dragged from the MessageView and released outside of it.

Platform handling improvements and WSL bugfix #1059

This PR improved our platform handling by defining an isolated module config/platform_detection.py that holds the platform detection logic and uses a single variable PLATFORM to specify the name of the platform that the current ZT instance is loaded on. This also fixed a bug in WSL (Windows) where the platform was incorrectly detected as Linux.

Set consistent mouse scroll-speed across side panels #1082

This PR defined two global variables to hold the mouse scroll-speed in MiddleColumn and SidePanels of 1 and 5 respectively. Then, refactored the logic for scrolling the side-panels to consistently follow this defined value.

Fix bad rendering of topics in TopicView #1062

This PR fixed a bug that made incoming new topics render badly in the TopicView due to incorrect parameters being passed to TopicButton. This PR also migrated TopicButton to accept only named parameters so that there's no scope of future bug and connascence between parts of the program is reduced.

Remove deprecated recipient_id and (sender_)short_name #1053

This PR removed the deprecated recipient_id field from the entire codebase and added a comment in api_types that the server recommends clients to use the display_recipients field instead. The short_name and sender_short_name fields were also completely removed from the codebase as a result of its removal in server version 3.1; ZFL 26+.

Fix wildcard_mentions absent in mentions narrow #1038

The server defines several wildcard_mentions like @all/@everyone/@stream, which are not marked with 'mentions' in the message flags, rather 'wildcard_mentions'. This bugfix adds checks for this flag in the message response from the server and appropriately categorizes these messages as mentioned and also updates the count in the respective narrows.

Restrict content-length for compose box #996

This PR restricted input beyond certain max-limit for compose box, as specified in initial_data's realm object. ZT didn't had this restriction which resulted in certain long topic/messages getting cropped without the user noticing, until the message was sent. Restrciting content length of ReadlineEdit widget was also added via readline/#18.

Adding support for opening messages in the browser #991

This PR extracted some initial commits from #397 and #698 and cleaned and refactored them. Also added support for opening external links in the browser from the MessageLinkButton via the MessageInfo popup.

Support renaming topic of messages with (no topic) #946

This PR added support for renaming messages that had no topic, by anyone as long as the realm_allow_message_editing is True for the organization. This is the behavior that is followed by web app for message editing events, and brought ZT's message-editing capabilities one more step closer to it.

Add support for reacting to messages #913

This critical feature enhancement PR added support for reacting to messages with emojis. This PR implemented an EmojiPicker popup which lists all the supported emojis, sorts it by count and allows searching for any emoji via p hotkey inside the popup. This was partially based on the work of Kaustubh Nair's #707. Before working on the UI related aspects of this feature, a preparatory PR was needed to:

StreamInfo popup related improvements

This feature had a set of PRs that collectively addressed improvements to the StreamInfo popup. The PRs were responsible for adding Stream members section inside the popup, along with a lot of new fields and setting added after discussing server support and backporting for older versions. The set of PRs included:

Migrate to the new quoting style as used in web app #854

This PR changed the message quoting format in ZT to include the name of the user whose message was quoted (and his user_id) along with a link that would narrow to the quoted message. For interoperability, the link to the quoted message is the same as that of the web app, so narrowing to the quote is also possible via #708.

Notify user if message is sent outside of current narrow #824

This PR sets a footer text notifying the user everytime he sends or edits a message that is outside the current narrow. This will give the user a pointer as to why the message disappeared from the screen.

Minor bugfixes and UI/test improvements

Open Pull Requests

Handle edit-message event triggering change in mention flags and unreads #1068

This PR handles change in mentioned and wildcard_mentioned flags and its related consequence (i.e. unread count) on message-edit events. This is also the first step in implementing events related to alert_words.

Add support for handling delete_message events #1048

This PR adds a new event action in model that looks for delete_message events, potentially handling it by removing the message completely from the index, and then updating the rendered_view to handle the event dynamically without needing to switch narrows.

Updating Stream setting checkboxes from subscription events #981

The current approach registers a callback when the StreamInfo view is open and looks for subscription events to trigger a callback, which in turn updates the checkbox UI.

Disable cycling using arrow keys if recipient is invalid #864

This PR disables cycling from the recipient box to any other box inside the WriteBox view using arrow keys, if the recipient name is invalid. This is very similar to CYCLE_COMPOSE_FOCUS using Tab key.

Future Work

My primary future goal would be get my outstanding PRs reviewed and merged as soon as possible. The next step would be adding support for alert_words, or atleast the related events and the UI feature could be dealt later on. I will also try my best to keep in touch with the community as much as possible and help any new contributors get started with the project. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment