Skip to content

Instantly share code, notes, and snippets.

@srdeotarse
Last active September 12, 2022 16:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save srdeotarse/f612d9a86fd3277d3012130a6e5e76be to your computer and use it in GitHub Desktop.
Save srdeotarse/f612d9a86fd3277d3012130a6e5e76be to your computer and use it in GitHub Desktop.
Work Product of Shivam Deotarse for GSoC 2022 contributing to the project Zulip Terminal under Zulip organization.

Work Product: Google Summer of Code 2022 with Zulip

🗃️ Project Description

Title

Enhancing user experience of Zulip Terminal

Abstract

Zulip Terminal is all about manifesting Zulip web app in a terminal. Zulip terminal has undergone extensive development to establish its place as the official terminal application of Zulip. However, many features and functionalities of Zulip web app that are not supported by Zulip terminal yet due to the complexity of terminal application in terms of limited graphics and interaction. But, the current version of Zulip Terminal is rich feature wise and caters to users with many Zulip web app functionalities. My objective for this summer was to work with the same mindset of enhancing the user experience of Zulip terminal.

Mentors

Thank you to my wonderful mentors and ecstatic Zulip community for guiding me extensively throughout the GSoC period on writing maintainable code and corresponding tests, implementing practical UI for different elements and familiarizing with huge Zulip codebase.

Repository

zulip/zulip-terminal

📊 Overview

Before summer, I have worked on some good first issues, including -

And some priority issues, including -

During the summer, I have worked on several high-priority issues, including -

🎓 Challenges and Learnings

  • Zulip has provided a jumpstart to my sofware development journey. The alacrity of Zulip community is wonderful for new contributors and I feel very lucky as I got a chance to be a part of the Zulip community.
  • I have learned more about Git and Github by practically using it to manage and update codebase of the Zulip Terminal via rebase-based workflow. I can now easily find my way through editing different commits by interactive rebasing and resolving merge conflicts using git diff and git rebase -i based on code reviews received for improving the pull request.
  • I learned about industry based software development especially using Python as my primary language (thanks to Zulip Terminal). I understood more about the repository structure of Zulip Terminal and advantages of following the Model View Controller(MVC) architecture.
  • Challenges I faced while working on the Zulip Terminal was mainly about tests. I was a complete newbie to testing and exploring the codebase helped me realize that majority of the functions have specific test considering exhaustive set of the test cases to ensure expected functioning of the Zulip Terminal as a software.
  • In early days of my coding period I was clueless about pytest, a python based testing framework. Then, as I started working on different PRs, I truly understood need of different test cases, advantages of mocking a function return value and covering each and every line of the function.
  • I also faced a challenge of concisely expressing what I have accomplished in a particular commit in the commit text. One thing that helped a lot during structuring my code changes into different commits is that if you aren't able to accommodate the description of code changes in the commit text, that means the commit has to be splitted into more minimal changes.
  • Also, observing git diff after structuring the commits to check whether code changes in separate commits are not interdependant i.e. changes in one commit should have limited effect on any other commit.

🛠️ Work Product

Summary

Pull Requests merged during Coding Period

This PR changes order of the stream names displayed in footer when autocomplete_streams is triggered from the compose_box to the following order -

  1. current stream (if matching the current narrow)
  2. pinned and unmuted
  3. unpinned and unmuted
  4. muted (pinned and unpinned)
  5. other streams

This change is inspired by Zulip web app Issue #20618

Commits -
  • f2a0669 - boxes: Deprioritize muted streams in stream typeahead in compose box.
  • cf98899 - boxes: Prioritize current stream in stream typeahead in compose box.
  • 812a473 - refactor: test_boxes: Use stream name instead of id in muted test cases.
  • d8e5538 - refactor: test_boxes: Assert all output strings match required_typeaheads.

This PR improves the existing generate_hotkeys.py script by incorporating functional approach to different parts of the script. Additionally, the PR also improves generation of docs/hotkeys.md output file by extracting information from config/keys.py file only once. Hotkeys linting is also added to ensure that the key description style follows a particular style and also existence of any shortcut key duplication as well. This linting support is also added to tools/lint-all and Github Actions as well. Everytime a PR is updated, Github Actions will verify hotkeys by running generate_hotkeys.py file.

