Commit Graph

9112 Commits

Author SHA1 Message Date
Steve Howell c2c5878c3a refactor: Clean up compose_content_matcher.
The switch statement is easier to read, and
we also want to eventually remove the "this"
that couples us to the awkward typeahead
hacks.
2020-01-02 12:11:50 -08:00
Steve Howell ebf4195bf3 refactor: Extract clean_query_lowercase().
This makes it a bit easier to find common patterns,
plus it sets us up to pull the calls even further
up the stack.

The first rule of dealing with user data is sanitize
at the edges, not deep down in some function that
has many callers.  Putting this code so deep down
in the stack means it's more likely to be called in
a loop.
2020-01-02 12:11:48 -08:00
Steve Howell 4699710856 refactor: Move clean_query further up the stack.
This moves clean_query into all the callers
of query_matches_source_attrs.

This doesn't change anything performance-wise,
but it sets up future commits.
2020-01-02 12:10:10 -08:00
Steve Howell 8448832bfe refactor: Move clean_query up the stack.
This change is easy--we only had one caller.

This change means any query going against a
target with multiple `match_attrs`, such as
user names (first name, last) only has to
clean the query once per person.
2020-01-02 12:10:10 -08:00
Steve Howell 5b01efda7b typeahead: Extract clean_query helper. 2020-01-02 12:10:07 -08:00
Steve Howell b5d0eab0c6 dict: Add filter_values() method.
This method can help us avoid some memory
allocations.
2020-01-02 12:03:45 -08:00
Steve Howell 8b04cf1288 people: Use is_my_user_id in get_people_for_stream_create.
We want to get away from email-based checks.
2020-01-02 12:03:43 -08:00
Steve Howell 54cb857fee refactor: Rename people.get_rest_of_realm().
We want to mostly deprecate this function (see
the comment I added), so I gave it a more specific
name.

Ideally I'd just fix `stream_create`, but it does
use this function in a couple places, and it's helpful
to reuse the same sort here.  In one place stream_create
actually unshifts the "me" user back to the top of the
list, which makes sense for its use case.
2020-01-02 12:03:04 -08:00
Steve Howell 6e93f330c6 bug fix: Fix huddles in "Private Messages".
If two user_ids in a recent huddle have ids
that sort lexically differently than numerically,
such as 7 and 66, then we were creating two
different buckets in pm_conversations.

This regression was introduced in
263ac0eb45 on
November 21, 2019.
2020-01-02 11:59:58 -08:00
Steve Howell 0e68387975 refactor: Have pm_conversations take user_ids.
Instead of having our callers pass in a possibly
non-canonical version of a user_ids_string, just
have them pass in a list.

The next commit will canonicalize the sort.
2020-01-02 11:59:58 -08:00
Steve Howell b3b83f223d minor: Avoid dict lookup for color.
The only thing get_color() does is look
up a sub:

    exports.get_color = function (stream_name) {
        const sub = exports.get_sub(stream_name);
        if (sub === undefined) {
            return stream_color.default_color;
        }
        return sub.color;
    };

So if we have a sub already, there's no point
calling the helper.

Obviously, this isn't a huge deal, but it happens
N times during page load.
2019-12-30 09:50:22 -08:00
Steve Howell 0711c7ea49 performance: Avoid dup calls to subscribed_streams().
In stream_sort.sort_groups, we now have the caller
pass us in the list of streams, since they are getting
them anyway.
2019-12-30 09:50:22 -08:00
Steve Howell 33246c5c49 streams: Simplify claim_colors.
This is about a millisecond faster for lots of streams,
since it does more work with native Set.
2019-12-30 09:50:22 -08:00
Steve Howell 631811e686 streams: Add BinaryDict for stream_data.
This should make any operation on subscribed
streams faster (we won't need to filter out
unsubscribed streams every time).

I started writing this before I realized we
had a bug where we call `subscribed_streams`
in a nested loop.

After fixing the bugs, this is not as much of
a bottleneck, but it's still a speedup in many
important places:

    * build left sidebar
    * every keystroke in search bar
    * first keystroke in making #stream_links
    * every keystroke in compose stream box

The streams settings code is kinda complicated.
It does a non-deterministic sort of the "others"
bucket when you add elements to the left panel.
They get hidden, anyway.  Our values() call now
puts subscribed streams first.  It never guaranteed
order, but putting subscribed streams first is
probably a good behavior for most situations.
2019-12-30 09:50:20 -08:00
Steve Howell a3512553a8 streams: Add LazySet for subscribers.
This defers O(N*S) operations, where

    N = number of streams
    S = number of subscribers per stream

In many cases we never do an O(N) operation on
a stream.  Exceptions include:

    - checking stream links from the compose box
    - editing a stream
    - adding members to a newly added stream

An operation that used to be O(N)--computing
the number of subscribers--is now O(1), and we
don't even pay O(N) on a one-time basis to
compute it (not counting the cost to build the
array from JSON, but we have to do that).
2019-12-30 09:47:55 -08:00
Steve Howell e804f39f0e performance: Avoid expensive call in stream_data.is_active.
Calling `set_filter_out_inactives` is expensive, since we
count up the number of subscribed streams, which iterates
through all your streams, creates a new list of subscribed
streams, then counts them.

In my dev setup, I created 700 streams, and this shaved
about 700ms off of the initial call to `build_stream_list`.
2019-12-30 09:45:46 -08:00
Steve Howell 70470dea1c settings: Use correct email when searching users.
If we aren't showing users emails, then we don't
want to use emails in the search.

And if we are showing users emails, we want to
search on the email that's displayed to them.
For admins this will be delivery_email.

For regular users we arguably shouldn't search
on emails either, since it mostly causes confusion,
but this commit just preserves the current
behavior for those users (unless `show_email` is
false).
2019-12-30 09:43:24 -08:00
Steve Howell 3e4326afda refactor: Extract email_for_user_settings.
We want to be able to unit test this value,
since it's conditional on several factors:

    - am I an admin?
    - can non-admins view emails?
    - do we have delivery_email for the user?

I'm mocking show_email in the tests, since the
show_email code is in `settings_org` and
kind of hard to unit test.  It's not impossible,
but it's too much for this commit.  (Either
we need to extract it out to a nice file or
deal with mocking jQuery.  That module is
mostly data-oriented, so it would be nice
to have something like `settings_config` that
is actually pure data.)
2019-12-28 11:22:24 -08:00
Steve Howell 3a95be2f2f refactor: Extract matches_user_settings_search.
This was duplicate code.  I'm moving it to people
for pragmatic reasons--it's hard to unit test stuff
in settings_users.js due to all the jQuery.

It's also nice to have all people-related search
code in one place, just for auditing purposes.
2019-12-28 11:22:24 -08:00
Steve Howell 5e0fc25f74 bug fix: Allow admins to filter users in settings.
It appears c28c3015 caused a regression where we
set `email` to undefined if a user does not have
`delivery_email` set, and this causes filtering
of users to fail for admins doing user settings.

This fixes only one of the issues reported in
issue #13554.

There's probably no easy fix to scrolling taking
long, but I think fixing search will mostly
address that complaint.

The Rust folks seem to agree with me that the
search results are too noisy.  If I search for
"s" I get:

    * names like Steve (good)
    * names like Jesse (noisy)
    * anybody with s in their email (super noisy)

Here is the relevant code:

    return (
        item.full_name.toLowerCase().indexOf(value) >= 0 ||
        email.toLowerCase().indexOf(value) >= 0
    );
2019-12-28 11:22:24 -08:00
Steve Howell 1df7a7280a Avoid unnecessary is_ascii checks on search termlets.
We now can call is_ascii only once per search termlet
when we are filtering multiple persons on the same
query.  (This requires the caller to use
`build_person_matcher` outside a loop or before
a `_.filter` call.)
2019-12-28 11:14:21 -08:00
Steve Howell 399e83aa70 minor: Tweak build_person_matcher.
This is not a major speedup, but we do a couple
simple things here:

    - trim the query outside the function we
      build (that might be called multiple times)

    - don't split names before we possibly
      early-exit with an email match
2019-12-28 11:14:21 -08:00
Steve Howell a718b47095 refactor: Speed up filter_people_by_search_terms.
We now call build_person_matcher outside the loop.
2019-12-28 11:14:21 -08:00
Steve Howell 9c525f8ecb refactor: Extract build_person_matcher().
This will allow use to change some O(N) behavior
to O(1) where we are performing the same query
on a bunch of people.  (Subsequent commits will
actually take advantage of this prefactoring.)
2019-12-28 11:14:21 -08:00
Steve Howell ab34ee0800 search performance: Stop at max_items.
Once we have max_items results, stop trying
to get more items.

This should really help large realms when
you do a search on streams that turns up
more than N streams (where N is about 12).
We won't even bother to find people.
2019-12-28 11:09:28 -08:00
Steve Howell 8406d34145 search: Extract make_attacher.
This class gives us more control over attaching
suggestions to our eventual result.  The main
thing we do now is remove duplicates as they're
encountered.

This will make sense in the follow up commit,
where we can short circuit actions as soon as
we get enough results.
2019-12-28 11:09:26 -08:00
Steve Howell 97293aef96 search: Simplify legacy search code.
We now have a list of filterers that we walk through.
2019-12-28 11:09:25 -08:00
Steve Howell 09326cb467 refactor: Extract finalize_results.
This has a few benefits:

    - we remove some duplicate code
    - we can see finalize_results in profiles

It turns out finalize_results is expensive
for some searches. If the search itself doesn't
do a ton of work but returns a lot of results,
we see it in finalize_results.  It brings to
attention that we should be truncating items
earlier instead of doing lots of unnecessary
work.
2019-12-28 11:09:25 -08:00
Steve Howell 4141abc171 search: Slightly speed up stream highlighting.
This isn't a huge speedup, but it's an easy
code change.

We remove the two-liner highlight_with_escaping,
which was only called in one place, and when
we inline it into the caller, we can pull the
first line, which builds the regex, out of the
loop.
2019-12-28 11:09:23 -08:00
Steve Howell 7a2d9a0579 refactor: Extract build_highlight_regex. 2019-12-28 10:57:53 -08:00
Steve Howell abfd39987c refactor: Remove duplicate code.
The code we removed in highlight_with_escaping
is exactly the same code as in
highlight_with_escaping_and_regex.

I actually copy/pasted this code five years
ago and am now removing the duplication. :)
2019-12-28 10:57:53 -08:00
Steve Howell abdd4b54f4 performance: Speed up search bar highlighting.
When we're highlighting all the people that show
up in a search from the search bar, we need
to fairly expensively build a regex from the
query:

    query = query.toLowerCase();
    query = query.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, '\\$&');
    const regex = new RegExp('(^' + query + ')', 'ig');

Even though the final regex is presumably cached, we
still needed to do that `query.replace` for every person.
Even for relatively small numbers of persons, this would
show up in profiles as expensive.

Now we just build the query once by using a pattern
where you call a function outside the loop to build
an inner function that's used in the loop that closes
on the `query` above.  The diff probably shows this
better than I explained it here.
2019-12-28 10:57:53 -08:00
Anders Kaseorg 8459185970 lightbox: Confine embedded video players to a unique origin.
This fixes a cross-site scripting vulnerability in the upcoming Inline
URL Previews feature found by Graham Bleaney and Ibrahim Mohamed using
Pysa.

This commit doesn't get a CVE because the bug was present in a code
path introduced in the 2.1.x development branch, so it doesn't impact
any Zulip release.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-12-12 15:23:15 -08:00
Tim Abbott 3a41cb6c28 narrow: Clarify streams:public user experience.
This tightens the text and adds a direct link to the modified search.
2019-12-10 18:36:51 -08:00
Tim Abbott eb65eb52dc narrow: Extract update_narrow_title.
This just makes the flow of narrow.activate easier to follow.
2019-12-10 18:13:30 -08:00
Tim Abbott e72da08f09 narrow: Fix streams:all notice appearing too early.
The streams:all adveritsement notice in search should only appear
after we've already received the response from the server, to avoid a
mix of problems ranging from misplaced loading indicator to scrolling
issues to the notice just being distracting while you're waiting for
the server to return results.

We need to add a pre_scroll_cont parameter to the message_fetch API,
since adding this notice would otherwise potentially throw off the
scroll positioning logic for which message to select.

Fixes #13441.
2019-12-10 18:10:39 -08:00
Mohit Gupta a0c11b6c78 narrow: Use search reading behavior in all searches.
In 452e226ea2 and
648a60baf6, we changed how `search:`
narrows work to:

(1) Never mark messages as read inside searches (search:)
(2) Take you to the bottom, not the first unread, if a `near:` or
    similar wasn't specified.

This is far better behavior for these use cases, because in these
narrows, you can't actually see all the context around the target
messages, so marking them as read is counterproductive.  This is
especially important in `has:mention` where you goal is likely
specifically to keep track of which threads mentioning you haven't
been read.  But in many other narrows, the current behavior is
effectively (1) setting the read bit on random messages and (2) if the
search term matches many messages in a muted stream with 1000s of
unreads, making it hard or impossible to find recent search matches.

The new behavior is that any narrow that is structurally a search of
history (including everything that that isn't a stream, topic,
pm-with, "all messages" or "private messages") gets that new behavior
of being unable to mark messages as read and narrows taking you to the
latest matching messages.

A few corner cases of interest:
* `is:private` is keeping the old behavior, because users on
  chat.zulip.org found it confusing for `is:private` to not mark
  messages as read when one could see them all.  Possibly a more
  complex answer is required here.

* `near:` narrows are getting the new behavior, even if it's a stream:
  + topic: narrow.  This is debatable, but is probably better than
  what was happening before.

Modified significantly by tabbott for cleanliness of implementation,
this commit message, and unit tests.

Fixes #9893.  Follow-up to #12556.
2019-12-10 16:26:06 -08:00
Tim Abbott 2eae0b3e57 notifications: Support wildcard_mentions_notify for desktop.
In 1fe4f795af, we added the
wildcard_mentions_notify setting, which controls whether wildcard
mentions should be treated as mentions for the purposes of
notifications.  The original implementation focused on the more
important area of email/push notifications, and neglected to address
desktop notifications for wildcard mentions.

