Commit Graph

7113 Commits

Author SHA1 Message Date
Aditya Bansal 98cab354bd integrations: Fix buggy behaviour around categories dropdown.
What is the buggy behaviour?
Before this commit if you were to open the integrations docs page
in a smaller window so that the integrations categories sidebar
changed into a dropdown (so that our page is responsive to
screen size), one would notice that selecting a category from the
dropdown menu didn't make dropdown to auto collapse. This feels very
uncomfortable from users prespective since an ugly dropdown with all
the categories sticking around uncollapsed kind of defeats the purpose
of having a dropdown.

Fix: We make the categories dropdown toggle/auto collapse upon
selection of a category.
2018-12-03 17:21:17 -08:00
psg0796 90def916bc left-sidebar: Match line spacing of user list on left sidebar.
Vertically aligned presence indicator with names on left sidebar.

Fixes: #10554
2018-12-03 17:03:37 -08:00
Shubham Padia b961093c14 search: Open typeahead on empty string only if lookup triggered by Tab.
Fixes part of #10026.
Adds additional option to typeahead:
`tabOpensEmptyTypeahead`(default: false):
tabOpensEmptyTypeahead overrides helpOnEmptyStrings.
This commit sets helpOnEmptyStrings to false and
tabOpensEmptyTypeahead to true. Now typeahead will
open on an empty string only if Tab has been pressed.
2018-12-03 16:54:38 -08:00
Shubham Padia 0e2c509a24 typeahead: Tab opens typeahead if not open with a non-empty input.
Fixes part of #10026.
NOTE: The Tab key will select option from typeahead if the typeahead
is already open i.e the same behaviour as Enter.
NOTE: This behaviour applies irrespective of search pills are enabled
or not.
2018-12-03 16:54:38 -08:00
dipu989 524ef509fe user settings: Fix download zuliprc button styling. 2018-12-03 16:30:58 -08:00
Scott Lee e542ff0e62 css: Clean up spacing in the "your bots" cards.
These cards somehow ended up a bit malformed, with uneven spacing
between widgets and the icons hanging below the avatar.
2018-12-03 16:18:47 -08:00
Tim Abbott 333b8ef668 signup: Move registration JS to signup.js.
Also, fix a linter error encountered in the process.
2018-12-03 12:22:59 -08:00
Steve Howell 779ed37cfa hashchange: Fix update_browser_history() call for settings.
Even prior to my recent change in settings_panel_menu.js,
we were assigning window.location.hash a value that doesn't
have a '#' prefix.  This probably doesn't matter too much
for the browser, but it does confuse our own checks about
whether we're redundantly updating browser history.

Now we prefix the settings hash with '#' and we encorce
this convention with a blueslip error.
2018-12-03 10:09:35 -08:00
Steve Howell 05be16e051 hashchange: Remove is_exit_overlay code.
Just calling update_browser_history is sufficient
here, and we end up short-circuiting some code
in hashchanged():

    * we don't need to set state.old_hash, because
      that's what update_browser_history does
    * we bypass the is_overlay_check, which is always
      false in this context
2018-12-03 10:09:35 -08:00
Marco Burstein 307799113e right sidebar: Fix night-mode presence styling.
Fix the background color of night-mode presence indicators by setting
the background color to transparent instead of white when inactive.

