Commit Graph

10085 Commits

Author SHA1 Message Date
SiddharthVarshney 8636d82eba settings: Use icon to play notification sound. 2020-06-13 16:46:05 -07:00
Aman Agrawal 0327ec4c4b recent_topics: Show unread counts similar to other UI elements. 2020-06-13 16:29:19 -07:00
Aman Agrawal 9b862cd73f recent_topics: Select the filter text on lauch.
This will allow users to easily search for new topics
without losing the last filtered text.
2020-06-13 16:29:19 -07:00
Aman Agrawal 79d829bda1 Revert "recent_topics: Set 'unread' and 'participated' as default filters."
This reverts commit 0aeadd2c86.
2020-06-13 16:29:19 -07:00
Aman Agrawal a1cca4544c recent_topics: Improve variable naming of tableFixHead. 2020-06-13 16:29:19 -07:00
Aman Agrawal 347c0dc80f recent_topics: Improve code level documentation.
Improved documentation of set_filter and show_selected_filters
functions.
2020-06-13 16:29:19 -07:00
Aman Agrawal 2d6ada4360 recent_topics: Use get_topic_key everywhere.
This deduplication helps with readability.

Pass get_topic_key in recent_topic_row instead of
computing it in DOM.

Fix broken test_update_unread_count
after this change. This was a regression
which went unnoticed.
2020-06-13 16:29:19 -07:00
Aman Agrawal e769323d0c recent_topics: Refactor is_topic_hidden.
* We now only get info from other libraries when required.
* muted renamed to include_muted.
* function renamed to filters_should_hide_topic.
2020-06-13 16:29:19 -07:00
Aman Agrawal 6490f666af recent_topics: Fix boundary typo. 2020-06-13 16:29:19 -07:00
Aman Agrawal d7d5bc208c recent_topics: Rename count_senders for clarity. 2020-06-13 16:29:19 -07:00
Aman Agrawal 5931b69c57 recent_topics: Add note about reify_message_id_if_available. 2020-06-13 16:29:19 -07:00
Aman Agrawal 4aeb02f73d stream_header_colorblock: Create resuable css class.
stream-selection-header-colorblock css class can now be used
to reproduce stream header color block everywhere.
2020-06-13 15:38:40 -07:00
Steve Howell 22bf4696f5 refactor: Avoid triggers in stream_edit.
We extract stream_edit.rerender to make
the live-update code easier to follow.

The function should eventually be inlined,
but I want to clean up some other stuff first.
2020-06-13 15:35:39 -07:00
Steve Howell 186973cde2 refactor: Extract add_peer and remove_peer helpers.
These are basically shims for some deeper refactorings.

I basically just try to make the code express the
problems more clearly:

    - use stream_name instead of sub
    - make early-exit more explicit
    - make it clear that add_subscriber needlessly
      requires a name
    - make it clear we have an unnecessary loop

I also fixed some phony data in the test.
2020-06-13 15:35:39 -07:00
Steve Howell b965766f87 refactor: Call compose_fade without triggers.
We are trying to phase out the trigger-event way
of telling modules to do something.

In this case we not only remove the indirection
of the event handler, but we also get to remove
`compose_fade` from the `ui_init` startup sequence.

This also has us update `compose_fade` outside
the loop, although that's only a theoretical
improvement, since I don't think `peer_add` events
every actually include multiple streams.

To make the dispatch tests a little flatter, I
added a one-line change to zjsunit to add
`make_stub` to `global`.

To manually test:
    * have Aaron reply to Denmark (keep compose box open)
    * have Iago add Hamlet to Denmark
    * have Hamlet unsubscribe
2020-06-13 15:35:39 -07:00
Steve Howell 9d9342c2a5 dead code: Remove integration_bot_widget code.
This was work in progress from summer 2017
that never got completed.

See 534aa0b105
2020-06-13 15:35:39 -07:00
SiddharthVarshney 60010449d2 icon: Import a font-awesome 5 third party icon.
This is a prep commit for replacement of chevron
from sidebars.

This commit will add ellipsis-v icon in svg format downloaded
from font-awesome 5. This has to be done because font-awesome 4.7
(the version we are using) does not have this icon with
circular dots.

And font-awesome 5 as a whole doesn't make sense to upgrade to because
it's intentionally semi-crippled as part of their business plan.

Also include entry in THIRDYPARTY and Licence details.
2020-06-11 17:15:55 -07:00
SiddharthVarshney b82ca432bb right-sidebar: Fix the height of user presence list elements.
This will adjust the height of user presence list elements to
match with the left-sidebar list elements i.e. 23px.

Extra margin is removed to avoid increase in too much spacing
between elements.
2020-06-11 17:14:09 -07:00
SiddharthVarshney 46a98d2eec right-sidebar: Fix menu icon hover color.
This will fix the menu icon hover effect for the day mode.
2020-06-11 17:14:09 -07:00
Anders Kaseorg 365fe0b3d5 python: Sort imports with isort.
Fixes #2665.