This change makes the wildcard_mentions_notify flag behave correctly
for desktop/sound notifications, including unit tests.

Fixes #13073.
2019-12-10 13:12:36 -08:00
Tim Abbott 22cefeede8 notifications: Extract should_send_*_notification for testing. 2019-12-10 12:54:36 -08:00
Mateusz Mandera 6dbd2b5fc3 auth: Merge RemoteUserBackend into external_authentication_methods.
We register ZulipRemoteUserBackend as an external_authentication_method
to make it show up in the corresponding field in the /server_settings
endpoint.

This also allows rendering its login button together with
Google/Github/etc. leading to us being able to get rid of some of the
code that was handling it as a special case - the js code for plumbing
the "next" value and the special {% if only_sso %} block in login.html.
An additional consequence of the login.html change is that now the
backend will have it button rendered even if it isn't the only backend
enabled on the server.
2019-12-10 20:16:21 +01:00
Rohitt Vashishtha 9bfef83efd minor: Fix accidental global variable leak in marked. 2019-12-09 16:13:02 -08:00
Nat1405 d5f005fd61 wildcard_mentions_notify: Add per-stream override of global setting.
Adds required API and front-end changes to modify and read the
wildcard_mentions_notify field in the Subscription model.

It includes front-end code to add the setting to the user's "manage
streams" page. This setting will be greyed out when a stream is muted.
The PR also includes back-end code to add the setting the initial state of
a subscription.

New automated tests were added for the API, events system and front-end.
In manual testing, we checked that modifying the setting in the front end
persisted the change in the Subscription model. We noticed the notifications
were not behaving exactly as expected in manual testing; see
https://github.com/zulip/zulip/issues/13073#issuecomment-560263081 .

Tweaked by tabbott to fix real-time synchronization issues.

Fixes: #13429.
2019-12-09 16:09:38 -08:00
Anders Kaseorg b932525368 people: Use Unicode normalization for diacritic removal.
Fixes #13481.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-12-09 13:02:54 -08:00
Tim Abbott ce474ee8cf bot settings: Fix sorting by owner.
The previous configuration had not been properly updated for the
conversion of how we transmit bot_owner to the frontend to be based on
user IDs.
2019-12-06 12:01:46 -08:00
Gaurav Thapar 2346dc84df bots: Render bot owner name in bots settings as link to show owner profile.
If owner exists, show owner name as link in org. settings which on click
trigger owner profile popup.

Fixes: #13388.
2019-12-06 12:00:07 -08:00
Rohitt Vashishtha 42726a07b3 minor: Fix accidental global variable leak in jquery filedrop. 2019-12-06 11:27:58 -08:00
Rohitt Vashishtha e2c563d14d minor: Replace Math.min() with Infinity for easier to read code. 2019-12-06 11:27:58 -08:00
Rohitt Vashishtha 85c669e366 markdown: Remove redundant checks from /me.
If a message begins with /me, we do not have any cases where the
rendered content would not begin with `<p>/me`. Thus, we can safely
remove the redundant checks both on the backend and frontend.
2019-12-03 17:17:10 -08:00
joaomcarvalho cd2c68c778 stream settings: Fix initialization of main toggler state.
The "Stream settings" UI was always intended to be initialized in the
"Subscribed" tab when opened not through navigation that explicitly
aims to via "All streams".  We had implemented that through how the UI
is rendered as well as the internal state tracking variable
`subscribed_only`, which was initialized to `true`.

The bug was that we didn't reset that to `true` when re-opening
"Stream settings" via a code path that calls `setup_page` (e.g. via
the menus on the left sidebar).

Ths fixes a bug where the stream-list in the stream settings would
list all streams but would show the 'Subscribed' label after
navigating to "All streams", closing "Manage streams", and then
reopening it.

Fixes #13297.
2019-12-02 09:59:13 -08:00
Tim Abbott 8b55a310f1 typing: Fix invalid typing notifications for stream messages.
In e42c3f7418, we made the assumption
that compose_pm_pill.get_recipient() would return no users for stream
messages.  It turns out, due to the confusing name of
compose_state.recipient (which we just renamed to
compose_state.private_message_recipient), this assumption was wrong.

As a result, when composing a stream message using the reply hotkeys,
we'd end up sending typing notiifcations to the person who sent the
message we're replying to as though a PM was being composed.

We fix this by avoiding passing an (expected to be unused) value for
private_message_recipient to compose_state.start.
2019-12-02 09:31:16 -08:00
Tim Abbott ea7c6d395f compose_state: Rename compost_state.recipient to be about PMs only.
The compose_state.recipient field was only actually the recipient for
the message if it was a private_message_recipient (in the sense of
other code); we store the stream in compose_state.stream instead.

As a result, the name was quite confusing, resulting in the
possibility of problematic correctness bugs where code assumes this
field has a valid value for stream messages.  Fix this by changing it
to compose_state.private_message_recipient for clarity.
2019-12-02 08:53:55 -08:00
Mohit Gupta 452e226ea2 narrow: Fix to show last message in narrow when narrow allows.
Fixes commit id 648a60baf6. When
allow_use_first_unread_when_narrowing() is false last message of
narrow is shown in view.

Comments rewritten by tabbott to explain in detail what's happening.
2019-11-22 12:31:43 -08:00
Tim Abbott 263ac0eb45 pm_conversations: Initialize using server data.
This simple change switches us to take advantage of the
server-maintained data for the pm_conversations system we implemented
originally for mobile use.

This should make it a lot more convenient to find historical private
message conversations, since one can effectively scroll infinitely
into the history.

We'll need to do some profiling of the backend after this is deployed
in production; it's possible we'll need to add some database indexes,
denormalization, or other optimizations to avoid making loading the
Zulip app significantly slower.

Fixes #12502.
2019-11-21 17:01:41 -08:00
Tim Abbott 93b83b28a7 pm_conversations: Refactor to sort by message ID.
message_id, rather than timestamps, is our standard way to sort by
time.  And this refactor is important because we're about to start
using data from the server to populate this data structure.
2019-11-21 17:01:41 -08:00
Tim Abbott 89ff62dafa topic_list: Limit number of unread topics shown at once.
This avoids a stream having potentially near-infinite height when
opened in a stream with a large number of unread topics; the benefit
is that you can easily access the next stream.

We show an unread count next to "more topics" to make it hard to miss
that there might be more, older topics with unread messages.

With CSS work by Anders Kaseorg.

Fixes #13087.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-11-21 13:12:33 -08:00
Anders Kaseorg 16ea89ad89 js: Automatically convert var to let and const in remaining files.
This commit was automatically generated by `tools/lint --only=eslint
--fix`, except for the `.eslintrc.json` change itself.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-11-20 23:04:01 -08:00
Jack Tiggleman 1682d75ea8 message_edit: Add message edit local echo.
Updates the message editing process to do a local 'echo'.

On slow connections, now there is visual confirmation of the edit,
similar to when sending messages.  The contains_backend_only_syntax
logic and check are the same as there.

We showing "(SAVING)" until the edit is completed, and on successful
edit, the word "(EDITED)" appears.  There's likely useful future work
to do on making the animation experience nicer.

Substantially rewritten by tabbott to better handle corner cases and
communicate more clearly about what's happening.

Fixes: #3530.
2019-11-20 17:40:19 -08:00
Tim Abbott bf1386405c settings_notifications: Fix linter issue. 2019-11-20 17:16:43 -08:00
Tim Abbott 55a262d47d message_edit: Move save lower in the file. 2019-11-20 17:06:08 -08:00
Tim Abbott 124f5d12a4 message_edit: Adjust API of edit_locally.
This makes it more extensible for future use of locally echoing edits
to fully sent messages.
2019-11-20 17:06:08 -08:00
Vinit Singh 19234f8705 sidebar: Move the buddy list tooltip content logic to JS.
Moved the logic from static/templates/buddy_list_tooltip_content.hbs to
the get_title_data function to simplify the template.

Fixes #13426.
2019-11-20 17:04:31 -08:00
Tim Abbott 1fe4f795af settings: Add notification settings checkboxes for wildcard mentions.
This change makes it possible for users to control the notification
settings for wildcard mentions as a separate control from PMs and
direct @-mentions.
2019-11-20 16:58:46 -08:00
Anders Kaseorg 0a75fdff6d buddy_data: Fix node tests.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-11-20 15:16:08 -08:00
Anders Kaseorg f9f104a4f8 js: Automatically convert var to let and const in more files.
This commit was automatically generated by `tools/lint --only=eslint
--fix`, after an `.eslintrc.json` change.

A half dozen files were removed from the changes by tabbott pending
further work to ensure we avoid breaking valuable PRs with merge
conflicts.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-11-20 14:10:47 -08:00
Vinit Singh 329d0126bd user status: Add JS tooltips for Buddy List and PM List.
Hovering over user names (and user circles for PM List) now displays
Name, Status Message and Last online time in a js tooltip.
Hovering over group names displays the names of all group members.
Unavailable users are shown as "Last active: Today".

Hovering on a user circle in the Buddy List results in a js tooltip
with Active/Idle/Offline/Unavailable for
green/orange/white/white-with-line.

Resolves #11607.
2019-11-20 12:49:37 -08:00
Dinesh c2e0c492f8 i18n: Fix translation of multi-line strings.
When strings are tagged for translation using `tr this`, the strings
were passed into the frontend i18n as-is (including new line and tab
characters that are not functional in the text, existing just to
format the HTML files reasonably).

This did not match the algorithm used in `manage.py makemessages` for
extracting strings for translation, which (correctly) removed that
whitespace to provide a good experience for translators.  The fix is
for the `tr this` implementation to use that same whitespace-stripping
algorithm.

Tested manually by checking if those strings that were not translated
earlier were translated, and also fixed an automated test that had the
wrong result, which should help prevent regressions.

Fixes #13389.
2019-11-20 10:58:15 -08:00
Ivan Mitev 0f582dfe1f portico: Add return to login button to password reset end.
Previously, we had a "Return to login" button on the previous page of
the password reset flow, but none on the final page.

Note that this button is only shown in the Zulip Electron app.

Fixes #13378.
2019-11-18 12:21:40 -08:00
Jan Koscisz b88192d5bb integrations: Add Gitea integration.
Gitea integration adopted from Gogs integration with minor
adjusting. More events are now handled.

Fixes #13346
2019-11-18 11:55:24 -08:00
Anders Kaseorg 2c4101dbc5 dependencies: Upgrade simplebar from 4.2.3 to 5.0.7.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-11-13 12:46:29 -08:00
Anders Kaseorg fffef412bc dependencies: Upgrade to-markdown 3.1.1 to turndown 5.0.3.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-11-11 16:26:31 -08:00
Anders Kaseorg ffe8ec3450 dependencies: Upgrade eslint from 6.0.1 to 6.6.0.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-11-11 16:26:31 -08:00
Sophie 2eba3e7827 org_settings: Change new user 24-hour setting to dropdown.
These should work consistently with how the individual user setting
works; see the last commit.

With changes from tabbott to fix real-time sync.

Fixes #12553.
2019-11-08 17:39:59 -08:00
Sophie 9d3ebf22ef settings: Change 24-hour setting to dropdown.
The previous checkbox UI gave more of an impression that we considered
12-hour time to be the default model.
2019-11-08 17:35:52 -08:00
Tim Abbott 44f9ce92e9 bots: Fix rendering of bot owner fields in admin settings.
This fixes two regressions in 1946692f9a.

The first bug was actually introduced much earlier, namely that we
were not sending a `bot_owner_id` field at all for bot users without
an owner.  The correct behavior would have been send `None` for the
owner field.

The second bug was simply that we needed to update the webapp to look
for the `bot_owner_id` field, rather than an old email-address format
`bot_owner` field.

Thanks to Vinit Singh for reporting this bug.
2019-11-08 15:09:44 -08:00
Anders Kaseorg 0584a7938f tsconfig: Move to top level.
This way, webpack.config.ts is type checked.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-11-04 18:12:11 -08:00
Anders Kaseorg de4685441c typescript: Type webpack.config.ts correctly.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-11-04 18:12:11 -08:00
Matheus Melo c96762b7a9 settings: Add setting for who can edit user groups.
Fixes #12380.
2019-11-03 16:45:13 -08:00
Anders Kaseorg 28f3dfa284 js: Automatically convert var to let and const in most files.
This commit was originally automatically generated using `tools/lint
--only=eslint --fix`.  It was then modified by tabbott to contain only
changes to a set of files that are unlikely to result in significant
merge conflicts with any open pull request, excluding about 20 files.
His plan is to merge the remaining changes with more precise care,
potentially involving merging parts of conflicting pull requests
before running the `eslint --fix` operation.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-11-03 12:42:39 -08:00
Anders Kaseorg 87b23720f5 blueslip: Apply ESLint.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-11-01 12:13:59 -07:00
Thomas Ip c93522d847 blueslip: Make stack trace more readable.
The stack trace popup is now sourcemapped and each stackframe have a
expandable code context window.

[anders@zulipchat.com: Rebased and simplified.]
2019-10-31 13:47:54 -07:00
David Wood 7fc72dff44 left sidebar: Avoid unnecessary scrollbar.
This commit modifies the `#add-stream-link` element to be a `div`
containing the previous `a` element. The margin that was added to
`#stream-filters-container .simplebar-content` is then moved to that new
`div`.

This preserves the intended behaviour of the commit which introduced
the margin, to fix #12519 while removing an unnecessary scrollbar
which could hide the top-most stream in the stream list.

Fixes #13050

Signed-off-by: David Wood <david@davidtw.co>
2019-10-30 13:21:28 -07:00
Anders Kaseorg 98676f5a1f typescript: Move js/js_typings/zulip/index.d.ts to js/global.d.ts.
The js_typings directory is not set up correctly for us to add new
type declarations for untyped external modules.  The correct
configuration would be something like

{
    "compilerOptions": {
        "baseUrl": ".",
        "paths": {
            "*": ["js_typings/*"],
        },
        "typeRoots": ["js_typings"],
    },
    "exclude": [
        "js_typings",
    ],
}

