Commit Graph

2494 Commits

Author SHA1 Message Date
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
Aman Agrawal 9b9154be91 recent_topics: Set focus on input element on launch. 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 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
Aman Agrawal e6611089fd recent_topics: Update stored message id of locally echoed messages.
This fixes the bug that message was undefined since we used to store
locally echoed message id and were not updating it after new message
id for the same message was received from the server.
2020-06-09 22:08:31 -07:00
Aman Agrawal d8a312eddb recent_topics: Append proper prefix before stream name.
We reuse the existing logic for displaying and updating stream color
from the stream left sidebar.

Tests fixtures were extracted and updated for this commit.
2020-06-09 22:08:31 -07:00
Aman Agrawal 515334dfb2 recent_topics: Extract test fixture into a function. 2020-06-09 22:08:31 -07:00
Aman Agrawal ee7faf13cc recent_topics: Show checkbox icons for active filters. 2020-06-09 22:08:31 -07:00
Aman Agrawal 4f1b7542ed recent_topics: Toggle topic display according to filters. 2020-06-09 22:08:31 -07:00
Aman Agrawal bc7136590a recent_topics: Add avatars of recent senders to topic. 2020-06-09 22:08:31 -07:00
Aman Agrawal 52529107d2 recent_topics: Clean unused starred data.
The approach that supposed to use this data was not implemented
and hence this data will no longer be used.

If this feature is implemented in future,
this data will still not be used since we would depend upon
starred_messages.js library to provide us the required information.
2020-06-09 22:08:31 -07:00
Aman Agrawal 464b541363 recent_topics: Display recent topics in a table.
* Add action to mute topics.
* We don't need to store muted data per topic as previously planned.
* Moved launch topic test to the top so that they run on non-modified
  data.
2020-06-09 22:08:31 -07:00
Aman Agrawal 9328dc8437 templates: Show Overlay of Recent Topics.
* Show an empty overlay of recent topics.
* Register click event to open recent topics.
* Launch recent topics on "t" keypress.

This is based on the draft overlay.
2020-06-09 22:08:31 -07:00
Tim Abbott e242ddc848 page_params: Add community_topic_editing_limit_seconds.
This was previously hardcoded with agreement between the Zulip backend
and frontend as 86400 seconds (1 day).  Now, it's still hardcoded in
the backend, but arranged in a way where we could add a setting
without any changes to the mobile and terminal apps to update logic.

Fixes #15278.
2020-06-09 14:40:12 -07:00
Tim Abbott fa25738159 message_fetch: Select the anchor message in home view.
In the past, the anchor message has always been the same as the
pointer, but we're about to change that as part of removing the
pointer entirely.