Regenerated by tabbott with `lint --fix` after a rebase and change in
parameters.

Note from tabbott: In a few cases, this converts technical debt in the
form of unsorted imports into different technical debt in the form of
our largest files having very long, ugly import sequences at the
start.  I expect this change will increase pressure for us to split
those files, which isn't a bad thing.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-06-11 16:45:32 -07:00
YashRE42 6506447bf1 navbar: Only set searchbox text when displaying the searchbox.
Previously, the navbar failed at managing the searchbox text state in
cases where, eg, the user performs navigation by browser history.

This commit resolves the issue by ensuring that the searchbox text is
only (and always) set when the searchbox is made visible, and as such
there is no "state" to manage and we will always display the correct
text.

It also adds a test in `search_legacy.js` to make sure that the search
text is placed as intended.

Fixes: #14771.
2020-06-11 15:49:12 -07:00
YashRE42 939f040674 navbar: Extract `reset_searchbox_text` in tab_bar.
The navbar currently fails at managing the searchbox text state in
cases where, eg, the user performs navigation by browser history.
This is a prep commit that will help resolve the bug.
2020-06-11 15:49:12 -07:00
Steve Howell 5c6fb8dbbf code cleanup: Avoid shadowing the tab_bar global.
I tried to make the most minimal change here
possible, since I don't really know this module
well.  Possible alternatives were:

    * $('#tab_bar') everywhere
    * elem
    * tab_bar_elem

I don't feel strongly.

Long term I believe we intend to change the name
of this module to something more like `navbar.js`???
2020-06-11 11:05:06 -07:00
Steve Howell 863660281e code cleanup: Use exports for internal references.
When we call functions inside our own modules that use
the `window.foo = exports` pattern, we have always had
a pretty strong preference to call `exports.internal_function`
instead of `foo.internal_functions`.

The stragglers here weren't violating this convention
for any intentional reason.  Some of the places here
probably were part of code moves where somebody
(probably me) moved functions into the modules to avoid
unnecessary indirection, and I missed a spot where I
could change from `presence` to `exports` (or whatever).

And other places are probably just kinda arbitrary
decisions by the original developer, and we just haven't
bothered to clean it up until now.
2020-06-11 11:05:06 -07:00
jagansivam28 b40597cf3e settings_org: Combine upload_realm_logo and upload_realm_icon function.
This combines `upload_realm_logo` and `upload_realm_icon` into single
function called `upload_realm_logo_or_icon`.  The functions wer near
duplicates.

Additional refactoring should be able to deduplicate the logic further.

Part of #14730.
2020-06-10 17:05:29 -07:00
jagansivam28 1c3485647f realm logo: Refactor upload_widgets.js.
We can remove a {{theme_mode}}-settings class on the upload button
and access day/night from `.closest("realm-logo-section")`
so that only the outer ID differs between the two widgets.

Part of #14730.
2020-06-10 17:02:06 -07:00
Vinit Singh 8b2098f34d refactor: Add css nesting to #out-of-view-notification. 2020-06-10 17:00:39 -07:00
Vinit Singh dc96b8a23d drafts: Show drafts count on draft button.
This change displays the number of currently saved drafts
on the draft button like "Drafts (2)".

Patially resolves #5591.
2020-06-10 17:00:39 -07:00
Anders Kaseorg 67e7a3631d python: Convert percent formatting to Python 3.6 f-strings.
Generated by pyupgrade --py36-plus.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-06-10 15:02:09 -07:00
YashRE42 4f6377d493 navbar: Correctly recolor navbar icon when stream is renamed.
Previously, renaming the stream would cause `colorize_tab_bar` to fail
because the search filter would provide it the old stream name and the
look up for the stream color would fail.

A quirk of how this system currently works makes it so that even
though the filter is set to the old stream name (and so becomes
inconsistent with the stream_data state) the `_stream_params` object
is maintained to be consistent with stream_data and as such can be
relied upon to find the correct color of the icon.
2020-06-10 14:25:18 -07:00
YashRE42 e389129f34 subs: Call `filter.fix_stream_params` when updating stream name.
Previously the navbar did not live update the stream name correctly.

The correct behaviour was blocked on the `_stream_name` prop on the
filter object. The original purpose for maintaining this prop was
convenience, to reduce calls to `subs`, however, it would become
inconsistent with the value from `subs` on stream rename.

In this commit we add a call to `filter.fix_stream_params` in
`subs.update_stream_name`. This fixes live rerendering in the navbar,
despite the fact that searchbox in the nav (and the filter object via
`filter.operands("stream")[0]`) will still have the old name.

This is a slightly hacky way of masking some of the problems in the
Filter object. However, it should make do until we migrate to a stream
ID based state there.

Fixes: #14728.
2020-06-10 14:25:18 -07:00
YashRE42 96e272081d navbar: Add globe icon to navbar for web public streams.
Prior to this commit, the navbar didn't display web public streams as
any different from ordinary streams.