but that configuration is incompatible with using the same directory
for _internal_ modules like the ones declared here.

Also, correct some mistakes the generation of this list.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-10-30 13:12:54 -07:00
Anders Kaseorg 8654af367d tsconfig: Set module-related options.
Set `--esModuleInterop` and `--isolatedModules` for consistency with
Babel.  `tsc --init` adds `--esModuleInterop` by default.

Set `--moduleResolution node` so we can find type definitions in
modules that provide them.

Set `--forceConsistentCasingInFileNames`, which seems like a good
idea, and which `tsc --init` will add by default in TypeScript 3.7.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-10-30 13:12:54 -07:00
Anders Kaseorg 7a0a186e5f tsconfig: Remove redundant options.
`--jsx preserve` and `--removeComments false` are already the default.
`--strict` already implies `--noImplicitAny`, `--noImplicitThis`,
`--alwaysStrict`.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-10-30 13:12:54 -07:00
Anders Kaseorg 042c558bb3 eslint: Enable sort-imports rule.
I figure we should enable this before we have lots of imports.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-10-30 13:10:25 -07:00
Anders Kaseorg d577537304 pointer: Fix pointer update.
Commit d17b577d0c (#13321) incorrectly
transformed this line, even though I thought my script had a specific
guard against this.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-10-30 11:50:15 -07:00
Anders Kaseorg 2bbcd6ab34 bundles: Factor out portico bundle.
This adds translations.js to the digest entrypoint.  Presumably that’s
fine.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-10-28 15:53:15 -07:00
Anders Kaseorg ee9a6071fd 5xx.html: Build with webpack.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-10-28 15:53:15 -07:00
Anders Kaseorg 27fac76da8 styles: Move media queries into the files they override.
Webpack code splitting will make the inclusion order of CSS files less
obvious, and we need to guarantee that these rules follow the rules
they override.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-10-28 15:39:17 -07:00
Anders Kaseorg 3216dca6bb styles: Remove dead .screen-{full,medium,narrow}-show classes.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-10-28 15:33:02 -07:00
Anders Kaseorg 51de011c07 styles: Remove conflicting .guest-avatar rules.
These were fighting with #avatar, #user-avatar-block,
.inline_profile_picture, .popover-avatar.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-10-28 15:33:02 -07:00
Mateusz Mandera 28dd1b34f2 auth: Refactor social login rendering.
login_context now gets the social_backends list through
get_social_backend_dicts and we  move display_logo customization
to backend class definition.

This prepares for easily adding multiple IdP support in SAML
authentication - there will be a social_backend dict for each configured
IdP, also allowing display_name and icon customization per IdP.
2019-10-28 15:06:26 -07:00
Anders Kaseorg ed607bee2c emoji_picker: Clear search_results by assigning 0 to its length.
This will allow `search_results` to be `const`, which works around a
future ESLint complaint.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-10-28 15:02:43 -07:00
Anders Kaseorg 02004c9b0f js: Convert self-referential vars to const.
ESLint won’t convert these automatically because it can’t rule out a
behavior difference arising from an access to a self-referential var
before it’s initialized:

> var x = (f => f())(() => x);
undefined
> let y = (f => f())(() => y);
Thrown:
ReferenceError: Cannot access 'y' before initialization
    at repl:1:26
    at repl:1:15

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-10-28 15:02:43 -07:00
Anders Kaseorg 7ae84d5ce1 js: Break lines that become too long after converting var to const.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-10-28 15:02:43 -07:00
Anders Kaseorg 4d37dfcf85 js: Convert vars declared separately and assigned once to const.
Because of the separate declarations, ESLint would convert them to
`let` and then trigger the `prefer-const` error.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-10-28 15:02:43 -07:00
Anders Kaseorg a547413347 js: Add braces to case blocks declaring variables.
This helps to prepare for the migration of `var` to `let` and `const`.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-10-28 15:02:43 -07:00
Anders Kaseorg d17b577d0c js: Purge useless IIFEs.
With webpack, variables declared in each file are already file-local
(Global variables need to be explicitly exported), so these IIFEs are
no longer needed.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2019-10-25 13:51:21 -07:00
Anders Kaseorg 5f590d3500 js: Remove /* eslint indent: "off" */ comments.
The time has come to dedent these files.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-10-25 13:21:43 -07:00
Greg Price 3a74de2ade shared: Bump version to 0.0.2.
This will let us update mobile to use this version.
2019-10-24 14:56:56 -07:00
Greg Price 71596648c2 typing_status: Switch sentinel "recipient" value to `null`.
This feels a bit more semantically appropriate: it more clearly says
"here's some information: there is no (relevant) recipient", rather
than "no information available".  (Both `null` and `undefined` in JS
can have either meaning, but `undefined` especially commonly means
the latter.)

Concretely, it ensures a bit more explicitness where the value
originates: a bare `return;` becomes `return null;`, reflecting the
fact that it is returning a quite informative value.

Also make the implementation more explicit about what's expected here,
replacing truthiness tests with `!== null`.  (A bit more idiomatic
would be `!= null`, which is equivalent when the value is well-typed
and a bit more robust to ill-typing bugs.  But lint complains about
that version.)
2019-10-24 14:56:56 -07:00
Greg Price a191890213 typing_status: Fold `stop` into main method `update`.
It'd already been the case for some while that calling `stop` had the
same effect as calling `update` (previously `handle_text_input`) with
a falsy recipient.  With the API changes in the previous few commits,
this becomes quite natural to make explicit in the API.
2019-10-24 14:56:56 -07:00
Greg Price e639b0a6f8 typing_status: Write jsdoc for main entry point, and rename.
This was named after when it gets called from the UI, rather than
after what it can be expected to do.

Naming it after what it's meant to do -- and giving a summary line to
expand on that -- provides a more helpful semantic idea for reasoning
about the function.  Doubly so for using the function in a different
client with its own UI, like the mobile app.
2019-10-24 14:56:56 -07:00
Greg Price dcb5bb7914 typing_status: Combine two parameters into one, with a maybe-type.
The main motivation for this change is to simplify this interface
and make it easier to reason about.

The case where it affects the behavior is when
is_valid_conversation() returns false, while current_recipient
and get_recipient() agree on some truthy value.

This means the message-content textarea is empty -- in fact the
user just cleared it, because we got here from an input event on
it -- but the compose box is still open to some PM thread that we
have a typing notification still outstanding for.

The old behavior is that in this situation we would ignore the
fact that the content was empty, and go ahead and prolong the
typing notification, by updating our timer and possibly sending a
"still typing" notice.

This contrasts with the behavior (both old and new) in the case
where the content is empty and we *don't* already have an
outstanding typing notification, or we have one to some other
thread.  In that case, we cancel any existing notification and
don't start a new one, exactly as if `stop` were called
(e.g. because the user closed the compose box.)

The new behavior is that we always treat clearing the input as
"stopped typing": not only in those cases where we already did,
but also in the case where we still have the same recipients.
(Which seems like probably the common case.)

That seems like the preferable behavior; indeed it's hard to see
the point of the "compose_empty" logic if restricted to the other
cases.  It also makes the interface simpler.

Those two properties don't seem like a coincidence, either: the
complicated interface made it difficult to unpack exactly what
logic we actually had, which made it easy for surprising wrinkles
to hang out indefinitely.
2019-10-24 14:56:56 -07:00
Greg Price 3bdd741852 typing status: Cut unconverted_data conditional.
Returning true from this function means we go on to send, or extend
the lifetime of, a typing notification; returning false means we don't.

It's hard to see why having a partially-entered name in the recipient
box should mean we're *more* inclined to send a typing notification to
the set of recipients that are already entered; if anything, it seems
like it should make us *less* inclined to do so.  So we're better off
without this conditional.

The conditional was introduced in commit 72295e94b, as part of a
conversion from user emails to user IDs; there, it seems to replace a
condition that went in the opposite direction, returning *false* if
there were any invalid emails in the recipient box.  So perhaps it's
just inverted.

Moreover, the (re-)inverted version would also be wrong: if the user
is typing a PM addressed to some users, and they hit send, the message
will go to those users whether or not they have any unconverted text
in the recipients box.  So the typing notifications should too.
2019-10-24 14:56:56 -07:00
Greg Price e42c3f7418 typing status: Cut redundant is-this-PMs condition.
When this condition is true, user_ids_array will always be `undefined`
and so we won't reach this conditional anyway.
2019-10-24 14:56:56 -07:00
Greg Price 5c220ed11a typing_status: Use parameters for data rather than callbacks.
The real purpose these two callbacks serve is exactly what an ordinary
parameter is perfect for:
 * Each has just one call site, at the top of the function.
 * They're not done for side effects; the point is what they return.
 * The function doesn't pass them any arguments of its own, or
   otherwise express any internal knowledge that doesn't just as
   properly belong to its caller.

So, push the calls to these callbacks up into the function's caller,
and pass in the data they return instead.

This greatly simplifies the interface of `handle_text_input` and of
`typing_status` in general.
2019-10-24 14:56:56 -07:00
Greg Price 07322d78a0 typing_status: Pull is_valid_conversation call up to top.
This is intended as a pure refactor, making the data flow clearer in
preparation for further changes.  In particular, this makes it
manifest that the calls to `get_recipient` and `is_valid_conversation`
don't depend on anything else that has happened during the call to
`handle_text_input`.

This is indeed a pure refactor because
 * is_valid_conversation itself has no side effects, either in the
   implementation in typing.js or in any reasonable implementation,
   so calling it sooner doesn't affect anything else;
 * if we do reach it, the only potentially-side-effecting code it's
   moving before is a call to `stop_last_notification`, and that in
   turn (with the existing, or any reasonable, implementation of
   `notify_server_stop`) has no effect on the data consulted by
   the implementation of `is_valid_conversation`.
2019-10-24 14:56:56 -07:00
Rohitt Vashishtha 4cfb209dc5 unread: Don't count wildcard mentions in muted streams/topics.
Users generally don't expect wildcard mentions in muted streams and
topics to be treated as a mention, either for the purposes of desktop
notifications or the unread mention counts.

This fixes the unread mention counts part of the issue.

Fixes part of #13073.
2019-10-21 22:23:29 -07:00
Vishnu KS ec955f8f78 support: Show confirmation links in search.
Fixes #13060 #12784
2019-10-21 16:56:50 -07:00
Tim Abbott 1ce5191009 docs: Remove beta tag on email address visibility.
The last major follow-up task for this feature was merged recently.
2019-10-21 16:13:04 -07:00
chgl bea9e41fbd webhooks: Add Harbor webhook integration. 2019-10-21 15:51:35 -07:00
Pragati Agrawal 37f10509f8 user profile modal: Hide email under hidden email-address-visibility case.
When email address visibility is set to everyone, there is no change in
behavior, but when it is set to "admins-only", we don't show any email
in user profile modal (just like popovers) for everyone but admins.
2019-10-21 15:43:49 -07:00
Pragati Agrawal b1318edbea popovers: Hide email under hidden email-address-visibility cases.
When email address visibility is set to everyone, there is no change in
behavior, but when it is set to "admins-only", we don't show any email
in popovers for everyone but admins.
2019-10-21 15:43:49 -07:00
Mateusz Mandera 8c85040a92 css: Fix azuread-wrapper name.
It should be azuread-oauth2-wrapper, as the name of the corresponding
backend is 'azuread-oauth2'. Without the correct name, the icon isn't
showing on the "Log in with AzureAD" button.
2019-10-21 15:40:27 -07:00
Greg Price b70b7df22c shared: Describe interface of typing_status in Flow.
This allows the mobile app to stay well-typed while using this code.
2019-10-17 16:48:23 -07:00
Greg Price a63786ac0d shared: Set up a way to share some frontend code with the mobile app.
This adds the general machinery required, and sets it up for the file
`typing_status.js` as a first use case.

Co-authored-by: Anders Kaseorg <anders@zulipchat.com>
2019-10-17 16:48:23 -07:00
Anders Kaseorg a3475b422d typing_status: Convert to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-10-17 16:48:23 -07:00
Greg Price 72366c8deb typing status: Fix names "user_ids_string" that were actually arrays.
These indeed used to be strings, but were converted to arrays in
b8250fc61, and these names didn't get updated to match.

A classic example of why type-checking is a great job to get
machines to do. :-)
2019-10-17 16:48:23 -07:00
Mateusz Mandera 4dc3ed36c3 auth: Add initial SAML authentication support.
There are a few outstanding issues that we expect to resolve beforce
including this in a release, but this is good checkpoint to merge.

This PR is a collaboration with Tim Abbott.

Fixes #716.
2019-10-10 15:44:34 -07:00
Tim Abbott 7d0c9eadde search: Fix conditions under which search warning appears.
The warning is irrelevant for starred messages, since the user has
UserMessage rows for any starred messages.
2019-10-10 14:42:05 -07:00
Tim Abbott dade0ad6d5 search: Improve explanation of all public streams search. 2019-10-09 15:16:56 -07:00
Vinit Singh 01b19291e7 search: Advertise the ability to search shared history.
When a user performs a search that might contain historical public
streams messages that the user has access to (but doesn't because
we're searching the user's own personal history), we add a notice
above the first search result to let the user know that not all
messages may have been searched.

Fixes #12036.
2019-10-09 15:12:52 -07:00
Tim Abbott d6c9de6036 filter: Extract filter.contains_only_private_messages.
This will be a useful reusable function for determining whether to
display other alerts as well.
2019-10-09 14:47:38 -07:00
Tim Abbott 5ffbb33a92 left sidebar: Fix centering of streams chevrons.
These appeared to be a few pixels above center in a way that looked
slightly off.
2019-10-07 13:52:48 -07:00
Ryan Rehman 8d0800210e left sidebar: Fix gaps between hover areas.
A somewhat recent refactoring of the left sidebar had introduced a gap
between the hover areas that looked off; this fixes this with a slight
rearrangement with where the 1px of space between elements lives.

