Skip to content

Instantly share code, notes, and snippets.

@pragatiagrawal31
Created August 20, 2019 11:23
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 pragatiagrawal31/6e72eb8e37b3c18c5b5e0c9d1d5a0f67 to your computer and use it in GitHub Desktop.
Save pragatiagrawal31/6e72eb8e37b3c18c5b5e0c9d1d5a0f67 to your computer and use it in GitHub Desktop.
Final Report - Google Summer of Code - 2019 with Zulip

Final Report, Google Summer of Code 2019 with Zulip

Links to commits

settings_display: Refactor settings_display.

This commit refactors settings_display in order to make code more precise and clear.

settings: Add option for fixed/fluid width.

This adds a new option for "fluid width" under Display settings section of SETTINGS/DISPLAY SETTINGS tab.

Fixes: #11844.

org settings: Add sort_obj_by_key function to sort objects.

Actually, this is a preliminary commit which adds a general sort_obj_by_key function to sort objects according to keys.

In this commit, we have refactored populate_auth_methods function by extracting the logic for the desired sort_obj_by_key and used that to sort auth_methods, but the main motive of this function is to sort realm_authentication_methods in check_property_changed to sort current_val in the upcoming commit.

org settings: Add save/discard widget for realm authentication methods.

Along with this, we refactored settings_org.populate_auth_methods to use HTML function after rendering all auth methods rows rather than appending each row individually, which actually is a good practice.

Also in this commit, to compare current_val and changed_val in check_property_changed function of the property realm_authentication_methods, which are objects, and we found here https://stackoverflow.com/a/1144249 that there is no easy way to do so. So I followed this approach,

JSON.stringify(obj1) === JSON.stringify(obj2);

but before converting them to string we want the same order of keys, so we used sort_object_by_key to sort current_val by keys and get_auth_method_table_data always return changed_val having keys sorted.

Since these refactor were closely related we kept them as a single commit here.

Fixes: #11954.

popovers: Hide email under hidden email-address-visibility cases.

In email hidden case (that is when email_address_visibilty is set to everyone), for "non admins", this commit hides emails from:

typeahead helper: Hide email under hidden email-address-visibility cases.

In email hidden case (that is when email_address_visibilty is set to everyone), for "non admins", this commit hides emails from:

search suggestion: Hide email under hidden email-address-visibility cases.

This commit hides the email address from the search bar for the email hidden cases.

css: Remove redundant #organization from zulip.scss.

This has been dead code since 1143ed721960042b01d1024dc453bbab0ccddb99.

css: Remove redundant #settings from zulip.scss.

Since settings element no longer exists, hence removing it from zulip.scss.

stream settings: Disable Mobile notifications if push bouncer not set up.

This commit disables "Mobile notifications" if push_notifications are not enabled. It also adds a tooltip explaining why this is disabled.

Fixes #12208

css: Remove redundant #organization from settings.scss.

This commit removes the redundant #organization from settings.scss as organization id no longer exists.

css: Remove redundant #settings from settings.scss.

This commit removes settings element from setiings.scss since now no such element exists.

css: Use SCSS nesting in settings.scss for .new-style.

settings: Fix sort order display settings.

This fixes the mis-alphabetized fluid_layout_width at few places in the codebase, along with that it also fixes sorting order of property_types dictionary in models.py and few model fields of UserProfile model class.

org_settings: Move get_subsection_property_elements from build_page.

This moves get_subsection_property_elements out from the local context of settings_org.build_page function, as it was unnecessarily initialized at the time of page setup.

org_settings: Refactor populate_data_for_request.

This is a preliminary commit which refactors populate_data_for_request function, now this function traverse on all "property elements" of a given subsection, but get the data only of those properties which have setting-widget-type data attribute. Therefore, it doesn't change the functionality of this function and overall changes don't make any difference. In upcoming commits, we're going to use input_elem as an argument to check_property_changed function, so that only those elements whose values are changed are sent to the backend.

org_settings: Move populate_data_for_request down.

This is preliminary commit which moves populate_data_for_request function down after the definition of all functions with which it will interact in the future.

org_settings: Optimize data collected by populate_data_for_request.

With the help of check_property_changed function now we collect the data whose values are changed from the current one. Currently this optimizes only for those elements whose values are collected by populate_data_for_request function i.e. it doesn't optimize data collected by get_complete_data_for_subsection.

settings_org: Enhance show_emails for admins only case too.

This adds on the is_admin clause to show_emails.

users: Apply email_address_visibility policy on the users list.

In the emails-hidden case, for non-admins, we should remove the email field from "Users" list in the organization settings page.

Tweaked by tabbott to correctly handle the bots and deactivated users pages.

settings_panel_menu: Fix the switching behavior for hidden section panels.

For organization settings page there are few sections' panels which are not visible (unless you click on 'show more') but when we use up-down arrows to navigate between sections, sections of hidden panels also get visible which leads to confusion.

Fixes: #13008.

settings_users: Remove if condition for showing current user time stamp.

It seems presence.presence_info[item.user_id] works fine for the current user as well and there is no need to hardcode extra condition for the current user.

settings_users: Add last_active to active_users for "users" table.

This is a preliminary step for refactoring the logic for rendering "last_active" in the users table and later we can use this for sorting the column.

settings_users: Refactor logic for "last active" column in users table.

This uses "last_active" attribute of user (item) object and makes code much more readable.

settings_users: Refactor and extract function for last active.

This just done to improves code readability and removes some code too.

settings/scss: Make #user-groups .user-group rules at same place.

settings/scss: Nest .user-group inside #user-groups.

settings/scss: Nest many rules inside #user-groups.

settings/scss: Reorder to have .settings-section-title at same place.

settings/scss: Remove now redundant settings-wrapper class.

No class like this is rendered to page.

settings/scss: Reorder .settings-section to have them in same place.

settings/styles: Reorder styles in more sensible order.

Rather just putting rules in any order it makes more sense to have an order of basic to more advanced/specific CSS.

settings/styles: Remove redundant specificity.

settings/styles: Nest all .settings-section rules.

settings/styles: Remove redundant rules for .table-striped thead th.

This rule is already specified at .settings-section .table-striped thead th.

settings/styles: Use .settings-section for settings .table-striped.

We have used .settings-section .table-striped for other rules to refer the same elements which are referred by #settings_page .table-striped.

settings/styles: Reorder .settings-section .table-striped to same place.

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