Now, we show a globe icon for web public streams. This commit also
adds a node test for the same.

We also modified the navbar behaviour table, which is the following
dropbox paper:
https://paper.dropbox.com/doc/Navbar-behavior-table--A0sp57z~7R5PeHuxHL__Gn5ZAg-cNOGtu7kSdtnKBizKXJge
2020-06-10 14:25:18 -07:00
YashRE42 bb6ce47c33 navbar: Live update icon for stream privacy changes.
Prior to this commit the icon in the navbar didn't live update to
reflect changes in stream privacy.

Here, we add a call to `tab_bar.render_title_area` in
`subs.update_stream_privacy()`, to enable live updates on the icon.

Fixes #14728.
2020-06-10 14:25:18 -07:00
YashRE42 d496304caa subs: Call `filter.fix_stream_params` when updating stream privacy.
The navbar currently does not live update the stream icon correctly
for changes in stream privacy.

One place where the correct behaviour gets blocked is on the
`_is_stream_private` prop in the filter object. We keep props such as
this for convenience, to reduce calls to `subs`, however, this prop
becomes inconsistent with the value we get from `subs` when the stream
privacy is updated.

In this commit we add a call to `filter.fix_stream_params` in
`subs.update_stream_privacy`. This change does not fix the live
rerendering in the navbar because we don't call redraw yet, but
it's a prep commit to towards that goal
2020-06-10 14:25:18 -07:00
YashRE42 35c8dcb599 filter: Extract `get_stream_params` and `fix_stream_params`.
The navbar currently does not live update the stream name or the icon
for stream privacy correctly.

One place where the correct behaviour gets blocked is on the
`_stream_name` and `_is_stream_private` props on the filter object.
We keep these props for convenience, to reduce calls to `subs`,
however, these props become inconsistent with the values from `subs`
when the stream is renamed or stream privacy is changed.

This refactor extracts out `get_stream_params` and `fix_stream_params`
methods as a prep commit towards correcting the problem, but does not
make any behavioural changes.

This is a prep commit for solving #14728.
2020-06-10 14:25:18 -07:00
YashRE42 b292c30d6a subs: Move comment about live update for stream names in navbar.
A comment about the difficulties relating to live updating stream
names in the navbar was incorrectly placed within the function for
live updating stream descriptions in
023187b3f1.

This moves the comment to the right place.
2020-06-10 14:25:18 -07:00
Clara Dantas 451ea753a2 settings_users: Simplify get_item function. 2020-06-10 12:14:58 -07:00
Tim Abbott 6f159ce5c5 templates: Clean up wording around topic moves.
This switches us to cleaner, simpler labels for moving topics; while
also avoiding claiming that we're only allowing moving topics to other
streams.
2020-06-10 12:12:17 -07:00
Tim Abbott 26083e4b10 popovers: Improve label for choosing colors. 2020-06-10 09:55:51 -07:00
Aman Agrawal 7585776c76 stream_header: Fix broken header color and outflowing boundary.
The stream header was moved below the selection option and the
boundary selection input was overflowing, both were fixed via
this commit.
2020-06-10 09:50:49 -07:00
Aman Agrawal 9b9154be91 recent_topics: Set focus on input element on launch. 2020-06-09 22:08:31 -07:00
Aman Agrawal ec00e39e45 recent_topics: Fix misplaced thead border and adjacent css properties. 2020-06-09 22:08:31 -07:00
Aman Agrawal e5e02319b4 recent_topics: Show msg if no topics are visible. 2020-06-09 22:08:31 -07:00
Aman Agrawal ad2e7026c8 recent_topics: Add functionality to sort rows via header.
Add custom sorting for stream and topic headers.
2020-06-09 22:08:31 -07:00
Aman Agrawal 084cbd4ff7 recent_topics: Use list_render to display topic rows.
This fixes the laggy behaviour when there are 2k+ rows to processes,
since list_render uses lazy render based on what rows are visible
to the user.
2020-06-09 22:08:31 -07:00
Aman Agrawal 0aeadd2c86 recent_topics: Set 'unread' and 'participated' as default filters.
Decided after a poll on czo.
2020-06-09 22:08:31 -07:00
Aman Agrawal 33ace41ffe recent_topics: Add filter button to show muted topics.
We don't show muted streams/topics by defualt. Only when user
turns on muted filter.
2020-06-09 22:08:31 -07:00
Aman Agrawal 89fe133d2d recent_topics: Add button to clear search. 2020-06-09 22:08:31 -07:00
Aman Agrawal 9f50825610 recent_topics: Only rerender when recent_topics is visible.
We update the data in the background but only update the view
when recent topics is visible to user.
Also, we always do a complete rerender on launch.
2020-06-09 22:08:31 -07:00
Aman Agrawal e8cc9da4c7 recent_topics: Don't complete_rerender on filter change.
We store the relevant data to hide/show a topic in the row itself,
and use jquery to hide/show it on filter change.

This also fixes search breaking the set filters.
2020-06-09 22:08:31 -07:00