Commits -
  • 63058a0 - refactor: generate_hotkeys: Change categories type to defaultdict(list).
  • 311085e - refactor: generate_hotkeys: Split string construction & file writing.
  • 8f7af71 - refactor: generate_hotkeys: Restructure script into separate functions
  • 5cffe0e - refactor: generate_hotkeys: Reorder functions according to occurrence.
  • 314e4d9 - generate_hotkeys: Add output_file_matches_string function.
  • a1d54bb - refactor: generate_hokeys: Use OUTPUT_FILE and KEYS_FILE in docstrings.
  • a34dbb9 - generate_hotkeys: Add function for linting description style.
  • ce7fcd9 - generate_hotkeys: Add hotkeys linting --check-only.
  • 9ce8233 - generate_hotkeys: Add hotkeys linting for key duplication.
  • c63bfc5 - lint-all: Add generate_hotkeys script to lint-all.
  • 9431411 - lint-and-test: Add generate_hotkeys linting to GitHub Actions.

Partially merged Pull Requests opened during Coding Period

This PR adds support for (un)resolving topics via a TopicsViewMenu which shows a button to Resolve/Unresolve Topic. Resolving a topic adds a prefix to the topic_name and unresolving a topic removes the prefix. Also a success message that a topic is (un)resolved is displayed.

Unmerged Pull Requests opened during Coding Period

This WIP PR migrates earlier struture of RightColumnView in views.py to structure similar to LeftColumnView with toggling between StreamsView and TopicsView. This PR mainly intends to add new RecipientsView that displays recipients of the current narrow(All_messages, PMs, Streams, Topics etc) in the right column.

Merged Pull Requests made during Application Period

The Zulip Terminal is based on urwid library to display the application in a terminal. Urwid uses different color depths(1,8,16, 256 and 24bit) to show colors of the Zulip Terminal. This PR verifies the color names used for 16 bit color depth and show proper error if valid color names abiding the rules of urwid library aren't used.

Commits -
  • 1ef48cb - refactor: test_themes/themes: Migrate valid_16_color_codes into source.
  • ca5bfba - run/themes: When running with 16 colors, ensure color codes are valid.
  • 5ab15bd - themes: Simplify error output for bad 16 color codes in themes.

Earlier a general message You have moved some messages. was displayed on moving messages from one topic to another. This PR provides more information in the display message by providing following in information-

  • Old topic of the moved message
  • New topic of moved message
  • No. of messages moved based on propagate_mode (one/some/all) messages
Commits -
  • c475d18 - core: Add duration argument to report_* with default value of 3
  • ca56528 - model: Improve reporting upon moving/splitting topic within stream.
  • 7196234 - tests: model: Add change_later test case for test_update_stream_message.

This PR highlights the # stream > old topic and # stream > new topic part in the success message displayed after moving messsages from one topic to another. This PR also changes argument type of report_* functions in core.py and add duration argument as well to display footer text for specified duration or default 3s.

Commits -
  • be4fdec - refactor: core: Change report_success argument type to list.
  • bf429d1 - refactor: core: Change report_warning argument type to list.
  • 81080b8 - refactor: core: Change report_error argument type to list.
  • dc5ba6b - model: Highlight stream & topic in reporting of moving/spliting topics

After sending a message outside current narrow (For eg. I am currently in #stream > topic_1 and I send message to #stream > topic_2, therefore current narrow is #stream > topic_1) a footer message is displayed indicating the user that shortcut combination ctrl + . can be used to switch to current compose box recipient (in this case ``#stream > topic_2).

Commits -
  • 1ad6e3a - helper/boxes/keys/hotkeys: Narrow to current compose box recipient.

This PR displays maximum of 3 user_names reacting to a message using reaction_emojis or display the user_count for each reaction_emoji as displayed earlier. This feature addtion was implemented based on recent addition of same feature to the Zulip web app.

Commits -
  • 1280c5e - refactor: test_ui_tools: Move reactions_view outputs into parameters.
  • 7722add - boxes: Add web app styling to reactions (max 3 names, else user count).

Open Pull Requests made during Application Period

This PR is a follow-up of [PR #1194] and extends the cases for which message Message sent outside current current narrow. Use shortcut ctrl + . to switch to current compose recipient is shown even when the current narrow is all_messages and all_PMs

✅ Post GSoC

I plan to continue my contributions to the Zulip Terminal as well as other Zulip projects by firstly focusing on my open pull requests and then on resolving some more high priority issues. Throughout the pre GSoC and coding period, I have explored a few sections of vast Zulip and Zulip Terminal code. Therefore, with my future contributions, I will learn in depth about different modules of the codebase.

I would really like to help new contributors to understand more about the codebase of Zulip and Zulip Terminal and guide them to contribute to such an amazing community.

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