Fixes #12508.
2019-10-07 13:52:03 -07:00
YashRE42 5329d24849 settings page: Align permission "Discard" option.
In 50545a3 we made an incomplete revert of some style changes from
7b8da9b, this commit reverts the "x" to "fa fa-times" and also fixes an
alignment issue for the "Discard" box in chrome.
Fixes #13233.
2019-10-07 11:58:24 -07:00
Dinesh ef876ff4c7 right-sidebar: Fix keyboard shortcuts icon in medium widths.
This fixes a glitch where the keyboard shortcuts icon, which is meant
to be a feature of the right sidebar, appears overlapping the "Reply"
button.

Fixes #13122.
2019-10-06 20:43:40 -07:00
Anders Kaseorg caf217d434 typing: Do time math with numbers, not Date objects.
When typing_status adds 10000 to this value, it would previously
obtain wacky strings like

    "Fri Oct 04 2019 16:45:59 GMT-0700 (Pacific Daylight Time)10000"

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-10-05 18:07:25 -07:00
Ivan Mitev 16c9d63056 emoji: Fix sort order of emoji choices.
The previous code for ensuring the sort order of emoji choices was
correct relied on an OrderedDict structure, which isn't guaranteed to
be preserved when passed to the frontend via JSON (in fact, it isn't,
since we converted the way page_params is passed to use
sort_keys=True).  Switch it to a list of dictionaries to correct this.

Fixes #13220.
2019-10-01 13:54:55 -07:00
YashRE42 7d46da0fce acount_settings: Fix position of avatar source.
The avatar source was misspositioned when avatar changes were disabled.
This also repositions the "X" for when avatar changes are allowed.
Fixes #12524.
2019-09-30 11:10:56 -07:00
YashRE42 10fd5db190 account-settings: Lighten user avatar source. 2019-09-30 11:10:56 -07:00
YashRE42 248fbadfb6 account_settings: Refactor avatar settings hbs.
This refactor removes some slightly complex conditional logic for
displaying avatar controls from the handlebar template to js.
2019-09-30 11:10:56 -07:00
Tim Abbott 9326aa9f57 message_edit: Fix Ctrl+Enter with topic edit dropdown selected.
Previously, we were ignoring that dropdown when considering whether
the currently selected element was part of the message edit form.

Fixes #11834.
2019-09-27 17:41:23 -07:00
bartek df8d3dc334 message_edit: Set focus to topic_edit when TOPIC_ONLY.
The historical behavior of having `Enter` exit was optimized for the
"View source" use case; but `Esc` now handles that reasoanbly, and we
really should make it convenient to type in the user-editable text
box here.

Fixes part 1 of #11834.
2019-09-27 16:58:36 -07:00
Rohitt Vashishtha c298163a67 typeahead: Prioritize language names subset of another for sorting.
This ensures that typing '```java' and pressing enter would result in
getting dropped into a java codeblock instead of javascript codeblock.

We implement this by pushing the exact match of a query to be pushed to
the top of the returned matches in `sort_languages`.

With some comments added by tabbott in the tests explaining the
current reasoning.

Fixes #13109.
2019-09-26 13:00:21 -07:00
Tim Abbott 2756706149 hotkey: Fix escape key when editing topic.
Apparently, the changes in fe2adeeee1 to
fix a Firefox focus bug accidentally had the side effect of removing
the topic text box from the area being considered, resulting in the
escape key no longer working to end the message edit from within that
text box.
2019-09-26 12:56:02 -07:00
Hemanth V. Alluri 635b96dbc1 devtools: Order the fixtures dropdown menu alphabetically in the IDP.
This is a simple and small commit which will alphabetically order the
entries of the fixtures dropdown menu in the "integrations developer
panel" devtool.
2019-09-24 17:07:02 -07:00
Tim Abbott 96726c00ce export: Fix broken URLs in UI with S3 backend.
Apparently, the Zulip notifications (and resulting emails) were
correct, but the download links inside the Zulip UI were incorrectly
not including S3 prefix on the URL, making them not work.

While we're at this, we rewrite the somewhat convoluted previous
system for formatting the data export output.
2019-09-24 13:56:49 -07:00
Tim Abbott e8785762c6 export: Fix missing download attribute on export tarballs. 2019-09-24 13:22:02 -07:00
Tim Abbott b11a773842 setings: Fix rendering of plain-text emoji option. 2019-09-24 13:11:01 -07:00
Anders Kaseorg 311aa21d9c styles: Add overflow: hidden on .message_content.
This has two purposes:

1. Prevent stupid stacks of diacritical marks from overflowing into
other messages.  Fixes #7843.

2. Prevent Chrome from collapsing the inside bottom margin with the
.messagebox outside (in a way that Firefox doesn’t).

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-09-23 16:09:58 -07:00
Joao Mauricio Carvalho 86d507db05 settings: Change username to `bot email` in bot settings HTML.
This is for consistency with how this value appears in other places in
the UI.

Fixes: #13162.
2019-09-23 15:55:25 -07:00
Anders Kaseorg 6b09e690f1 page_params: Throw an error if params are missing.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-09-20 10:34:44 -07:00
Anders Kaseorg dea6889956 templates: Make the Loading… message more robust.
Don’t hide it until both CSS and JS have loaded.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-09-20 10:34:44 -07:00
Anders Kaseorg 46e562f990 bootstrap: Change tooltip html default to false.
Bootstrap v2.2.0^2~40^2~6 changes this default to false, so this is a
prerequisite to upgrading Bootstrap, and it’s also safer.

This closes an HTML injection path via user full names in the emoji
reaction tooltip.  It doesn’t appear to be exploitable for cross-site
scripting because we disallow `>` in full names, and the code happens
to be written such that the next `>` is in a different parser
invocation.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-09-19 20:53:10 -07:00
Anders Kaseorg fbc2de157e templates: Move page_params to a <div> at the bottom of <body>.
In a gigantic realm where we send several MB of `page_params`, it’s
slightly better to have the rest of the `<body>` available to the
browser earlier, so it can show the “Loading…” spinner and start
fetching subresources.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-09-19 12:38:10 -07:00
Rohitt Vashishtha 6a08efc065 typeahead: Precompile regexes for removing diacritics.
Precompiling regexes gives a performance increase of around 10-15%
based on tests. See https://jsperf.com/typeahead-regex. This stacks
up when we have a lot of users in an organisation.
2019-09-19 12:27:01 -07:00
clarammdantas cf5d3a3ef3 left sidebar: Fix bot availability status in "private messages".
This changes the availability icon for bot users to user_circle_green;
previously it was accidentally defaulting to user_circle_empty, making
it appear that bots were never available.

Fixes #13149.
2019-09-18 17:40:25 -07:00
Tim Abbott edee1251c8 message_list: Replace buggy rerender_the_whole_thing.
As it turns out, our rerender_the_whole_thing function (used whenever
we were adding messages and discovered that the resulting message list
would be out-of-order) was just broken and scrolled the browser to a
random location.

This caused two user-facing bugs:

* On very fast networks, if two users sent messages at very close to
  the same time, we could end up with out-of-order message deliveries,
  triggering this code path, which was intended to silently correct
  the situation, but failed.

* In some narrows to streams with muted topics in the history but some
  recent traffic, the user's browser-cached history might have some
  gaps that mean the server fetch we do after narrowing discovers the
  history is out-of-order, again triggering the
  rerender_the_whole_thing code path.

The fix is to just remove that function, adding a new option to the
well-tested rerender_preserving_scrolltop (which has explicit logic to
preserve the scroll position) instead.

Fixes #12067.  Likely also fixes #12498.
2019-09-18 11:43:21 -07:00
Anders Kaseorg fe7d814e8d team: Move contributors_list into page_params.
This sidesteps tricky escaping issues, and will make it easier to
build a strict Content-Security-Policy.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-09-17 16:06:33 -07:00
Anders Kaseorg 7494f1600c templates: Move page_params from an inline script to the <body> dataset.
This sidesteps tricky escaping issues, and will make it easier to
build a strict Content-Security-Policy.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-09-17 16:06:33 -07:00
Rohitt Vashishtha 1df5cdc41a typeahead: Align the tip text centered vertically. 2019-09-17 13:09:03 -07:00
Rohitt Vashishtha 3e3deb2f17 typeahead: Move tip text to bottom. 2019-09-17 13:09:03 -07:00
Rishi Gupta 2ebbd9a917 portico: Fix line-height in hero image description. 2019-09-17 12:03:20 -07:00
Alexandra Ciobica 8828ef72fe portico: Add hover styling to `Atlassian migration guide` on /hello.
I changed the element to be  a `p` instead of `div` because the styling
for `a`s inside paragraphs is already there and the element should
anyway be a paragraph.

Fixes part of #12853.
2019-09-17 11:59:22 -07:00
Alexandra Ciobica 5b64a27597 portico: Add hover behavior for app icons on /hello. 2019-09-17 11:55:23 -07:00
Alexandra Ciobica b94ea6553b portico: Fix gradient on /hello. 2019-09-17 11:55:23 -07:00
Alexandra Ciobica 9bb7249c42 portico: Add hover behaviour to `Take the tour` button on /hello. 2019-09-17 11:55:23 -07:00
Anders Kaseorg 366dce5d52 confirm_preregistrationuser: Uninline script.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-09-16 17:23:20 -07:00
Anders Kaseorg ed63042480 templates: Replace focusing scripts with autofocus attribute.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-09-16 17:23:20 -07:00
Anders Kaseorg 6bab61a0d6 styles: Remove overrides for KaTeX line-height and white-space.
Commit ba66dfe977 incorrectly inflated
the specificity level of these rules by moving them inside
.rendered_markdown “entirely for readability”.  KaTeX has its own
rules that work better, so just delete ours.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-09-10 16:03:20 -07:00
Thomas Ip 574c35c0b8 markdown: Render ordered lists using <ol> markup.
This brings us in line, and also allows us to style these more like
unordered lists, which is visually more appealing.

On the backend, we now use the default list blockprocessor + sane list
extension of python-markdown to get proper list markup; on the
frontend, we mostly return to upstream's code as they have followed
CommonMark on this issue.

Using <ol> here necessarily removes the behaviour of not renumbering
on lists written like 3, 4, 7; hopefully users will be OK with the
change.

Fixes #12822.
2019-09-08 16:42:20 -07:00
Tim Abbott 7ca65b2bb5 css: Remove buggy stream settings media CSS for narrow windows.
This caused weird behavior in the relevant band of window widths, and
removing it works considerably better.

There's still bad behavior in handling situations where the stream
name is too long and thus this wraps, but we should address that
as a follow-up.
2019-09-05 11:57:27 -07:00
Tim Abbott fd5f9be14f stream settings: Use fa-circle-o for link to /help/. 2019-09-05 11:48:32 -07:00
Tim Abbott 94c51676fe stream settings: Use <label> tags for section labels.
Previously, these were configured as divs.
2019-09-05 11:48:32 -07:00
Tim Abbott 8b5df88596 css: Make label CSS usable outside settings model.
We intend to use it in the "manage streams" modal as well.
2019-09-05 11:48:32 -07:00
Mateusz Mandera bf7f4f3f1b stream settings: Replace email address hint popup with link to docs.
Fixes #13134 as the last commit in the series for this issue.
Solves the "The (?) should just be a target=_blank link to
/help/message-a-stream-by-email." part of the issue.
As a result, a bunch code managing the email hint popup can be deleted,
together with a node test for that.
2019-09-05 11:48:32 -07:00
Anders Kaseorg 2bdb115581 styles: Remove stray semicolon from input.user_status block.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-09-02 21:45:43 -07:00
Anders Kaseorg e5ab9834c5 logos: Golf harder with svgo 1.3.0.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-09-02 19:30:09 -07:00
Anders Kaseorg d0634181b5 styles: Fix left sidebar indentation for PostCSS migration.
cssnano reduces this to a constant in a production build.  (We could
add postcss-calc if we wanted this reduced in development.)

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-08-30 15:06:29 -07:00
Anders Kaseorg 4de3bbeafa styles: Finish removing manual antialiasing configuration.
Followup from commit ddb965110f.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-08-30 14:51:52 -07:00
Anders Kaseorg abbd8a7f45 styles: Remove most vendor-prefixed CSS attributes.
Many of them are now automatically generated by autoprefixer, while
others are unnecessary based on .browserslistrc, and some were just
wrong (the linear-gradient based checkerboard pattern in lightbox has
been broken in Firefox for a while).

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-08-30 14:51:52 -07:00
Anders Kaseorg d312d04510 styles: Replace Sass with PostCSS.
It’s about as fast as node-sass (faster, according to their
benchmarks) and more flexible.  Autoprefixer is neat: we can now go
delete all our -moz-, -webkit-, etc. lines and have them autogenerated
as necessary based on .browserslistrc.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-08-29 16:35:51 -07:00
Tim Abbott c06d8129a3 custom profile fields: Add placeholder for custom URL.
This makes the feature useable for someone who hasn't used it before.
2019-08-28 15:43:35 -07:00
Yashashvi Dave 9e343f1a68 custom fields: Update create-field UI for default external account fields. 2019-08-28 15:39:20 -07:00
Yashashvi Dave 313003900a custom fields: Move field-type inputs first in create-field form.
As other data of field, such as field name, hint etc. are
relative to field type, this commit moves the field type
input to the first order in create field form in org settings.
2019-08-28 15:39:13 -07:00
Wyatt Hoodes e64b5a2b88 data export: Fix success banner not clearing.
There was a bug where the success banner stuck
around even after the export completed.  We now
nicely fade and remove the banner upon a successful
population of the export in the table.

Fixes: #13045
2019-08-28 15:23:39 -07:00
Wyatt Hoodes 2a020fa6cc data export: Fix sort feature regression.
02cfb47 removed a couple HTML tags that were
being used to sort the table.  We fix this,
but disable filtering exports by marking the
input type as `hidden`.  We use this approach as
it seems `list_render` doesn't like an
undefined `opts.filter.element`, which is
what happens if we simply remove the `filter`
key.
2019-08-28 15:23:39 -07:00
Vinit Singh d09a80260b lint: Replace local variables named 'msgid' with 'message_id'.
Follow up of commit 2a1305d. Replace all local variables named 'msgid'
with 'message_id' in all JS and HTML files, and adds a linter rule for
it as well.