Fix #10932.
2018-12-02 19:14:40 -08:00
Steve Howell c8cbf39a16 Avoid fake clicks when launching settings pages.
Fake clicks sometimes require more code, and they're
brittle to selectors changing, and it's harder to
debug.
2018-12-02 19:07:24 -08:00
Steve Howell c4d3578de3 Move more code into activate_section().
This code was added to the click handler, but it can
really go into activate_section().  This way the code
also runs when we first launch settings.
2018-12-02 19:07:24 -08:00
Steve Howell 473f2650fd refactor: Change settings_panel_menu.activate_section().
We now have activate_section take a section, rather than
an li, so it will be easier to call directly.
2018-12-02 19:07:24 -08:00
Steve Howell ec3f6434a6 subs: Remove complicated onlaunch triggers.
We can reliably just use hashchange.go_to_location()
when you click on "Stream Settings" in the left
sidebar popover.
2018-12-02 19:07:24 -08:00
Steve Howell 623e3f3c9f hashchange: Extract hash_util.stream_edit_uri. 2018-12-02 19:07:19 -08:00
Steve Howell bc18eb1d41 stream links: Use more standard API to go to location.
For stream links inside messages (like "#social") we
now use these functions:

    hashchange.go_to_location:

        We don't need to set href.  Relative paths
        are more standard, and the url is already
        encoded.

    hash_util.by_stream_uri:

        This saves a step in building the URL.
2018-12-02 19:07:19 -08:00
Steve Howell 846dfb2fe4 hashchange: Extract hashchange.go_to_location().
We use this API when we want the machinery
of the hashchanged system to come into play.
2018-12-02 19:07:15 -08:00
Steve Howell 636e54389b settings: Streamline code for navigating panels.
We call hashchanged.update_browser_history() when
we switch panels.  This API short circuits the
hashchanged callback and avoids code churn.

(We weren't actually double rendering, as the downstream
code does nothing at this point, so this is more
just preventig a pitfall and moving to a consistent
API.)
2018-12-02 19:07:15 -08:00
Steve Howell f930502312 stream settings: Streamline up/down arrow code.
We can eliminate export_hash() and just directly
call switch_to_stream_row().
2018-12-02 19:07:15 -08:00
Steve Howell b4d5c7e68a hashchange: Avoid double-rendering Subscribed/All tabs.
Before this commit, we would sometimes have
the toggler handle clicking or arrowing to
the All tab, but then also rewrite the hash
which caused us to re-process the event.

Now we only call update_browser_history()
in the callback handler from the toggle widget.

There's a bit of refactoring to make this happen,
but the call stacks end up being this:

    call toggler.goto(...)
        # callback is dispatched
            call subs.switch_stream_tab
                actually_filter_streams
                update_browser_history
2018-12-02 19:07:13 -08:00
Steve Howell 45227e84fc refactor: Flatten code in subs.change_state(). 2018-12-02 19:07:13 -08:00
Steve Howell 84d0b541e3 hashchange: Add hashchange.update_browser_history().
This helps us encapsulate the situation where we don't
want to trigger hashchanged(), without having to do it
within sub.js with prevent_once().
2018-12-02 19:07:10 -08:00
Steve Howell 212ee015d4 refactor: Extract subs.switch_to_stream_row. 2018-12-02 18:40:00 -08:00
Steve Howell bea328b8b6 refactor: Split out functions for opening edit panel.
While they can share some code, opening the edit panel
for a stream and clearing the panel are pretty different
actions, so we simplify the API for each thing.

You no longer have to pass in booleans, and for the clear
case, you don't have to pass in a bogus node that just
gets ignored.
2018-12-02 18:40:00 -08:00
Steve Howell 43f25eb4a5 Clean up code to open "Create stream" panel.
This fixes a bug where hitting the "n" hotkey was
causing double work related to the hashchange system.

The code is now organized like this:

    do_open_create_stream() does the GUI piece

    We call the above directly for hash changes.

    For in-app actions, whether clicks or hotkeys,
    we call open_create_stream(), which delegates
    most of the work to do_open_create_stream() but
    also updates the hash.
2018-12-02 18:40:00 -08:00
Steve Howell 13af91869d Deprecate unreachable code in hashchange.
The overlay URLs are never handled in this function,
and the prior code just created confusion.
2018-12-02 18:40:00 -08:00
Steve Howell 7859a441ac bug fix: Avoid spurious calls to subs.change_state.
This diff looks a bit more complicated than it really is.