Using the anchor is logically what we meant, anyway, since we always
want to select a message that's actually within the range we just
fetched.
2020-06-08 22:36:35 -07:00
Tim Abbott 2beaf2cab2 pointer: Remove have_initial_messages code.
This was implemented in 2012 to avoid showing a loading indicator for
fetching messages for users with no message history.  However, the
Zulip onboarding UI always creates some message history, and fetching
history is fast, so this is likely clutter more than a useful
optimization.
2020-06-08 22:36:18 -07:00
Priyank Patel f5fbc64aef node_tests: Remove stray assert.
The activity.process_loaded_messages code path was called when these
tests were originally written in f8e0137. We stopped calling that
code path in 43e5b2d (#15118). This assert test code is no longer
relevant; tested by adding console.log in the function. I came
across this when working on removing activity from the window.
2020-06-07 13:01:35 -07:00
Ryan Rehman b0d632577f search pills: Update multiple pills creation event behaviour.
If typeahead is used, this adds comma separated search queries
so that multiple search pills don't get combined as one and the
search behaviour remains same as search_pills_enabled = False case.

If typeahead is not used, this prevent the typing of a single comma
after the pill gets created.
2020-06-05 17:16:20 -07:00
Ryan Rehman 9faf238e8e search tests: Refactor search according to search_legacy.
Now node_tests/search.js and node_tests/search_legacy.js have
almost identical test besides the search pills related data
processing work.
This is possible since we no longer depend on the values stored
in the input pills and can narrow or search for term based on
the `#search_query` box value.
This was done in commit 02ab48a61e.
2020-06-05 17:16:20 -07:00
Ryan Rehman aeb4419d52 search: Open typeahead on initiating search.
This fixes a bug where the hotkeys used to search messages
doesn't work for pills enabled case.
2020-06-05 17:16:20 -07:00
sahil839 bd943941e4 people: Remove 'get_active_user_for_email' function.
This commit removes the 'get_active_user_for_email' function
from people.js. We have removed the use of this function
in the previous commits, which changed the functions using
'get_active_user_for_email' to use user_ids instead of emails.
2020-06-05 16:08:26 -07:00
sahil839 40475a41b0 compose_fade: Change would_receive_message to use user_id.
This commit changes the would_receive_message to use user_id
instead of emails.

This change is done because user_ids are immutable and using
user_ids is the correct way of uniquely identifying user.

The change in 'would_receive_message' also leads to change
in util.is_pm_recipient to use a string of user_ids instead
of emails.

We also know that user_ids passed to 'would_receive_message'
are active user_ids, since we get them from buddy_list.
So we don't need to check whether the user is active, which
was previously being checked by get_active_user_for_email.
2020-06-05 16:08:26 -07:00
sahil839 25aed90da1 compose: Change needs_subscribe_warning to use user_id.
This commit changes the needs_subscribe_warning function to
use user_id instead of emails.

This change is done because user_ids are immutable and using
user_ids is the correct way to uniquely identify a user.

We already know that user_ids being passed in this function are
active user_ids, since they come from typeaheads.
So, we only need to call 'people.get_by_user_id', to get the user
object from user_id and do not need to check the active status of
user, which was done previously using 'get_active_user_for_email'.
2020-06-05 16:08:26 -07:00
sahil839 4b67259294 compose: Change compose_invite_users template to use data-user-id.
This commit changes the compose_invite_users template to use
data-user-id as property intead of data-useremail.

This is changed to maintain consistency with other parts of the
code where user_ids are used for referring to users.

This also helps in removing some of the checks for the case of
undefined emails.
2020-06-04 14:24:41 -07:00
sahil839 48ac1082c1 stream_edit: Use user_ids for subscribing/unsubscribing users to a stream.
We now send user_ids to the backend API for subscribing/unsubscribing
users to a stream instead of emails.

This change is done now because we have just migrated the backend API to
support sending user_ids in 2187c84, so it wasn't possible before.

This change is helpful because sending user_ids is more robust, as those
are an immutable reference to a user, rather than something that can
change with time.
2020-06-04 14:24:41 -07:00
Clara Dantas e1e755c887 people.js: Change functions to return a list of ids instead of objects.
The get_active_humans and get_non_active_humans functions used
to return a list of user objects. The get_active_humans is used
on settings_users.js and settings_bots.js, and in both places the
only attributes needed of the person object are the user_id and
full_name.

To make the function return smaller, instead of a list of active
humans, we are returning a list of active human ids, saving memory.
With the ids we can call the people API to get the full_name attribute.
2020-06-04 14:23:52 -04:00
Anders Kaseorg 4d04fa3118 compose: Rewrite Zoom video call integration to use OAuth.
This reimplements our Zoom video call integration to use an OAuth
application.  In addition to providing a cleaner setup experience,
especially on zulipchat.com where the server administrators can have
done the app registration already, it also fixes the limitation of the
previous integration that it could only have one call active at a time
when set up with typical Zoom API keys.

Fixes #11672.

Co-authored-by: Marco Burstein <marco@marco.how>
Co-authored-by: Tim Abbott <tabbott@zulipchat.com>
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2020-06-03 16:39:12 -07:00
sahil839 c4d3c03ad4 compose: Fix subscribing the user from mention warning.
This commit fixes the bug for subscribing the user from mention
warning which was introduced in e52b544.

This is fixed by changing email to be passed as list to
'invite_user_to_stream'.
2020-06-02 16:25:56 -07:00
Ryan Rehman cfc87e3925 message list: Move the `FetchStatus` object to MessageListData class.
The reason for this change is that, this is where `Filter` and
actual tracking of what messages are contiguous lives. This
will be beneficial when we will to move to a model where we
cache `MessageListData` objects for a large number of views.
2020-06-02 15:45:39 -07:00
sahil839 2ab6767b73 events: Update person dict in event for do_change_user_role to send role.
This commit changes the person dict in event sent by do_change_user_role
to send role instead of is_admin or is_guest.

This makes things much more straightforward for our upcoming primary
owners feature.
2020-05-31 17:22:50 -07:00
Mateusz Mandera 88d501515e presence: Fix "Last active:" in buddy list when last presence is idle.
Restored old behavior accidentally removed in
1ae07b93d8 (diff-e353fab8bea58b8746ec68c83aa39b36L48)

The server only remembers the most recent presence status update per
device. Meaning that, for instance, if the user only uses one client and
that client's last status update was IDLE, then the server only knows
that, doesn't know anything about the user's last ACTIVE time. Thus the
"active_timestamp" the server will serve about this user to the webapp
will be "undefined".
The old behavior was that for the sake of the "Last active: x ago"
status in buddy list popover, the latest status timestamp was used,
whether IDLE or ACTIVE.
The change linked about changed that to only pay attention to
ACTIVE. Thus, if the server doesn't remember any ACTIVE statuses, webapp
would show "Last active: More than 2 weeks ago", which was incorrect.

We restore the old behavior and further improvements can be made on top
of this.
2020-05-29 13:26:34 -04:00
Alex Vandiver 107fe3d3b4 tests: Remove references to trac.zulip.net.
That host has not existed for some time; rename the tests to use a
URL that is clearly nonfunctional.
2020-05-28 17:24:35 -07:00
Rohitt Vashishtha fba2708bbc settings_bots: Explicitly ignore delete event from live updates. 2020-05-28 17:10:51 -04:00
Rohitt Vashishtha 58b612a4f0 settings-users: Rerender bot rows on data change.
Previously, we fiddled with the existing HTML to update the
state. Now, we can use list_render.render_item() to render
the complete item properly.
2020-05-28 17:10:51 -04:00
Rohitt Vashishtha a114b6a1b1 list-render: Allow re-rendering individual list items.
Previously, we had to fiddle with the generated HTML to update
individual values. Now, we can simply ask the widget to rerender
the row that we updated.

This is done by passing an html_selector function that returns
a selector for the rendered item.

If:
  - we do not provide html_selector function
  - item is not currently rendered
  - new html is not a string.
then the render_item() call is a noop.
2020-05-28 17:10:51 -04:00
Steve Howell 43e5b2d28b right sidebar: Remove "GROUP PMs" section.
We remove the "GROUP PMs" section that used
to be in the lower right sidebar.

Most of this is straightforward code removal.

A couple quick notes:

    - The message fetching code now just
      calls `huddle_data.process_loaded_messages`,
      which we still need for search suggestions.
      We removed `activity.process_loaded_messages`.

    - The `huddle_data.process_loaded_messages`
      function no longer needs to return `need_resize`.

    - In `resize.js` we now just calculate
      `res.buddy_list_wrapper_max_height` directly
      from `usable_height`.
2020-05-27 17:57:50 -07:00
Steve Howell 87c36cdb26 resize: Resize sidebars when toggling user search.
It's possible we want to do the same for the stream
search, but this PR is highly focused on the buddy
list and GROUP PMs widget.
2020-05-27 17:57:50 -07:00
Steve Howell 9489960b73 dead code: Remove useless resize calls.
We had a bunch of places where we
were calling `resize.resize_bottom_whitespace`
with no arguments, which has been a no-op
since the below commit that removed support
for our `autoscroll_forever` option:

    fa44d2ea69

With the `autoscroll_forever` options things
like opening/closing the compose box could
alter how much bottom whitespace you'd want,
but we stopped supporting that feature in
2017.

Since then bottom_whitespace has just always
been 40% of the viewport size.  So we only need
to change it on actual resize events.

It's worth noting that we still call
`resize_bottom_whitespace` indirectly in many
places, via `resize_page_components`, and
the latter actually causes
`resize_bottom_whitespace` to do real work,
but that work is redundant for most of those
codepaths, since they're not triggered by
changes to the viewport.  So there are other
opportunities for cleanup.
2020-05-27 17:57:50 -07:00
Tim Abbott d4dfeb57fd lint: Add i18n linter rule for invalid i18n.t tags.
After seeing yet another contributor accidentally try to add i18n tags
that don't work using this pattern, it's time for a lint rule.
2020-05-27 14:09:56 -07:00
Steve Howell 9ce220aca6 buddy_data test: Move huddle_fraction_present test.
This is mostly just moving code from the `activity.js`
tests, but I also now explicitly cover the "100%"
use case (i.e. all four folks in the huddle are present).
2020-05-27 11:02:18 -04:00
Anders Kaseorg 62fcf98b6f js: Use hasOwnProperty correctly or not at all.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-05-26 23:33:40 -07:00
Anders Kaseorg 080abf4a1e emoji: Abstract all name_to_codepoint, codepoint_to_name accesses.
Computed indexes into these raw objects should be guarded with
Object.prototype.hasOwnProperty; make our accessors do this
automatically and use them consistently.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-05-26 23:33:40 -07:00
Anders Kaseorg c440fc714d node_tests: Remove pointless reassignment of ‘dropdown_list_widget’.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-05-26 23:33:40 -07:00
Ryan Rehman a7aae94e64 navbar: Update searchbox event listeners behaviour.
These are some UI and UX changes mainly related for when to
display the search pills and when to dispay the narrow description
in the search bar.
2020-05-26 22:04:36 -07:00
Ryan Rehman e2417b5b37 search: Don't create search pills on paste.
This is helpful because if the user pastes multiple queries in the
searchbox and there are invalid search operators, then it is visible
through the typeahead.
2020-05-26 22:04:36 -07:00
Ryan Rehman 02ab48a61e search: Simplify `narrow_or_search_for_term` code path.
The main reasoning for this change is as follows:

    * When the search bar contains multiple search queries
        but no search results, the last search operand does
        not get displayed.

        This happens due to the fact that filter object
        contained 2 terms having the operator key value as
        "search" instead of a single term where operator is
        "search" and operand is a single string containing
        the space seperated search queries. This condition
        occurs for search_pills_enabled case only because
        we used to Filter.parse the query twice
        (once for the `base_operators` and once for the
        `suggestion_operator instead of doing both at once).

        Thus the `search_query` value inside the
        `narrow.show_search_query` function which only
        selected the operands of the first term displayed
        an incomplete result.

    * Another benefit of this commit is to display the narrow
        operators in the URL fragment the same way as when
        search_pills_enabled = False.

        For example, On entering the queries in the mentioned
        order -> 'is: starred', 'abc', 'def', 'is: private',
        'ghi'. This is the URL:

        Previously:
        /#narrow/is/starred/is/private/search/abc.20def/search/ghi

        Now (same as pills disabled case):
        /#narrow/is/starred/is/private/search/abc.20def.20ghi

    * We are also able to de-duplicate the non-typeahead search
        query code path.
2020-05-26 22:04:36 -07:00