Resolves #12952.
2019-08-28 15:19:30 -07:00
Rohitt Vashishtha 8b443a25b8 markdown: Show link href if title is empty.
Fixes #6221.
2019-08-25 21:36:42 -07:00
Kanishk Kakar e4f0d3d79b notifications: Add 'none' to unread count options. 2019-08-25 21:29:10 -07:00
Yashashvi Dave 166d4ce630 custom fields: Change field alert notifications style in user settings. 2019-08-25 20:57:27 -07:00
Vaibhav 8f13b6eed1 css: Use SCSS nesting for `#stream_message_recipient_stream`. 2019-08-25 15:09:31 -07:00
Vaibhav 9566f4cf6a css: Reorder so `#stream_message_recipient_stream` is in same place. 2019-08-25 15:09:31 -07:00
Vaibhav edb61eb35e css: Use SCSS nesting for textarea and .compose_table .recipient_box. 2019-08-25 15:09:31 -07:00
Vaibhav c15c2d3b97 css: Use SCSS nesting for `.dropdown-menu`. 2019-08-25 15:09:31 -07:00
Vaibhav 9652e8affb css: Use SCSS nesting for `.message-control-button`. 2019-08-25 15:09:31 -07:00
Vaibhav 71efd80dac css: Reorder compose.scss so `.drafts-link` is with `.compose_table`. 2019-08-25 15:09:31 -07:00
Vaibhav 72e13478cb css: Nest `#compose-send-button:focus` inside `#send_controls`. 2019-08-25 15:09:31 -07:00
Vaibhav ffa6e72086 css: Use SCSS nesting for `#send_controls`. 2019-08-25 15:09:31 -07:00
Vaibhav 417284f38a css: Remove unnecessary `table.compose_table` rule.
Since `.compose_table` is a div and not a table.
2019-08-25 15:09:31 -07:00
Vaibhav 52d97e2ca7 css: Use SCSS nesting for `#send_message_form`. 2019-08-25 15:09:31 -07:00
Vaibhav ca4cdb2b29 css: Remove redundant border-radius rule.
It's over-written just below.
2019-08-25 15:09:31 -07:00
Vaibhav a19c74bd5e css: Remove redundant rules for `.message_header*`.
Since these rules are overwritten we can remove them. For
message_header_colorblock we can remove `!important` from
box-shadow since it was present due to the removed rules.
2019-08-25 15:09:31 -07:00
Vaibhav 1e350cbd09 css: Nest `.message_header_colorblock` inside `.compose_table`. 2019-08-25 15:09:31 -07:00
Vaibhav d18492c1c7 css: Use SCSS nesting for `.compose_table`. 2019-08-25 15:09:31 -07:00
Vaibhav 9dd5641d90 css: Use SCSS nesting for #compose-buttons media queries. 2019-08-25 15:08:47 -07:00
Vaibhav 8f6ad6bd11 css: Nest `.drafts-link` inside `.new_message_button`. 2019-08-25 15:08:47 -07:00
Vaibhav 870ca49f0d css: Nest `.alert-draft` inside `.new_message_button`. 2019-08-25 15:08:47 -07:00
Vaibhav 0b4f82df79 css: Nest `.button.small` inside `.new_message_button`. 2019-08-25 15:08:47 -07:00
Vaibhav ac94e3c7b5 css: Use SCSS nesting for `#compose_buttons`. 2019-08-25 15:08:47 -07:00
Vaibhav 877d198363 css: Nest `new_message_button` inside `#compose_buttons`. 2019-08-25 15:08:47 -07:00
Vaibhav 60fe12bcfe css: Reorder compose.scss so #compose-controls are in same place. 2019-08-25 15:08:47 -07:00
Mohit Gupta e5482adec0 search: Add streams:public to search entire history of public streams.
Add ability to search entire message history of all public streams at
once. It includes all subscibed, non subscribed public streams messages
and even historical public stream messages sent before user had joined
an organization or stream.

Fixes #8859.
2019-08-22 13:40:49 -07:00
Rishi Gupta 02cfb47315 exports: Update wording on settings page, /help and /features. 2019-08-22 13:17:03 -07:00
Thomas Ip cbbfb19692 settings: Remove header_map and lookup section names from DOM.
Fixes #13046.
2019-08-22 13:13:24 -07:00
Thomas Ip 3d7b9a1349 list_render: Fix broken reversing operation.
This commit fixes an issue where when you click on the sort button of
a table twice, reversing stops.