We had a bug where we'd call subs.change_state for
non-streams-related changes.  The bug probably barely
impacted customers, since it's hard to get into that
situation unless you're in "Settings", and then the
code mostly did nothing.  There's still a deeper issue
of what we actually do want to for settings changes,
but this fix does not address that.

We invert the conditionals related to internal state
changes, so that we can handle internal state changes.

And we make sure to only call subs.change_state if our
"base" is "streams".
2018-12-02 18:40:00 -08:00
Steve Howell b80de69932 hashchange: Rename `ignore` to `state`. 2018-12-02 18:40:00 -08:00
Steve Howell 4b6ae10fb7 Rename group to old_overlay_group. 2018-12-02 18:40:00 -08:00
Steve Howell d11d1313d9 refactor: Flatten code for hashchanged().
Using early-exit make the 3 cases a bit more clear.

    opening overlay
    closing overlay
    "normal"
2018-12-02 18:40:00 -08:00
Steve Howell 1f41a65c88 Rename ignore.flag to is_exiting_overlay. 2018-12-02 18:40:00 -08:00
Steve Howell cee29483cf hashchange: Extract hashchanged_overlay().
This is mostly extracting the code within the `if`
block, as well as setting `base`, which wasn't used
elsewhere.

Also, the `else` no longer calls `is_overlay_hash`,
which was a redundant check.
2018-12-02 18:40:00 -08:00
Steve Howell 20bbc375a5 Rename ignore.prev to ignore.hash_before_overlay. 2018-12-02 18:40:00 -08:00
Steve Howell 53e99c0a55 hashchange: Remove unused ignore.last. 2018-12-02 18:40:00 -08:00
Steve Howell 682235af80 Rename hashchange.should_ignore to is_overlay_hash. 2018-12-02 18:40:00 -08:00
Rishi Gupta c59da02936 billing: Reflect discounts on /upgrade. 2018-11-30 11:19:07 -08:00
Rishi Gupta 1ba037201c billing: Move all price computations into billing.js. 2018-11-30 11:19:07 -08:00
Rishi Gupta 7523282e48 billing: Move cost calculation from upgrade.html to billing.js. 2018-11-30 11:19:07 -08:00
Rishi Gupta 60d3c17b6b billing: Enable tab navigation on /upgrade. 2018-11-30 11:19:07 -08:00
Steve Howell b827efb461 refactor: Extract maybe_reset_right_panel(). 2018-11-29 20:09:24 -08:00
Steve Howell c5b2cfd777 refactor: Extract get_search_params(). 2018-11-29 20:09:24 -08:00
Steve Howell 8f915da2ca refactor: Extract add_tooltips_to_left_panel(). 2018-11-29 20:09:24 -08:00
Steve Howell 3190c3ffeb refactor: Extract show_active_stream_in_left_panel(). 2018-11-29 20:09:24 -08:00
Tim Abbott d0f71881f4 docs: Add detailed documentation on the process for sending messages.
This has long been something missing from our suite of documentation.
2018-11-29 16:25:35 -08:00
Steve Howell d8c8fc1f03 streams: Optimize stream_data.create_sub_from_server_data.
This is definitely a micro-optimization, but avoiding
creating an extra object speeds up page loads by about
20ms per 1000 streams.

It's slightly sketchy to mutate the value in place, but
the original value never gets used again.
2018-11-29 13:29:17 -08:00
Tim Abbott 6781345b9b message_fetch: Fix a linter error introduced on rebase. 2018-11-29 13:29:12 -08:00
Steve Howell ba243416e3 stream_color: Make stream color assignment more efficient.
We now let color_data keep its own state for
unused_colors, so that we longer have to pass in
a large list of unused_colors every time we want
to assign a new stream color.

This mostly matters at startup, where we might
be cycling through 5000 streams.  We claim all
the unused colors up front.

Each operation now has an upper bound of expensiveness,
where the worst case scenario is basically popping
off the first element of a list of <= 24 colors.

The algorithm is now deterministic, too, to make
it easier to test.  It's unclear whether random color
assignment ever had much benefit, and it made unit
testing the algorithm difficult.  Now we have 100%
line coverage.

Fixes part of #10902.
2018-11-29 13:00:25 -08:00
Shubham Dhama 990d7fb37d narrow: Remove `narrow_activated.zulip` event trigger. 2018-11-29 12:36:00 -08:00
Shubham Dhama 654c3240e4 narrow: Remove `narrow_deactivated.zulip` event trigger. 2018-11-29 12:36:00 -08:00
Shubham Dhama 42f1d2a33b tab_bar: Make explicit call of narrow change handle function. 2018-11-29 12:36:00 -08:00
Shubham Dhama b726cd4b3e typing_events: Make explicit call of narrow change handle function. 2018-11-29 12:36:00 -08:00
Shubham Dhama e908da7831 narrow: Remove some `narrow_deactivated.zulip` event handling. 2018-11-29 12:36:00 -08:00
Shubham Dhama 209dd6dd37 narrow: Extract processes needed to be executed after narrow deactivate. 2018-11-29 12:36:00 -08:00
Tim Abbott 83b127cec1 server_events: Extract functions for managing connection errors.
This cuts a bit of code duplication.
2018-11-29 12:31:08 -08:00
Shubham Dhama 01927fb470 message view: Fix hiding of connection-error message on narrowing streams.
When there is some error in connecting to server(more specifically to the
tornado server) the "Unable to connect to Zulip" connection error message
gets cleared as Django server could send the response of "get" request of
old messages and hence get_old_messages_success hides the error message
even though the connection is not properly established.

Fixes: #5599.
2018-11-29 12:26:41 -08:00
Tim Abbott 02f09e2473 settings: Fix linter errors with user profiles. 2018-11-28 19:29:33 -08:00
Anders Kaseorg 8a6158c663 Position sidebars with top instead of margin-top.
This should make no visible changes.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2018-11-28 17:53:49 -08:00
Anders Kaseorg 10fb3539ae Position top-messages-logo statically.
This should make no visible changes.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2018-11-28 17:53:49 -08:00
Tim Abbott e39ebb7358 settings: Fix "Preview profile" button.
This was apparently broken in the refactoring in
a394778cde.
2018-11-28 16:46:15 -08:00
Yashashvi Dave fe3270d2b9 input pills: Fix modal gets closed when user click on remove-pill-btn.
This commit fixes bug: When user clicks on remove-user-pill-btn,
it closes the parent modal instead of removing user pill from input.
This happens because button has class `exit` and there is click
event listener on all `exit` class buttons, which closes modal.

Fix this by adding `e.stopPropogation` to remove-user-pill listener.
2018-11-28 16:33:08 -08:00
Yashashvi Dave 28c38a44c8 static/js/popover: Use predefine func to append user pills in field.
This commit remove repetitive code to append user pills in
custom field of user profile popover. And call already defined
function there.
2018-11-28 16:22:35 -08:00
Yashashvi Dave 20b6d08ef7 static/js/settings_account.js: Extract `append_custom_profile_fields`. 2018-11-28 16:22:35 -08:00
Yashashvi Dave b2aeffd947 static/js/settings_account.js: Extract `intialize_custom_user_type_fields`. 2018-11-28 16:22:35 -08:00
Yashashvi Dave cd8f4dfac0 statis/js/settings_account.js: Extract `initialize_custom_date_type_fields`. 2018-11-28 16:22:35 -08:00
Balaji2198 16967d6761 static/js/settings_streams.js: Refactor delete_default_stream method. 2018-11-28 16:17:21 -08:00
Nikhil Kumar Mishra 478674a6d6 analytics: Refactor to support more than one tooltip on same page.
While we don't actually need another tooltip on /stats right now, this
provides a clear approach for how to do that.  We've since added
tooltips in various other parts of the webapp, and that code is pretty
copy-pasteable, so I think it's reasonable to say this closes #4612.