The problem is we are checking the truthness of meta.sorting_function
instead of just the function argument sorting_function. This commit
extract the reverse operation out of sort() to unclutter the logic.
2019-08-22 13:13:24 -07:00
Thomas Ip d86299309a org settings: Reduce the width occupied by the actions column in tables. 2019-08-22 13:13:24 -07:00
Thomas Ip 39aceb9d93 org settings: Make data exports table sortable. 2019-08-22 13:13:24 -07:00
Thomas Ip 769eaea617 org settings: Fix wrong call to people.my_full_name(). 2019-08-22 13:13:24 -07:00
Thomas Ip 658e30484e org settings: Make invites list sortable. 2019-08-22 13:13:24 -07:00
Thomas Ip d41d965eed refactor: Group header and body under table for .progressive-table-wrapper. 2019-08-22 13:13:24 -07:00
Tim Abbott bfacbfa783 settings: Fix ordering of headings on emoji settings page. 2019-08-21 17:02:17 -07:00
Thomas Ip 808641a603 css: Tweak sortable list styling to make sortable columns more obvious. 2019-08-21 16:50:22 -07:00
Thomas Ip 936366ffaa org settings: Make emoji list sortable. 2019-08-21 16:50:22 -07:00
Thomas Ip d851e2dafc org settings: Use list_render to create emojis table. 2019-08-21 16:50:22 -07:00
Thomas Ip e309168d11 org settings: Make linkifiers table sortable. 2019-08-21 16:50:22 -07:00
Thomas Ip 8d0bc912f1 org settings: Use list_render to create linkifiers' table.
Moved the table to below the "Add linkifier" box for consistency with
the other settings sections. Also added a search box.
2019-08-21 16:50:22 -07:00
Thomas Ip 83ea462a0a org settings: Make default streams list sortable. 2019-08-21 16:50:22 -07:00
Thomas Ip 29803db802 org settings: Make deactivated users list sortable. 2019-08-21 16:50:22 -07:00
Thomas Ip 2eba496968 org settings: Make active users list sortable. 2019-08-21 16:50:22 -07:00
Thomas Ip 444ce74a8e org settings: Make bot list sortable. 2019-08-21 16:50:22 -07:00
Tim Abbott 5c49133754 settings: Add a block comment explaining the auto-discard feature.
This should help make this code more readable (I found it hard to
understand while reviewing #13030).
2019-08-21 16:48:38 -07:00
Pragati Agrawal ff26858e44 settings_org: Make save widgets fadeout quick if setting toggled back.
When a user toggles a setting back to its original value without
saving, we automatically hide the save/discard widget, since
effectively the user has discarded their changes.

The logic has previously incorrectly configured this as returning to
the "saved" state, not the "discarded" state, which caused an
unintentional delay before the widget disappeared (by accidentally
running code that was designed for the save -> saved transition).

While doing this I have fixed a very minor bug that we haven't sent
fadeout_delay argument as 0, but having its value as undefined still
defaults to 0 so there will no impact of this change.

Fixes: #12258.
2019-08-21 16:42:14 -07:00
Rohitt Vashishtha da2b7ef137 minor: Move displaced comment. 2019-08-21 16:34:40 -07:00
Pragati Agrawal 5df6065bed org settings: Deduplicate the template code for logo widget. 2019-08-21 15:49:25 -07:00
Pragati Agrawal 4d0a94a3b1 org settings: Replace usage of ids with classes for delete button. 2019-08-21 15:49:25 -07:00
Pragati Agrawal c29b197ec7 org settings: Replace usage of ids with classes for upload button. 2019-08-21 15:49:25 -07:00
Pragati Agrawal 67861529ac org settings: Replace id comparision with `hasClass` function.
This is in series of refactoring of code for realm logo settings.

Further, we will remove ids from the template as well and simply use
general classes (.day-settings and .night-settings) to identify to which
theme-mode particular element belongs i.e. day or night as we did in this
change.
2019-08-21 15:49:25 -07:00
Pragati Agrawal 707e012af0 realm_logo: Refactor `realm_logo.rerender` function to be more clean.
This creates/extract a function `change_logo_delete_button`.
2019-08-21 15:49:25 -07:00
Pragati Agrawal 34d2616158 org settings: Use `.realm-logo-file-input-error` to identify input errors.
This replaces `realm_logo_file_input_error` and
`realm_night_logo_file_input_error` with one class.
2019-08-21 15:49:25 -07:00
Pragati Agrawal c214d184d0 org settings: Replace logo's file input ids with `.realm-logo-file-input`. 2019-08-21 15:49:25 -07:00
Pragati Agrawal a6cd0b8788 org settings: Use `realm-logo-img` class as identifier of realm logo image.
This replaces previously being used ids, `realm-settings-logo` and
`realm-settings-night-logo` with a common class `realm-logo-img`.
2019-08-21 15:49:25 -07:00
Pragati Agrawal 6ab2dcf4ac settings_org: Add ids to the section of day and night logos.
- These ids will further be used to represent each section concisely and
  deduplicating code.

- Also, removed `realm-night-logo-section` class as it was redundant.
2019-08-21 15:49:25 -07:00
Vaibhav c20f1945d7 css: Nest .help-table inside .modal-body. 2019-08-20 12:00:22 -07:00
Vaibhav a3c6bd68f0 css: Use SCSS nesting for .hotkeys_table. 2019-08-20 12:00:22 -07:00
Vaibhav c9b8de9cc1 css: Use SCSS nesting for .informational-overlays. 2019-08-20 12:00:22 -07:00
Vaibhav ba0f377273 css: Reorder informational_overlays.scss so similar elems in same place.
Also some whitespace changes. (No separate commit required).
2019-08-20 12:00:22 -07:00
Alexandra Ciobica 96cdfd676b css: Add bottom margin to titles in the register pages. 2019-08-18 12:57:25 -07:00
Pragati Agrawal eedcdf7f3b settings/styles: Reorder `.settings-section .table-striped` to same place. 2019-08-18 12:44:40 -07:00
Pragati Agrawal 78d6ecfa08 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`.
2019-08-18 12:44:40 -07:00
Pragati Agrawal aac9a7a4b1 settings/styles: Remove redundant rules for `.table-striped thead th`.
This rule is already specified at
 `.settings-section .table-striped thead th`.
2019-08-18 12:44:40 -07:00
Pragati Agrawal a858d51a85 settings/styles: Nest all `.settings-section` rules. 2019-08-18 12:44:40 -07:00
Pragati Agrawal 9acd8caa59 settings/styles: Remove redundant specificity. 2019-08-18 12:44:40 -07:00
Pragati Agrawal 2c846774c0 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.
2019-08-18 12:44:40 -07:00
Pragati Agrawal 94d867cd11 settings/scss: Reorder `.settings-section` to have them in same place. 2019-08-18 12:44:40 -07:00
Pragati Agrawal b0b1435a18 settings/scss: Remove now redundant `settings-wrapper` class.
No class like this is rendered to page.
2019-08-18 12:44:40 -07:00
Pragati Agrawal 378c1a5994 settings/scss: Reorder to have `.settings-section-title` at same place. 2019-08-18 12:44:40 -07:00
Wyatt Hoodes 5ee7553214 popovers: Fix broken user popover behavior.
If we call `popovers.hide_all` with a smaller browser
window, this breaks the functionality that the
conditional is attempting to handle.  We instead use
`hide_all_except_sidebars` to prevent the user list
from being closed.

If the display setting to show the user list in the
left sidebar is enabled, the behavior is even worse.
We add a conditional to maintain the streamlist
sidebar when clicking the chevron to show and hide
the popover here as well.
2019-08-18 12:12:52 -07:00
Priyank Patel 0e337c015a message_fetch: Use stream ID for stream operand.
Fixes part of #9474
2019-08-17 11:20:51 -07:00
Priyank Patel 1f8f8867cd message_fetch: Rename handle_user_ids_supported_operators.
This renames handle_user_ids_supported_operators to
handle_operators_supporting_id_based_api.
2019-08-17 11:10:00 -07:00
Priyank Patel 1edde4a989 Rename user_id(s)_supported_operators -> operators_supporting_id(s). 2019-08-17 11:10:00 -07:00
Pragati Agrawal 13d5a21430 settings/scss: Nest many rules inside `#user-groups`. 2019-08-16 10:47:33 -07:00
Pragati Agrawal 44d6123c26 settings/scss: Nest `.user-group` inside `#user-groups`. 2019-08-16 10:46:12 -07:00
Pragati Agrawal df31238fb7 settings/scss: Make `#user-groups .user-group` rules at same place. 2019-08-16 10:46:12 -07:00
Vaibhav 262e5c6400 css: Use SCSS media queries nesting in drafts.scss. 2019-08-15 22:39:39 -07:00
Vaibhav 2c4f4b0e38 css: Nest .draft-controls inside .draft-info-box. 2019-08-15 22:39:39 -07:00
Vaibhav ab30295a39 css: Nest .draft-info-box inside .draft-row. 2019-08-15 22:39:39 -07:00
Vaibhav f94f4ac48e css: Nest .drafts-list inside .drafts-container. 2019-08-15 22:39:39 -07:00
Vaibhav 4e7f3eba85 css: Nest .exit-sign inside .exit. 2019-08-15 22:39:39 -07:00
Vaibhav 7ed9d10016 css: Nest .exit and .exit-sign inside .drafts-header. 2019-08-15 22:39:39 -07:00
Vaibhav d20204826d css: Nest .drafts-header inside .drafts-container. 2019-08-15 22:39:39 -07:00
Vaibhav 591ebb22bf css: Use SCSS nesting for .draft- row, info-box and controls. 2019-08-15 22:39:39 -07:00
Vaibhav 585b6680ae css: Reorder drafts.scss so .draft-row are together. 2019-08-15 22:39:39 -07:00
Vaibhav 067c9040e7 css: Use SCSS nesting for .drafts- container, header and list. 2019-08-15 22:39:39 -07:00
Vaibhav b940406877 css: Reorder drafts.scss so .drafts-container are in same place. 2019-08-15 22:39:39 -07:00
Pragati Agrawal 693df05ca7 settings_users: Refactor and extract function for last active.
This just done to improves code readability and removes some code too.
2019-08-15 16:54:28 -07:00
Pragati Agrawal c0c11fe226 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.
2019-08-15 16:54:28 -07:00
Pragati Agrawal a3ef8856a8 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.
2019-08-15 16:54:28 -07:00
Pragati Agrawal ba5564fec7 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.
2019-08-15 16:54:28 -07:00
Pragati Agrawal 6b5e98d554 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.
2019-08-15 16:51:19 -07:00
Alexandra Ciobica f7e88fb2c1 css: Add color variables to integrations.scss. 2019-08-15 16:12:15 -07:00
Alexandra Ciobica 43d11285fa css: Add background to integrations categories. 2019-08-15 16:12:15 -07:00
Alexandra Ciobica da9a092d39 css: Refactor integrations to use SCSS nesting.
While refactoring, I tested all the rules and removed the CSS that was
not needed or duplicated.

I removed the `$("#integration-list-link").css('display', 'block');` and
moved it to css because there is no case in which the back link is
hidden.
2019-08-15 16:12:15 -07:00
Alexandra Ciobica 84e0327d10 integrations: Fix arrangement of left sidebar `back to list` button.
I rearranged the elements of the left sidebar in HTML in order to appear
in the order they are displayed and removed the absolute positioning,
because it was not needed if the elements are arranged correctly. I used
`flex` display to arrange them on column.

I removed the styling that positioned the elements absolutely.

Then I tweaked the margins in order to make the elements look good.

Fixes: #12929
2019-08-15 16:12:15 -07:00
Thomas Ip cbae51db63 settings: Move API key form into its own modal.
The modal is rendered dynamically to avoid password managers
inserting passwords into the input field too aggressively.

Fixes #12523.
2019-08-14 10:50:45 -07:00
Thomas Ip 75db8fecf8 refactor: Remove redundant dataType option to channel.post(). 2019-08-14 10:50:45 -07:00
Akash Nimare 2e47e35edc desktop: Update desktop app to v4.0.0. 2019-08-13 12:36:40 -07:00
Wyatt Hoodes f623540409 data export: Add UI to trigger data export.
This commit serves as the frontend piece for the "public export"
webapp feature.

Fixes: #11930
2019-08-12 18:21:38 -07:00
Alexandra Ciobica 4c08a840d0 accounts/go: Change class of bottom text to be consistent.
I changed the class of the two bottom texts to use the same styling as
(`/new` and `/complete/github`)
2019-08-08 11:12:51 -07:00
Alexandra Ciobica 196185db03 css: Remove unused css from register page.
After removing the `bottom-text` from `new organization`, this css from
the register page is not used anymore.
2019-08-08 11:12:51 -07:00
Alexandra Ciobica eb6c5e1962 auth: Style the GitHub auth email selection page.
I added the `white-box` as it was in the other similar pages
(`/accounts/go`).

In order to be able to style it better, I removed the buttons and added
`div`s instead, then added click handler for submitting the form.

If the email is associated to a Zulip account, the avatar of the account
is displayed and the text `Log in`, otherwize a `+` sign is
displayed and the text `Create new account`.
2019-08-08 11:12:51 -07:00
Alexandra Ciobica e5e45c9a25 auth: Change page title and add description for the list.
I changed the class of the title in order to use the same styling as the
 other similar pages (like `/accounts/go` or `/login`).

Changed the related test.
2019-08-08 11:12:51 -07:00
Vaibhav aa29ef0317 css: Use SCSS nesting for 700px media queries in subscriptions.scss. 2019-08-07 17:42:10 -07:00
Vaibhav 5aa22f4acd css: Reorder so `.subscriptions-container` are in same place. 2019-08-07 17:42:10 -07:00
Vaibhav 7019b8a4c6 css: Use SCSS nesting in subscriptions.scss media queries. 2019-08-07 17:42:10 -07:00
Vaibhav 1b1e74bc24 css: Use SCSS nesting for `ul.grey-box`. 2019-08-07 17:42:10 -07:00
Anders Kaseorg c3a83a82c5 echo: Consistently send local_id as string, convert it back to number.
Fixes: #2734.

`local_id` was being transmitted to the server as a string by the AJAX
transmission path, and as a number by by the WebSocket transmission
path.  Then, one of the two racing success callback paths would use
the original number, while the other would use the type returned by
the server.  Depending on which transmission path was used and which
callback path won the race, `reify_message_id` would sometimes be
passed a string that would fail to compare equal to the numerical
selection id.  If the locally echoed message was selected, this would
cause the selection to disappear.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-08-07 17:17:25 -07:00
Vaibhav 30af846095 css: Use SCSS nesting for `.poll-edit-question`. 2019-08-07 17:16:49 -07:00
Vaibhav 241015e3e6 css: Use SCSS nesting for `.poll-question-*`. 2019-08-07 17:16:49 -07:00
Vaibhav 1fb5e36e7a css: Use SCSS nesting for button.task*. 2019-08-07 17:16:49 -07:00
Vaibhav 911e438a14 css: Use SCSS nesting for add-task, poll-question and poll-option. 2019-08-07 17:16:49 -07:00
Vaibhav 6f0f4647ec css: Nest `.poll-vote` inside `.poll-widget`. 2019-08-07 17:16:49 -07:00
Vaibhav 13293c702e css: Use SCSS nesting for `.poll-vote`. 2019-08-07 17:16:49 -07:00
Vaibhav 7b77cc936a css: Reorder widgets.scss so `.poll-vote` are in same place. 2019-08-07 17:16:49 -07:00
Vaibhav 39b1665237 css: Use SCSS nesting for `.poll-widget`, `.todo-widget`. 2019-08-07 17:16:49 -07:00
Vaibhav 11b2748bce css: Nest `.widget-choices-heading` inside `.widget-choices`. 2019-08-07 17:16:49 -07:00
Vaibhav 27223b258d css: Use SCSS nesting for `.widget-choices`. 2019-08-07 17:16:49 -07:00
Vinit Singh a2f9211384 message_view: Show edit history when EDITED notice is clicked.
Open the edit history of a message when a user clicks on it's
EDITED notice.
Also, added on-hover darkening for the EDITED notice.

Resolves #12615.
2019-08-07 16:59:24 -07:00
vinitS101 3d01921e1a user status: Changes to Last active field of Full User Profile.
If a user was active within the last 90 days,
show number of days (23 Days ago).
If the user was active more than 90 days ago and in the same year,
then show MMM DD (Mar 15).
In any other case show MMM DD YYYY (Nov 10 2018),
Change timerender.js test to accomodate changes.
2019-08-07 16:20:19 -07:00
vinitS101 232f588d4e user status: Change Online now to Active now in full user profile.
Change "Online now" to "Active now" in Last seen field of
full user profile.
2019-08-07 16:20:19 -07:00
vinitS101 a82ad468f9 user status: Change Last online to Last active.
Change "Last online" to "Last active" in the full user profile.
2019-08-07 16:20:19 -07:00
Anders Kaseorg becef760bf cleanup: Delete leading newlines.
Previous cleanups (mostly the removals of Python __future__ imports)
were done in a way that introduced leading newlines.  Delete leading
newlines from all files, except static/assets/zulip-emoji/NOTICE,
which is a verbatim copy of the Apache 2.0 license.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-08-06 23:29:11 -07:00
Rishi Gupta a0ebd9276d portico: Fix bug with .warn on /integrations.
Was causing an extra 10px of margin-top on .warn.

In general styles applied to .tip and .keyboard-tip should also be applied
to .warn.
2019-08-05 17:33:05 -07:00
Rishi Gupta bc220aefdf help: Document topic links. 2019-08-02 16:33:27 -07:00
Rishi Gupta 3fbd0026a4 compose: Update topic list tip_text.
It was a bit confusing to have this appear even after you typed `>`.

Also, removed the word "mention", since mention has a specific meaning in
Zulip.
2019-08-02 16:33:27 -07:00
Pragati Agrawal 5b324e50ca 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.
2019-08-02 15:28:36 -07:00
Pragati Agrawal ac2f1cea9c settings_org: Enhance `show_emails` for admins only case too.
This adds on the `is_admin` clause to show_emails.
2019-08-02 15:20:55 -07:00
Rohitt Vashishtha a7f2bedb15 markdown: Enable hashheadings syntax.
Our implementation requires at least 1 space after the
'#' not not break existing linkifiers like '#123', etc.
that generally follow the convention we show in linkifier
examples.

- [valid]  : # Hello
- [valid]  : #  Hello
- [invalid]: #Hello

For the frontend, we have taken the code from v0.7.0 of
upstream marked and made minor changes to avoid having
to refactor a significant part of our marked code.

For the backend, we merely have to change the regex to
force require spaces after #, and add hashheader to our
list of blockparsers.

Fixes #11418.
2019-08-02 15:15:34 -07:00
Tim Abbott e807041bda compose_ui: Fix double escaping of compose placeholder text.
This fixes an issue where we were accidentally double-escaping the
compose placeholder text if it contained HTML entities; once in
`i18n.t` and again when inserting it into the `placeholder` DOM via
`.attr`.
2019-08-01 12:59:07 -07:00
Rohitt Vashishtha bb46bc099b typeahead: Show header text for some mentions.
Show help text when completing stream, topic, mention and silent_mention.
2019-07-31 15:36:15 -07:00
Rohitt Vashishtha 6c34d99ad0 typeahead: Add header text to show info about current completion.
We can provide a function that returns an HTML string: `this.header()` to
display a header text above the typeahead. This can be used to provide
contextual information such as hinting about the silent mentions syntax
or the topic mentions syntax.

At the end of this commit, the HTML structure is:

$container <div>
  $header <p>
    info-icon
    header-text
  $menu <ul>
    list-items
2019-07-31 15:33:27 -07:00
Rohitt Vashishtha b071270788 typeahead: Add a container div for the typeahead list.
This change allows us to add custom changes to the HTML generated
by the typeahead without interfering with the core functions that
are provided by the library.

At the end of this commit, the HTML structure is:

$container <div>
  $menu <ul>
    list-items
2019-07-31 15:33:27 -07:00
Tim Abbott 38ffde37e5 css: Move edit history highlighting CSS into rendered_markdown. 2019-07-31 12:08:17 -07:00
Tim Abbott 28fc159d24 css: Move more embed CSS into rendered_markdown. 2019-07-31 12:08:17 -07:00
Tim Abbott 4fbc74bb0b css: Delete custom CSS for message-edit-history.
This logic effectively badly duplicated the existing rendered_markdown
CSS.
2019-07-31 12:08:17 -07:00
Tim Abbott ba66dfe977 css: Scope KaTeX CSS inside rendered_markdown.
This is entirely for readability.
2019-07-31 12:08:17 -07:00
Tim Abbott 5b732437c1 css: Scope mentions and alert words in rendered_markdown. 2019-07-31 12:08:17 -07:00
Tim Abbott 97b256d1f0 css: Extract rendered_markdown.scss.
This moves our main CSS for rendered Zulip message content into an
external file, which may be reusable but in any case should make it
easier to find this content.
2019-07-31 12:08:17 -07:00
YashRE42 7a6f4630dc compose_box: Prepopulate stream if possible.
When users are only subbed to a single stream, this autofills the stream
field of the compose box.
Fixes #12507.
2019-07-31 10:20:24 -07:00
Tim Abbott fac886ce05 Revert "compose: Fix cursor placement timing bug when selecting a typeahead."
This reverts commit 76e50af78e.

Empirically, this caused weird issues with the cursor jumping around,
so more investigation is required into the right way to fix it.
2019-07-29 18:05:46 -07:00
Vinit Singh 03180752db compose: Update placeholder text depending on the narrow.
Change the `compose-textarea` placeholder text depending on the
stream/topic or PM recipients that the message will be sent to.

Resolves #12834.
2019-07-29 15:51:50 -07:00
Yashashvi Dave 865a7204f9 custom fields: Set generic click handler on remove_date buttons.
This commit adds click handler on date type custom profile
fields on field initialization itself.
This commit also fixes the bug in date type fields in user
profile in org settings.
2019-07-29 15:06:35 -07:00
Yashashvi Dave b93ca2fc50 custom fields: Hide remove_date button for none value date fields.
This commit adds a click handler on datepicker custom profile
fields, which hides the `remove_date` button if the field value
is not set.

Fixes part of #11453
2019-07-29 15:06:35 -07:00
Yashashvi Dave 2e8cf6984e user settings: Fix click handler errors on datepicker profile field.
On change value click handlers on user profile fields in user settings
were also initialized on profile fields in org settings -> users
section. In org settings -> users, we do not need on change value
click handlers.
This commit fixes above issue by setting up handlers only on
user settings page.
2019-07-29 15:06:35 -07:00
Yashashvi Dave 440975e369 org settings: Fix background color in custom user profile datepicker field.
Fixes part of #11453
2019-07-29 15:06:35 -07:00
Anders Kaseorg 29c5b63e64 css: Fix .message_top_line stealing mouse events from .message_edit_form.
This is a replacement for the workaround removed by commit
2273608477.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-07-25 17:55:34 -07:00
Anders Kaseorg f0e0fe1c15 ui.get_scroll_element: Set up SimpleBar if it’s expected but missing.
Although SimpleBar automatically sets itself up on elements with a
`data-simplebar` attribute, sometimes we try to set event listeners
before that happens.  Create the SimpleBar early in that case.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-07-25 16:18:54 -07:00
Vaibhav 2fd0753d22 reactions_button: Remove title from reaction button in controls.
Since the button already has a tooltip, we can remove the title.
2019-07-25 16:13:19 -07:00
Alexandra Ciobica 13bdc655c9 css: Fix `ol`s on integrations.
Apparently, the 30px width we allocated to the bullets was
insufficient with the larger font size there.

Edit by tabbott: better to just increase it to 32px everywhere.
2019-07-25 15:08:07 -07:00
Alexandra Ciobica 999209020f portico: Move `code-section` rules to `markdown.scss`.
`code-section` is a feature of the markdown system, therefore the
associated CSS should be in the `markdown.scss` file. I also refactored
to use SCSS nesting.
2019-07-25 15:04:09 -07:00
Alexandra Ciobica 8fef764960 css: Make help page height selector from 500px viewport more specific. 2019-07-25 15:04:09 -07:00
Alexandra Ciobica 428a5c0d26 css: Change `font-size` of markdown text on why-zulip and integrations. 2019-07-25 15:04:09 -07:00
Alexandra Ciobica 4e29721385 css: Remove duplicated css rules.
These rules are no longer needed after the addition of `.markdown` class
 on the `why-zulip` pages.
2019-07-25 15:04:09 -07:00
Alexandra Ciobica 295cbc8535 css: Refactor `markdown.scss` to use SCSS nesting. 2019-07-25 15:04:09 -07:00
Alexandra Ciobica 7a22111601 css: Move markdown CSS into separate file. 2019-07-25 15:04:09 -07:00
Alexandra Ciobica d2466e15cb css: Remove duplicated `integrations` selectors and fix styling.
I added the `@media (max-width: 500px)` because the text from the inner
content was gong outside the white background on mobile because of the
height of the `.markdown` class for this viewport.

I moved this `.integration-instructions .help-content h3 { margin: 20px
0 ; }` from the `portico.scss` because it should be in `integrations
.scss`.

I removed the `#hubot-integrations` because I didn't find that id
anywhere.

I removed `.portico-landing.integrations ol ul` because `.markdown`
takes care of that left spacing.
2019-07-25 15:04:09 -07:00
Alexandra Ciobica 93c98e6d9a css: Remove duplicated selectors from `why-zulip`. 2019-07-25 15:04:09 -07:00
Rohitt Vashishtha 76e50af78e compose: Fix cursor placement timing bug when selecting a typeahead.
When you press enter on a typeahead and start typing, your cursor is
placed at the end of the textbox, whereas we want it to be placed at
the end of the typeahead immediately. This causes some characters to
appear at the end of the message before you again get to typing from
where you left off.

To fix, we use the change event triggered on typeahead completion to
reposition the cursor instead of using a setTimeout().

Fixes #12621.
2019-07-25 15:01:24 -07:00
Yashashvi Dave 3f28f4a9f5 static/templates/stream_settings_checkbox: Simplify handlebar logic.
Fixes #12801
2019-07-25 14:56:12 -07:00
Yashashvi Dave 307ef2e96d static/templates/emoji_popover_emoji: Fix typo. 2019-07-25 14:56:12 -07:00
Rohitt Vashishtha 4f03d82ff0 compose: Do not trigger topic mention if already completed. 2019-07-25 14:53:43 -07:00
Vaibhav 6bd6b846a5 css: Reorder subscriptions.scss so `.large-icon` are in same place. 2019-07-25 14:44:58 -07:00
Vaibhav 36b78b034b css: Remove redundant rules from `.large-icon.hash`. 2019-07-25 14:44:58 -07:00
Vaibhav 350bcbea80 css: Use SCSS nesting for `#subscriptions_overlay`. 2019-07-25 14:44:58 -07:00
Vaibhav 86bff0c3ce css: Nest elements inside `#subscription_overlay`. 2019-07-25 14:44:58 -07:00
Vaibhav 37f70adeb6 css: Use SCSS nesting for `.editable-section`. 2019-07-25 14:44:58 -07:00
Vaibhav 4c70a23d43 css: Nest `#stream_creation_form` inside `#stream-creation`. 2019-07-25 14:44:58 -07:00
Vaibhav 4886f3b8f0 css: Use SCSS nesting for `#stream_creation_form`. 2019-07-25 14:44:58 -07:00
Vaibhav dd6494343a css: Use SCSS nesting for `#stream-creation`. 2019-07-25 14:44:58 -07:00
Vaibhav bd7fc23d30 css: Nest elements inside `#subscription_overlay #stream_creation`. 2019-07-25 14:44:58 -07:00
Vaibhav 4fc3878b00 css: Use SCSS nesting for `.stream-creation-body`. 2019-07-25 14:44:58 -07:00
Vaibhav 6a840e39f6 css: Nest `#announce-new-stream` inside `.stream-creation-body`. 2019-07-25 14:44:58 -07:00
Vaibhav 33bc11980d css: Use SCSS nesting for `.create_stream_button`. 2019-07-25 14:44:58 -07:00
Yashashvi Dave e55afc2629 user settings: Update alert message element in change-full-name modal. 2019-07-25 13:33:44 -07:00
Yashashvi Dave e1dacb99df user settings: Update alert message element in change-email modal. 2019-07-25 13:33:44 -07:00
Yashashvi Dave b3b480709d user settings: Update alert-msg-elem in change password modal. 2019-07-25 13:33:44 -07:00
Yashashvi Dave 4860904284 user setting: Update user display message for setting change-email. 2019-07-25 13:33:44 -07:00
Yashashvi Dave 916a84ce20 overlays: Remove all alert notifications from in open_modal func.
We should not display any alert previous notification on
open_modal() functions.
2019-07-25 13:33:44 -07:00
Yashashvi Dave 5506b16fa8 user settings: Add separate alert-save widget for profile custom fields.
Fixes part of #12748
2019-07-25 13:33:44 -07:00
Yashashvi Dave 3c16b73fcd account settings: Simplify handlebars conditional logics.
This commit simplifies complex handlebars conditional
logic for account settings tooltips and fields.
2019-07-25 13:33:44 -07:00
Anders Kaseorg 2ac944c31f css: Remove message_hovered class.
This appears to have been dead for years.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-07-23 17:54:12 -07:00
Tim Abbott 2273608477 css: Fix buggy pointer-events behavior in message feed.
I noticed a super weird bug where the edit pencil would disappear on
hover inside the message feed (!).  Investigation determined that what
was actually happening was that the Drafts overlay had been shown and
then hidden at a time when the mouse cursor was over the icons with
`data-toggle="tooltip"` configured, and the tooltip showing.  The
result was that this tooltip object, if you mouse over it, would cause
us to no longer be hovering over the message (because your cursor was
actually over the invisible drafts widget's leaked tooltip).

Ideally, we'd have fixed this by making the drafts modal `display:
none`, but that would interfere with the modal's closing animation,
and there's no good way to have an event trigger on a CSS animation
finishing.

There's a second bug that makes this possible, however, which is that
the drafts modal is supposed to be `pointer-events: none` while
hidden, but some rogue CSS for `message_top_line *` set
`pointer-events: auto` to override `pointer-events: none` on
`message_top_line` was accidentally applying to things inside that
line in the drafts modal, and furthermore accidentally overriding the
`none` setting for the modal as a whole.

We fix that second bug here, which resolves the overall issue.
2019-07-23 17:22:14 -07:00
Anders Kaseorg 82828bdba4 HTML validation: Remove invalid <button href> attribute.
For .start-button, Bootstrap carousel already supports <button
data-target> as a valid alternative to <button href>.  For
.call-to-action, the margin is decreased to exactly offset the lack of
margin collapsing with display: inline-block.  There should be no
visual change.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-07-23 16:16:22 -07:00
Alexandra Ciobica 1c7db8eb9a css: Fix why-zulip images.
The addition of `.markdown` class added border and shadow on images,
which does not look good on the landing page.
2019-07-23 15:00:54 -07:00
Rishi Gupta 3ffc174dcb settings: Update description for unread count setting. 2019-07-22 20:37:19 -07:00
Anders Kaseorg f54a63e2f9 webpack: Transpile JS code with Babel.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-07-22 17:55:32 -07:00
Anders Kaseorg ecfb7c6a7f lint: Add TypeScript compiler as a linter.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-07-22 17:55:18 -07:00
Cynthia Lin 8c55e27d1e night mode: Fix loss of border color on default style buttons. 2019-07-22 17:28:38 -07:00
Cynthia Lin e37f529e6a portico: Add and use .button class for links requiring button styling.
Buttons cannot be nested in anchor links because that is invalid HTML.
To make links look like buttons, create a .button class that inherits
styling from buttons and apply them to the necessary links.

Fixes #6126.
2019-07-22 17:28:38 -07:00
Priyank Patel e69c2f1aa2 notifications: Send message received from desktop app notification reply.
Adds a electron_bridge event that takes in message id and reply recived from
the notification reply and sends a message. We do this in webapp so desktop
doesn't have to depend on narrow and channel modules.

We also modify zjunit to reset window.electron_bridge after every run
to avoid leaking it.
2019-07-22 17:20:44 -07:00
Tim Abbott 1b9a0367f2 settings: Fix indication for whether push notifications are enabled.
This was apparently broken in
981433d13c, which used an apparently
invalid partial syntax for doing lookups.
2019-07-22 16:14:13 -07:00
Anders Kaseorg 0310c3def4 css: Fix weird checkbox scrolling bug in Chrome.
This fixes a problem in Chrome where checking our styled checkboxes in
the stream creation form sometimes caused parts of the page to scroll
in weird ways or disappear.

The issue was that the hidden `position: absolute` checkboxes weren’t
scrolling with the `#stream-creation` scrollbar, which is `overflow:
auto`, not SimpleBar.  When you focused them, Chrome tried to scroll
them into view by whatever means necessary.  In this case, the
necessary means were to scroll the `.subscriptions-container`, which
is `overflow: hidden`.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-07-22 10:56:19 -07:00
Harshit Bansal bf14a0af4d auth: Migrate google auth to python-social-auth.
This replaces the two custom Google authentication backends originally
written in 2012 with using the shared python-social-auth codebase that
we already use for the GitHub authentication backend.  These are:

* GoogleMobileOauth2Backend, the ancient code path for mobile
  authentication last used by the EOL original Zulip Android app.

* The `finish_google_oauth2` code path in zerver/views/auth.py, which
  was the webapp (and modern mobile app) Google authentication code
  path.

This change doesn't fix any known bugs; its main benefit is that we
get to remove hundreds of lines of security-sensitive semi-duplicated
code, replacing it with a widely trusted, high quality third-party
library.
2019-07-21 20:51:34 -07:00
Rohitt Vashishtha 5fc37c5f9b compose: Add compose typeahead for stream+topic mentions.
We implement 3 changes:

1. Partial Stream Typeahead

   In addition to regular stream completion, we do partial completion
   of stream typeahead on pressing '>'. We use our custom addition to
   typeahead.js: this.trigger_selection to start topic_list typeahead.

   Implements: `#stream na|` (press >) => `#**stream name>|`.

2. Topic Jump Typeahead

   'topic_jump' typeahead moves the cursor from just ahead of a
   completed stream-mention to just after the end of the mention
   text and is triggered by typing '>' after the stream mention.
   This typeahead merely uses the regex matching and event hooks of
   the typeahead library instead of displaying any text completions.

   Implements: `#**stream name** >|` => `#**stream name>|`.

3. Topic List Typeahead

   'topic_list' typeahead shows the list of recent topics of a stream
   and if your current text doesn't match one of them, also shows you
   the current query text, allowing you to create mentions for topics
   that do not exist yet.

   Implements: `#**stream name>someth|` => `#**stream name>something** |`.

At the end of this commit, we support the following mechanisms to
complete the stream-topic mention:

1. Type "#denmar|".
2. Press Enter to get "#**Denmark** |".
3. Press > to get "#**Denmark>|".
4. Type topic name and press enter.

OR

1. Type "#denmar|".
2. Type > to get "#**Denmark>|".
3. Type topic name and press enter.

Both result in the final inserted syntax: "#**Denmark>topic name**".

Documentation is still pending.

Fixes #4836.
2019-07-21 20:38:17 -07:00
Rohitt Vashishtha 83cbd62ba1 typeahead: Support custom selection triggers in bootstrap typeahead.
We add support for triggering typeahead_completion on custom keyup events
in addition to Tab and Enter. The function `this.trigger_selection` takes
the keyup event as its argument and has the same `this` context as the other
typeahead functions.

This is being added to support partial completion of stream typeahead to
directly start the topic_list typeahead.
2019-07-21 20:18:48 -07:00
Rohitt Vashishtha 63e200997d typeahead: Support automatic selection in bootstrap typeahead.
We add support for automatically selecting the currently highlighted
option in a typeahead without rendering the typeahead or the user
pressing 'enter'. The function `this.automated` can use available
data such as this.completing and this.token to determine if we should
automate selection or not.

This is being added to support the topic_jump mechanism.
2019-07-21 20:18:48 -07:00
Rohitt Vashishtha 5e6493d36e compose_state: Maybe update stream name on stream name change.
If we rename a stream that we are composing to, we now change the
stream name in the compose target as well.
2019-07-21 20:18:29 -07:00
Rohitt Vashishtha 3f03ae66f0 compose: Ensure valid destination stream in typeahead completion.
If we complete a typeahead with an invalid stream name in composebox,
we would get 'compose_stream is undefined' error while running the
checks to prevent accidentally mentioning private streams.

We can safely early-return from this function and let the 'send'
event handler show the error to the user.
2019-07-21 20:18:29 -07:00
Rohitt Vashishtha 5d20c4b8fb typeahead: Clear rendered stream html on stream rename.
Previously, after a stream name, you could search for it using its
new name but the typeahead would still display the old name.
2019-07-21 20:18:29 -07:00
YashRE42 0fa90162f9 buddy_list: Do not fade current user in PMs.
Fixes a bug where we would fade out our own name because it wasn't in
selected as a recipient in the compose box, when making a PM.
2019-07-21 15:06:10 -07:00
YashRE42 9f5fca5579 notifications: Refactor and test notifiable unreads logic.
In this refactor, we extract two functions in unread.js.  Which one to
use depends on whether res has already been fetched or not.

This also adds node tests to maintain coverage of unread.js.

Tweaked by tabbott for cleaner variable names and tests.
2019-07-21 14:56:42 -07:00
Rishi Gupta 7d8d0b2284 settings: Update upgrade text and styling.
When we add Plus, the first sentence should change to "Available on Zulip
Standard and Plus".

I copied the styling of .tip out of expediency, but it's also possible that
long term we'll want only 1 tip-like box styling.

The hover styling is a bit random, but I tried to copy other hover styles I
found in settings.scss.

Note that this renames .upgrade_realm_plan_type_suggestion to .upgrade-tip.
2019-07-21 14:32:36 -07:00
Rishi Gupta a93045c12d message view: Add keyboard shortcut to title for [More...]. 2019-07-20 14:39:15 -07:00
Rohitt Vashishtha 9d6727d18c echo: Update topic_links when we get messages back from server. (#12832) 2019-07-20 14:38:52 -07:00
Cynthia Lin bbdf00e6e5 night mode: Improve coloring of .new-style buttons.
Border and text color applied by specific classes such as sea-green
were nullified by the previous selector; this commit restores the coloring
for these buttons.
2019-07-19 13:27:37 -07:00
Cynthia Lin fd7cf53190 templates: Eliminate anchor links with nested buttons.
Given that all links are now modals triggered by JS, the anchor links are
just invalid HTML that have no purpose. This commit refactors the HTML to
eliminate them by adding the Bootstrap-native btn-link class to maintain
styling. Fixes part of #6126.
2019-07-19 13:27:37 -07:00
vinitS101 fe2ec995b6 message_view: Add js tooltip hovers for emoji reactions.
This removes HTML title hovers for emoji reaction buttons below messages
and replaces them with js tooltips.

Fixes #8679.
2019-07-19 12:45:44 -07:00
vinitS101 278ccc559b message_view: Add a js tooltip hover for reaction button.
This change removes the html title for the reaction button
and replaces it with a JS Tooltip with the same title text.
2019-07-19 12:45:44 -07:00
Vinit Singh 86073588be dependencies: Upgrade jquery-autosize 1.17.7 to autosize 4.0.2.
The API for the autosize library changed upstream, so several changes
had to be made to relevant js files for a successful upgrade.

Resolves #12695.
2019-07-18 14:33:16 -07:00
Tim Abbott 500b161aab unread: Enable the load_server_counts setting for everyone.
This change is long overdue.  After implementing this much more robust
system and deploying it on chat.zulip.org, we hesitated to make
load_server_counts the default behavior in master, because of data
anomalies present for many existing users (basically messages far back
in their history that they had never read, on streams they believed
themselves caught up on), which would have been confusing for many
users.

However, because the mobile apps have been using this data set for a
long time, we've likely cleared out the anomalies from active users'
data set.  And for older users, they're going to come back to
approximately infinite unread messages anyway, so the data anomalies
are unlikely to be important.

Fixes #7096.
2019-07-18 13:34:55 -07:00
Anders Kaseorg c4fee086a6 css: Restore keyboard accessibility to styled checkboxes. 2019-07-18 12:19:48 -07:00
Anders Kaseorg ab89f40a66 generate-custom-icon-webfont: Replace with webpack webfonts-loader.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-07-18 12:00:00 -07:00
Cynthia Lin 7bb5162fc7 portico: Refactor button selectors to use SCSS nesting. 2019-07-18 11:54:30 -07:00
Cynthia Lin 0f44608974 portico: Reorder button selectors in preparation for SCSS nesting. 2019-07-18 11:54:30 -07:00
Cynthia Lin 7c1b6aa5a8 portico: Remove style selector for superflous button.grey-transparent.
There is no element with the .grey-transparent class in the current
codebase, so it is likely legacy and thus unnecessary.
2019-07-18 11:54:30 -07:00
Vaibhav ba2d609e6a css: Nest `.subscriptions-header` inside `.subscriptions-container`. 2019-07-18 11:41:18 -07:00
Vaibhav d104935d69 css: Nest `.display-type` inside `.subscriptions-container .right`. 2019-07-18 11:41:18 -07:00
Vaibhav bafcad8ef3 css: Use SCSS nesting for `.subscriptions-container`. 2019-07-18 11:41:18 -07:00
Vaibhav ef64f33808 css: Reorder subscriptions.scss so .subscriptons-container is in same place. 2019-07-18 11:41:18 -07:00
Vaibhav 3c0f447f1a css: Use SCSS nesting for `.subscriptions-header`. 2019-07-18 11:41:18 -07:00
Vaibhav 279b52ac82 css: Reorder subscriptions.scss so .subscriptions-header is in same place. 2019-07-18 11:41:18 -07:00
Mohit Gupta 648a60baf6 narrow: Add condition whether to show unread message first in narrow.
All narrows that have is: query or can mark unread message as read
will show unread message first.
2019-07-17 17:58:20 -07:00
Mohit Gupta 6ec40cf9a0 search: Don't mark messages as read in search narrow.
Don't mark unread messages as read while searching.
This behavior will be extended to other narrows later.

Fixes: #12556.
2019-07-17 17:58:20 -07:00
YashRE42 7867830e14 settings: Adjust styling of ? icons. 2019-07-17 17:47:08 -07:00
Priyank Patel ea2e7ccf27 message_fetch: Use user ID for sender and group-pm-with operator. 2019-07-17 16:09:12 -07:00
Alexandra Ciobica 28ebe3e6ba css: Refactor topic edit buttons to use scss nesting. 2019-07-17 22:30:39 +03:00
Alexandra Ciobica 117e1e05ea css: Clean up styling of topic edit buttons.
Related to: #11233.
2019-07-17 22:20:52 +03:00
Archit Kaushik e8eaa19ae4 topic edit: Improve styling of topic edit icons (save and cancel).
The earlier styles were inconsistent with the rest of UI.
The new styles follow the colour scheme.

Fixes #10983
2019-07-17 22:20:52 +03:00
Tim Abbott d2f1c84001 settings: Rewrite logic for whether users can change name.
This moves this somewhat complicated, duplicated logic into a single
JavaScript function.
2019-07-16 11:43:57 -07:00
Cynthia Lin 8b538d8b8d user settings: Prevent linkifying trailing whitespace in change name button.
When user name changes are disabled and the disabled name change info icon
shows, trailing whitespace gets linkified because of the link's
inline-block property. Use Handlebars whitespace omission syntax to
eliminate this behavior.
2019-07-16 11:43:57 -07:00
Cynthia Lin 50cab76c59 user settings: Hide disabled name change info icon for admins.
This icon should only show when the user is not an admin and either the
realm or server settings have disabled name changes. Previously the icon
always showed for admin users.
2019-07-16 11:43:57 -07:00
Cynthia Lin 63c85da4db right sidebar: Use flexbox positioning for elements in USERS header.
Eliminate fixed positioning for better alignment.
2019-07-16 11:33:02 -07:00
Cynthia Lin a65007dde4 right sidebar: Ensure .user-with-count gets added to correct li element.
The count_span element is parented by a .selectable_sidebar_block element
which is parented by the li element that the class is supposed to be added
to. Thus, use the parents() jQuery method for locating the li parent so
that the class gets added to the correct element.
2019-07-16 11:33:02 -07:00
Cynthia Lin 94bbc32a92 user settings: Improve visibility of delete profile picture icon in light mode. 2019-07-15 13:49:00 -07:00
Cynthia Lin ec4c996361 user settings: Darken area outside of non-square profile avatars on hover. 2019-07-15 13:49:00 -07:00
David Wood 9bace3f2cd notifications: Allow only notifiable in unread count.
This commit adds a new setting to the user's notification settings that
will change the behaviour of the unread count in the title bar and
desktop application.

When enabled, the title bar will show the count of unread private messages
and mentions. When disabled, the title bar will act as before, showing
the total number of unread messages.

Fixes #1736.
2019-07-13 15:49:04 -07:00
Tim Abbott ca23740478 condense: Rewrite condense.toggle_collapse to be readable and correct.
The proposed fix in #11662 was effectively a workaround for some
already bad logic.  What we actually want to do is described in the
updated function comment (from the spec in #5914), and requires an
additionl case that was not present in the original implementation
(which effectively assumed a collapsed message was condensible).

Also add some documentation.

Fixes #11662.
2019-07-13 15:45:00 -07:00
Priyank Patel 73b19672c3 message_fetch: Use user IDs for supported operators.
The approach taken here is basically use user IDs in operator that
support it when sending the request for fetching the messages
(see comments in code for more details).
2019-07-13 11:35:37 -07:00
vsvipul e830853aee desktop-presence: Use system presence data from electron-bridge.
Combined with work in the desktop app, this makes it possible for the
desktop app to clearly indicate to other users whether the current
user is active on the system and thus would see a desktop
notification, not just whether they are active in the current Zulip
window.

Essentially rewritten by tabbott to add unit tests and consider the
desktop app data authoritative.
2019-07-13 11:21:22 -07:00
Anders Kaseorg adcfa68da8 templates: Remove partial helper.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-07-12 21:11:14 -07:00
Anders Kaseorg 0c565f50be templates: Use upstream Handlebars partials syntax.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-07-12 21:11:14 -07:00
Anders Kaseorg db0b33842c templates: Replace templates.render with require calls.
This removes an unnecessary layer of indirection and allows webpack to
catch filename mistakes.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-07-12 21:11:14 -07:00
Anders Kaseorg 3c3471b720 templates: Rename *.handlebars ↦ *.hbs and - ↦ _.
Tweaked by tabbott to avoid accidentally disabling the linter for
handlebars templates.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-07-12 21:11:03 -07:00
Cynthia Lin e5d0448505 user settings: Improve accessibility for new delete profile picture button. 2019-07-12 16:53:25 -07:00
Cynthia Lin ffaa0ee120 styles: Refactor #user-settings-avatar elements to use SCSS nesting feature. 2019-07-12 16:53:25 -07:00
Cynthia Lin 886deaf48d styles: Remove superflous .white-color class.
Class was only used in one location, rendering it unnecessary.
2019-07-12 16:53:25 -07:00
Cynthia Lin faa556ab5e user settings: Change delete profile picture button into a x icon.
Fixes part of #10255.
2019-07-12 16:53:25 -07:00
Cynthia Lin c4f510b724 styles: Refactor #user_presences li selectors to use SCSS nesting. 2019-07-12 16:34:06 -07:00
Cynthia Lin 2694dd7e24 styles: Reorder #user_presences li selectors for SCSS nesting. 2019-07-12 16:25:40 -07:00
Cynthia Lin ff2db8cf93 styles: Eliminiate duplicate selector for user/group PM circles. 2019-07-12 16:25:40 -07:00
Tim Abbott e8e420bbd9 markdown: Fix marked generation of unnecessarily absolute URLs.
The new versions should exactly match the HTML we generate in the
backend unit test suite.
2019-07-11 15:09:38 -07:00
Rohitt Vashishtha e68f90db9c topic-mention: Support updating old renders on stream rename. 2019-07-11 14:53:10 -07:00
Rohitt Vashishtha 3698cdcc58 topic-mention: Add Marked implementation as HandleStreamTopic. 2019-07-11 14:53:10 -07:00
Yashashvi Dave ff75c77f7a account settings: Replace logic with existing functions.
Replace settings api calls with existing function
`settings_ui.do_settings_change()`. This commit also
adds a ui element for save alert notificaiton.
2019-07-11 13:29:08 -07:00
Yashashvi Dave e2e7d288a5 user settings: Fix garbage full name in change-full-name modal.
We should set full name evertime we open the modal. Otherwise
it will show garbage value which user has entered before but
did not save.
2019-07-11 13:17:59 -07:00
Yashashvi Dave ecddc10272 user setting: Fix error message style in change user info modals.
This commit fixes style of error message in update-user-info
modals. Commit adds error message element in modal body and
fixes margin.
2019-07-11 13:17:42 -07:00
Yashashvi Dave da2b80c173 custom field: Make external-custom-field URL input wider. 2019-07-11 12:52:21 -07:00
Yashashvi Dave 27ead227c0 custom fields: Add separate alert-save widget for create field.
Add separate alert-notification widget for create-custom-field
in admin view.

Fixes part of #12748
2019-07-11 12:52:21 -07:00
Vaibhav 81a7467441 css: Nest `.subscriber-list` inside `.subscriber_list_container`. 2019-07-11 12:23:42 -07:00
Vaibhav 52027af52a css: Nest `.subscriber_list_container` inside `.subscriber-list-box`. 2019-07-11 12:23:42 -07:00
Vaibhav 57aedf0a46 css: Use SCSS nesting for `.subscriber_list_container`. 2019-07-11 12:23:42 -07:00
Vaibhav f27031925a css: Use SCSS nesting for `.subscriber-list`. 2019-07-11 12:23:42 -07:00
Vaibhav 39f6d0a71b css: Reorder subscriptions.scss so `.subscriber-list` are in same place. 2019-07-11 12:23:42 -07:00
Tim Abbott 4aeb399315 apps: Fix buggy toggling with version_info.show_instructions.
We were doing the seemingly innocent
.toggle(version_info.show_instructions) to show the instructions if
and only if show_instructions was true.  However, our data structures
that should have been false didn't set a value, and `.toggle` with no
arguments just flips the state, rather than unconditionally hiding.
2019-07-11 11:48:24 -07:00
Rishi Gupta 8b729cc5fb portico: Add links from /features to /help.
I left out the top section ("Beautiful messaging") because the styling would
have to be different.
2019-07-10 17:39:27 -07:00
Yashashvi Dave a8bdbcab04 settings: Fix bug setting-save-alert-notification don't fade out.
Fix but by fixing parameters passed to function.
2019-07-10 14:41:26 -07:00
Rohitt Vashishtha f507a1a1d9 portico: Remove scroll-to attribute support.
This feature was added in 3b55519b11
without any uses of it in the markup, and we do not appear to use
scroll-to anywhere in our portico pages.
2019-07-10 13:12:07 -07:00
Rohitt Vashishtha d649dce468 portico: Remove event handler on anchor tags.
We added custom event handlers on anchor tags to show transitions
when switching between pages, a behaviour we have since removes in
commit a0dacea811.

Our approach didn't respect the target attribute for links and other
defaults that browsers offer with links.

We can now safely remove the event handler and restore the default
behavior of anchor tags.
2019-07-10 13:12:00 -07:00