Cleaned up by tabbott to remove a bunch of unnecessary changes.
2018-11-28 16:04:35 -08:00
Tim Abbott d28527b629 portico: Fix bulleted list styling on privacy page.
Fixes #10787.
2018-11-28 15:04:47 -08:00
Steve Howell 6035304619 Extract color_data.js.
This code is pretty distinct from all the color-picking UI,
and we want to get it to 100% coverage and optimize it
more.
2018-11-28 14:51:51 -08:00
Tim Abbott d8c5ad2a26 narrow: Add special text for conversation with yourself. 2018-11-28 11:59:16 -08:00
Abhinav Singh 0774bd7df0 portico: Fix password strength bar reset after form invalidation.
This code prevents the password bar from being incorrectly clear after
the sign up form is rendered again after invalid data is submitted
(generally due to forgetting to agree to ToS).

Fixes #10868.
2018-11-28 11:52:08 -08:00
butchyyyy 61c8247403 jenkins: Update integration doc with new plugin features. 2018-11-28 11:46:37 -08:00
Steve Howell b79d63e9c3 copy/paste: Try to fix Casper flake and add comments.
I think this will fix a Casper flake where there was a race
window with multiple temp DOM elements holding copied text.

I also add a comment to the code I think causes this race
for the tests.
2018-11-27 21:42:16 -08:00
Tim Abbott 65a9ee476c buddy list: Tweak styling for (you) marker. 2018-11-27 17:42:44 -08:00
Tim Abbott d9e8380981 copy: Add whitespace before timestamps in messages without sender.
This changes:

  Iago 4:11 PM
test not edited

4:11 PM
test edited

to this:

  Iago 4:11 PM
test not edited

  4:11 PM
test edited
2018-11-27 16:29:32 -08:00
Tim Abbott c43a00fd60 copy: Include EDITED notices in more copy-paste cases.
Previously, they were only included in messages that were the first in
their recipient block and were not /me (status) messages.
2018-11-27 16:24:04 -08:00
Tim Abbott 3ef0d6016c copy: Fix copy-pasting of EDITED notices in messages.
Previously, because the parens were added via CSS, copy-pasting the
EDITED notices resulted in junk like this:

 Iago 3:51 PMEDITED
edited message content

Now, you get:

 Iago 3:51 PM (EDITED)
edited message content
2018-11-27 16:20:46 -08:00
Tim Abbott e159f052bb status: Allow selecting status message text.
Status messages were incorrectly not selectable, due to a bug in how
we setup the no-select hierarchy (for making copy-paste not have weird
whitespace issues).

Fixes #10456.
2018-11-27 15:55:51 -08:00
Jeswin a5b533ba64 portico: Fix placement of "this field is required" notice.
The "This field is required" notice for the "organization URL" field
was improperly overlapping the server's root domain.

Fixes #10865.
2018-11-27 15:40:53 -08:00
Tim Abbott bddf23894d buddy list: Add marker for which user is yourself.
This helps make clear what's going on with the potentially confusing
"you" user.
2018-11-27 15:07:58 -08:00
Steve Howell 1890c30ee1 buddy list: Put "me" at the top of the list.
I think people will want this, particularly folks
with names toward the back of the alphabet.
2018-11-27 14:52:19 -08:00
Steve Howell 3aa490edbe Add current user back to the buddy list.
For many years we have been excluding the current user
from the buddy list, since their presence is kind
of implicit, and it saves a line of real estate.

This commit removes various user-is-me checks
and puts the user back for the following reasons:

    * explicit is better
    * newbies will be less confused when they
      can see they're actually online
    * even long-time users like myself will
      feel more comfortable if it's just there
    * having yourself in the buddy list facilitates
      things like checking your presence or sending
      yourself a message
    * showing "me" reinforces the meaning of the
      green circle (if my circle is green and I'm
      active, then others with green circles must
      be active too)
    * If you're literally the first user in the
      realm, you can now see what the buddy list
      looks like and try out the chevron menu.

The biggest tradeoff here is the opportunity cost.
For an org with more people than fit on the screen,
we put the Nth person below the fold to show "me".
I think that's fine--users can still scroll or
search.

This commit doesn't do anything special with the
current user in terms of sorting them higher in the
list or giving specific styling.

Fixes #10476
2018-11-27 14:52:19 -08:00
Steve Howell 731f76cea1 refactor: Have buddy_data.level() take user_id.
All the callers were having to call get_status().
We now do it for them.
2018-11-27 14:52:19 -08:00
Steve Howell 1e9d0718eb refactor: Flatten code in presence.set_info().
We reduce nesting of code by just early-exiting
for the `is_current_user` check.

This also forces us to be a bit more thorough
with our tests if we want to maintain line
coverage.
2018-11-27 14:52:19 -08:00
Rishi Gupta dd0126ff1b settings: Improve error message when deactivating the last user.
This PR was originally started by Rishi Gupta (see #10383).
2018-11-27 12:49:43 -08:00
Vishnu Ks 189e5e1fbd billing: Add frontend for upgrading by invoice. 2018-11-24 11:56:13 -08:00
Steve Howell 68d81cb25b subject -> topic: Fix respond_to_message(). 2018-11-16 11:11:40 -08:00
Steve Howell 82b9f2a3db subject -> topic: Fix create_message_object(). 2018-11-16 11:11:40 -08:00
Steve Howell 3e860fbc39 subject -> topic: Fix group.subject references. 2018-11-16 11:05:43 -08:00
Steve Howell 55362263dd Isolate/eliminate uses of "match_subject". 2018-11-16 11:05:43 -08:00
Steve Howell 89c278d1e5 Isolate/eliminate use of "subject_links".
For message groups, I just changed the internal name
to "topic_links".

For uses of "subject_links" that are tied to how the
server names fields, I introduced these wrappers:

    * util.set_topic_links(obj, topic_links)
    * util.get_topic_links(obj)

These can be used for either messages or events.
2018-11-16 11:05:43 -08:00
Yashashvi Dave 5759d5a762 statis/js/bot_data.js: Add `get_bot_owner_email` function. 2018-11-16 09:52:05 -08:00
Yashashvi Dave a394778cde statis/js/popover.js: Remove unused arg from `show_user_profile` func.
Remove unused argument `element` from function `show_user_profile`.
2018-11-16 09:52:05 -08:00
Nolan Darilek 5d291eb52c accessibility: Model messages as a list with items, each representing a single message.
Previously, messages were a string of disconnected regions. Modeling them as a list brings several benefits:
 * Quickly jump to the message list by using a screen reader's list navigation hotkey.
 * Quickly jump between messages by using a screen reader's list item navigation hotkey.
 * Quickly jump to the beginning or end of message lists in screen readers that support it.
2018-11-16 08:54:01 -08:00
Tim Abbott 86801d350a compose: Store raw_content after fetching it for quoting.
This is a nice performance optimization for the rare case where the
user does quote-and-reply on a message, aborts the compose, and then
re-does the quote-and-reply.
2018-11-14 23:55:26 -08:00
Marco Burstein f37e4df471 compose: Check if `raw_content` is present when quoting.
If `raw_content` is already present for the selected message, there is
no need to make a request to the server.
2018-11-14 23:52:08 -08:00
Steve Howell 6546fb3f1d subject -> topic: Fix local subject vars. 2018-11-14 23:24:06 -08:00
Steve Howell 51f8ac91ec subject -> topic: Rename current_subject. 2018-11-14 23:24:06 -08:00
Steve Howell a172ac264d subject -> topic: Rename by_stream_subject_uri. 2018-11-14 23:24:06 -08:00
Steve Howell b615f0df4d subject -> topic: Fix stream/subject in comments. 2018-11-14 23:24:06 -08:00
Steve Howell c6ad12d058 subject -> topic: Fix local vars in stream_list. 2018-11-14 23:24:06 -08:00