Commit Graph

7841 Commits

Author SHA1 Message Date
Natsu Kagami d936fcab3b markdown: Handle multiple python regex capture groups properly.
Since on replacing the first 'P<>' group, we remove this text from
the string, we have to make the RegExp start looking from index 0
again to properly convert later 'P<>' groups to JS regex syntax.
2019-02-12 15:54:28 -08:00
Steve Howell 96cbea3c11 bug fix: Move stream search out of scroll container.
We want the search widget, when visible, to be
outside the scroll container for the stream list.

One obvious use case is if you start scrolling, and
then realize it might be less effort to search.

Also, for user search, it already worked this way.

We have to add a couple resizing hooks here, but
it's not necessary to change the actual resize
calculation, since we move the section inside
of #streams_header, which is already accounted
for.

The only markup change here is to add
a `stream_search_section` class.  I don't
know why we use `notdisplayed` here instead of
jQuery, or what `input-append` is for, but I
considered them outside the scope of this change.

We can also remove some crufty CSS that was
compensating for it being inside the container.
2019-02-12 10:26:13 -08:00
Steve Howell 6fc45fd941 left sidebar: Disable "gray-out" feature for new users.
If a user has 30 subscribed streams or less, don't gray
them out if they haven't had recent activity.
2019-02-12 17:43:48 +00:00
Steve Howell 3a12b514f1 css: Remove Group PMs from **left** sidebar.
First, we are not removing Group PMs from the
right sidebar, where most people see it.

There is a setting called:

    [ ] User list in left sidebar in narrow windows

There are probably very few people that turn that on,
and even when they do, the setting only takes effect
when your window is less than a certain width.

This feature bitrots very quickly, because very few
core maintainers use it.

It's already kind of broken.  It gets very crowded,
and we get CSS bugs when we move the right sidebar
into the left sidebar.  (We can fix those bugs, but
they crop up unexpectedly due to the nature of CSS.)

We historically tried to maintain a ratio between
stream list, single-user buddy list, and group-user
buddy list, but the group-user buddy list gets
particularly crowded out, and it's basically useless
now.

We want to revisit the entire feature eventually, but
this commit at least gives the normal buddy list some
breathing room.

Also, if you need to see the info in the group PM
list, you can basically expand "Private Messages" to
see your recent group PM conversations.  And if you
want to see who's actually online, that info is
already implicit from the normal buddy list.
2019-02-11 19:17:52 -08:00
Steve Howell dc96b96359 minor: Group main-div related code together. 2019-02-11 19:14:46 -08:00
Steve Howell cd3aa46f34 left sidebar: Restore 15px in "split" mode.
If users have the option to put user lists in
the left sidebar for narrow windows, they will
now get 15px more of real estate in the left
sidebar.

I just removed the `-15` fudge factor.
2019-02-11 19:14:46 -08:00
Steve Howell d8f1b2e0bd right sidebar: Reclaim 8px of real estate.
We were double-counting the keyboard icon's
margin (8px) when figuring out how much room
we had for the two users lists.

Now we just use the safe outer height of
the anchor tag.
2019-02-11 19:12:51 -08:00
Steve Howell 5d8664d725 refactor: Add an explicit `user_search_section`.
This, among other things, makes it easier to
troubleshoot the resize code.
2019-02-11 19:12:51 -08:00
Steve Howell a921e7e894 minor: Remove unused intermediate variable.
Calculating everything relative to `viewport_height`
is easier to audit.
2019-02-11 19:12:51 -08:00
Tim Abbott e1832d890a css: Move conversation-partners styles to left-sidebar.css. 2019-02-11 19:12:20 -08:00
Steve Howell b10ef272f1 css: Simplify selector for conversation partners. 2019-02-11 17:47:54 -08:00
Steve Howell fd76b1b226 css: Limit scope of filter-icon css. 2019-02-11 17:47:54 -08:00
Steve Howell 5db26cb7fe css: Remove sidebar-title cruft.
This CSS seems to go back to when sidebar-titles
were links.  It's scoped at the wrong level, and
it seems to have no effect.
2019-02-11 17:47:54 -08:00
Steve Howell 350ed9fcaf css: Limit li padding/border to narrows_panel. 2019-02-11 17:47:54 -08:00
Steve Howell bd3b715cf2 css: Set hover only on narrows_panels. 2019-02-11 17:47:53 -08:00
Steve Howell 51925b03b7 css: Set margin for only narrow_panels.
We don't want this margin to affect every
single thing that goes in the left sidebar.
2019-02-11 17:43:54 -08:00
Steve Howell c4ac7f5b03 left sidebar: Clean up "split" list moves.
This change only impacts users who have the setting
to put the user lists in the left sidebar when they
have a narrow window.

First, we move ".right-sidebar-items" as an entire
group.

Second, we append the items to "#left-sidebar"
instead of ".narrows_panel".
2019-02-11 17:43:54 -08:00
Steve Howell 039daa2bfa refactor: Rename bottom_sidebar to narrows_panel.
The name `bottom_sidebar` was misleading, because it
includes the entire "normal" left sidebar.

It includes the 4 narrow links at the top plus the
stream/topic list.

We now call is narrows_panel.

Note that the left sidebar sometimes also includes
the user list (with a display setting turned on).

And it will eventually include other views.

We also remove an intermediate value in the resize
calculations.
2019-02-11 17:43:54 -08:00
Tim Abbott 523e651a10 i18n: Update translations data from Transifex. 2019-02-11 16:52:41 -08:00
Tim Abbott 40916803e7 floating_recipient_bar: Fix incorrect use of jQuery .next().
The semantic of jQuery's .next(selector) return nothing if the
selector doesn't match the next child.
2019-02-11 16:46:11 -08:00
Tim Abbott cbc2f495ff css: Fix night mode styling for mentions.
This was missed in developing
51c6c82003.
2019-02-11 16:11:47 -08:00
Tim Abbott 51c6c82003 message_list: Don't split message groups for a date divider.
This adds date dividers within a single message group when the only
reason we had previously been splitting apart two message groups is a
change of date.  The overall effect is a cleaner message list user
experience.

The downside of this change would be that the recipient bars no longer
will always show a new date for date changes; to fix that, we rewrite
how the floating recipient bars both set the date field on the
floating recipient bar itself, as well as ensure that non-floating
recipient bars don't show duplicate dates.

In a future design update where we modify how message recipient bars
look, we may very well be able to simplify this logic by removing some
of the dynamic nature of the recipient bar calculations.  But this is
a good implementation of what remains.

Tweaked significantly by tabbott from Steve Howell's original, both to
extract these changes from a larger PR as well as to modify the
first_visible_message logic to handle some tricky corner cases.

Fixes #10171.
2019-02-11 15:56:09 -08:00
Hemanth V. Alluri 77f24e2b56 click_handlers: Use stream desc. on edit instead of rendered desc.
On clicking the edit button for a stream description, the stream's
unrendered description should be made editable as text instead of
the stream's rendered description (which would be displayed as HTML
instead of text).

This completes the effort to use backend-rendered stream descriptions
here.  Fixes #11272.
2019-02-11 12:27:11 -08:00
Hemanth V. Alluri 683ec852fd stream_data: Use stream rendered_description provided by the backend.
Use the results of commit #73d26c8 to remove the method
`render_stream_description` in static/js/stream_data.js and instead
use the rendered_description attribute now being sent by the backend.

This will be a valuable optimization and a step towards removing the
need for the marked.js markdown parser and speeding up the client end.
2019-02-11 12:24:27 -08:00
Rishi Gupta c26e2ab178 help: Adjust CSS for headings.
This looks like it affects why-page as well, but in practice all those pages
seem to have CSS that overrides these values.
2019-02-11 12:05:19 -08:00
Rishi Gupta 0958345416 help: Remove styling from spurious <p></p> tags. 2019-02-11 12:05:19 -08:00
Rishi Gupta 83236dc283 help: Add tab styling to untabbed instructions as well.
This changes the border-radius to 6px for the tabbed display, which is not
in line with the current Zulip style for border-radius (4px). However 6px
really looks a lot better for this (possibly because it's a bigger box than
most of our other boxes?)
2019-02-11 12:05:19 -08:00
Rishi Gupta d6c80d1ce7 help: Restyle tabbed navigation boxes. 2019-02-11 12:05:19 -08:00
Amadeo234 7d42d7b4db message_edit: Fix message edit history breakdown on large messages.
The message_edit_history UI was incorrectly inheriting its content
div's structure from message_edit_content, i.e. the form for editing
message content, and not message_content, i.e. the class for rendering
the content of messages in the message feed (which we also use for
drafts).

Fix this by changing the inheritance, while also adding a (currently
unused) class for any future customizations.

Fixes: #5629.
2019-02-08 15:47:17 -08:00
Pragati Agrawal 3a374f5e68 typeahead: Add typeahead for silent mentions.
This adds typeaheads of the form _@ , _@* , _@** for silent mentions.

Fixes: #11426.
2019-02-08 15:40:01 -08:00
Pragati Agrawal d5a327f122 typeahead: Extract functions in `composebox_typeahead`.
This extract functions `get_mention_candidates_data` &
`filter_mention_name` to make code reusable and cleaner and further use
the logic in silent mention syntax.
2019-02-08 15:40:01 -08:00
Steve Howell 3649293d71 left sidebar: Add a bit of margin below stream list.
Having a tiny bit of margin below the stream list
makes it possible to see the bottom of the scrollbar.

It also makes it so that the scrollbar activates
for a tiny range of list sizes where before the
last element would have been right up against the
bottom of the page, but we wouldn't scroll.
2019-02-08 15:27:50 -08:00
Tim Abbott 925bf7b907 message_list: Move update_group_date_divider earlier.
We need to move the update_group_date_divider call to run when a
message group is created.  This achieves a few things:

* Fixes calling this multiple times useless for long message groups.
* It will soon no longer be correct to assume that every message
within a group has the same date, and in that case, we want to process
the date of the first message in the group, not of the last.
2019-02-08 14:54:40 -08:00
Tim Abbott 31e98b8b65 message_list: Remove extra calls to update_timestr.
We only generate message_containers in one place, and that code path
already calls update_timestr.  And update_timestr's effect only
depends on the message.  Thus, this code was useless.
2019-02-08 14:51:03 -08:00
Tim Abbott 7fd582025f message_list: Extract render_group_display_date. 2019-02-08 11:45:21 -08:00
Tim Abbott 0aa438e199 message_list: Rename update_group_time_display.
The name now reflects that this is about date dividers.
2019-02-08 11:30:58 -08:00
Tim Abbott 21a86f3ef7 message_list: Rename show_date_separator to show_group_date_divider. 2019-02-08 11:30:15 -08:00
Tim Abbott 0d66d3fafd message_list: Rename show_date to group_date_divider_html.
This is much more clear about what this actually means.
2019-02-08 11:26:24 -08:00
Tim Abbott 72bb3fb6c2 message_list: Extract clear_date_divider_html.
This also fixes the fact that the logic had swapped which object
should be undefined and which should be false.
2019-02-08 11:20:00 -08:00
Rishi Gupta fe28d0731e org settings: Move "allow message content in email" to different subsection. 2019-02-08 10:16:09 -08:00
Rishi Gupta 3a26daf911 org settings: Remove unnecessary titles from Organization settings. 2019-02-08 10:16:09 -08:00
Rishi Gupta 65f6bea7d7 org settings: Move video chat provider into other settings. 2019-02-08 10:16:09 -08:00
Rishi Gupta 16042ba15d org settings: Reorder the major sections of Organization settings. 2019-02-08 10:16:09 -08:00
Rishi Gupta 76488bd2fe settings: Remove button styling from role. 2019-02-08 10:16:09 -08:00
Abhinav Singh 849c296f90 popovers: Fix 'w' hotkey in narrow windows.
In small screen sizes, when the user presses shortcut `w` to search
for another user, the hide_all function calls in the search code path
would hide the right sidebar, immediately after opening it, making the
hotkey basically unusable.

We fix this by extracting a separate hide method that hides all true
popovers, but not the user list sidebar.

Fixes #11463.
2019-02-08 08:42:34 -08:00
Puneeth Chaganti b6cf14608d upload: Ensure correct textarea is focused when an upload finishes.
The `uploadFinished` code switches on the composing mode, if we aren't
in the composing mode already. This causes the focus to be incorrect
when this code path runs due to an upload from the message edit
box. This commit fixes that logic to turn on the composing mode or
switches focus to the message edit box, depending on where the upload
was triggered.
2019-02-08 07:45:41 -08:00
Steve Howell d7f9a21519 api docs: Move json-api-example css to portico.scss.
We didn't need to patch the third-party bootstrap code for this.
2019-02-08 07:42:32 -08:00
Vishnu Ks 6ed6bcef05 invites: Move multiuse invite status to footer. 2019-02-07 15:41:00 -08:00
Vishnu Ks b62bd83083 invites: Add generate multiuse invite button. 2019-02-07 15:41:00 -08:00
Steve Howell 0e65e74566 refactor: Make build_topic_popover() not rely on HTML.
Now all the markup-specific finding of elements just
happens in the click handler.
2019-02-07 15:19:55 -08:00
Steve Howell b5347c78b2 scrolling: Fix sidebar size calculation.
So the top navbar is above the left sidebar
on the z-axis, not the y-axis.

So it doesn't make sense to use the top
navbar in calculating the size of the left
sidebar.

It kind of coincidentally works, since these
two numbers are closely related:

    left sidebar top margin = 50
    navbar height = 40

Calculating `bottom_sidebar_height` correctly
decreases its value by 10.

And then the only value that depends on it
is `stream_filters_max_height`.  We were
subtracting out 10 there to make it work,
since `bottom_sidebar_height` was inaccurate
by +10.  Now that's fixed.

The comment there was inaccurate--the
`stream_filter` div actually has a bottom
margin of 22px.  The bottom margin does
have some consequences for scrolling,
but the main goal here is to make the
calculation return the same value but
be more accurate about what happens
toward the top of the screen.
2019-02-07 15:19:55 -08:00
Steve Howell e7ead7383d css: Add explicit padding below the navbar.
We have always intended to have 10px of whitespace
below the navbar, and this enforces it directly
and explicitly in the CSS.

Note that the three major panels still should
have a margin of 50px, which is equal to
the safe outer height of the header (40px + 10px).
2019-02-07 22:36:08 +00:00
Rishi Gupta 0f3125582b org settings: Reposition instructions for user groups, and hide from guests. 2019-02-07 11:46:09 -08:00
Rishi Gupta 9f2995a6f6 org settings: Reorder options under org permissions -> other permissions. 2019-02-07 11:46:09 -08:00
Rishi Gupta 9572c5ddb0 org settings: Update explanation for Default user settings. 2019-02-07 11:46:09 -08:00
Rishi Gupta abe67a3000 org settings: Reorder options in org settings -> message edit. 2019-02-07 11:46:09 -08:00
butchyyyy c1a47012fd jenkins: Update integration for new plugin release.
Fixes #11425.
2019-02-07 11:35:26 -08:00
Rishi Gupta aae9773f09 delete topic: Update wording in confirmation modal. 2019-02-06 22:16:24 -08:00
Steve Howell 3ef9d18baf top left: Add border to starred messages count.
The border makes the alignment look nicer.  Without
a border your eyes plays tricks on you and makes it
seem like numbers are not in the same column.

The border color is the same subtle color as the
backgrounds in others.

Because CSS is annoying, you have to tweak the padding
to make room for the border.

(It should look ok in night mode, too.)
2019-02-05 16:56:16 -08:00
Tim Abbott 32757b489b message_list: Move scroll-after-reply logic into rendering path.
Since the main autoscroll feature was implemeneted, the
maybe_advance_to_recently_sent_message logic had an unfortunate
structure, where the code for this potentially large scroll was
running AFTER the autoscroll decision was made, but before an actual
scroll could have occurred.

This resulted in code that was very difficult to reason about, as
there were 2 potential sources of scrolling when you send a new
message, with little connection between their implementations either
in location or implementation.

Moving this into the main autoscrolling code path clarifies the code,
with the added benefit of fixing a bug where we would report to the
user that they needed to scroll down when in fact we were just about
to scroll the bottom of the feed into view (via
maybe_advance_to_recently_sent_message).

With this change, we never display the "you need to scroll manually"
message in the cast that we just scrolled you there via selecting a
message.
2019-02-05 16:48:20 -08:00
Vaibhav a494244427 message edit: Rearrange order of control icons.
This arranges the control icons in similar order as that in compose
box.
2019-02-05 13:42:58 -08:00
Rishi Gupta a7a5188030 user status: Style status message in user popover. 2019-02-05 13:42:32 -08:00
Tim Abbott 309aef4c27 compose: Fix "You need to scroll" notifications for large messages.
When you just sent a large message, our logic for "you need to scroll"
notifications did not correctly take into account the height of the
compose box.  This was easily reproduced when sending very long
messages.  The correct solution requires a bit of math to compute what
the visible area will look like after the compose box is closed.

This should be the final fix to #11138.
2019-02-05 13:17:10 -08:00
Rishi Gupta 36472413e4 hotspots: Add hotspot for gear menu. 2019-02-05 12:19:21 -08:00
Vaibhav 61ebee6993 message edit: Add "preview" option to edit UI.
This add the "Preview" option to message edit controls similar to that in
compose UI.

Fixes #11438.
2019-02-05 11:35:30 -08:00
Vaibhav 24445309e2 compose: Extract `render_and_show_preview` function.
This adds a function that controls the whole process of applying
markdown and displaying the markdown rendering preview on request;
This is required to avoid code duplication when adding preview feature
to message-edit UI.
2019-02-05 11:31:56 -08:00
Vaibhav 5e4bd9f57d compose: Change preview_message_area and preview_content to classes.
Preview box is to be reused in message edit. ID does not remain the
same in message-edit section so the styles are changed to classes.
2019-02-05 11:28:13 -08:00
Vishnu Ks 5f0492b3b1 billing: Use this.value instead of .val().
This change is mostly for making testing easier.
2019-02-04 22:37:05 -08:00
Vishnu Ks ab97a84f3a billing: Use is_valid_input helper for checkValidity.
Mainly for making the node tests easier to write.
2019-02-04 22:37:05 -08:00
Vishnu Ks 7b22fec532 billing: User on(change) instead of change() in upgrade.js. 2019-02-04 22:37:05 -08:00
overide fd3be00fbd media: Fix sender name clipping in mobile.
In mobile devices, letters like g, y, p etc. in sender name were clipped from bottom.
Fixed by adding line height to sender name.

Fixes: #11445
2019-02-04 14:31:30 -08:00
Rohitt Vashishtha 19672241e6 markdown: Disable definition/reference links in marked.
We had disabled reference style links in bugdown, however,
we hadn't disabled them in marked. This commit rectifies
that and adds test cases for the same.

Fixes #11350.
2019-02-04 11:16:37 -08:00
Shubham Dhama afe2197210 invite: Add UI to generate multiuse invitation link.
Adds a very basic UI to generate the multiuse invitation link.
2019-02-02 23:05:47 -08:00
Shubham Dhama dee4e3fb89 ajax: Fix wrong ajax setting name from beforeSubmit to beforeSend.
The beforeSubmit function was a feature of the jquery-form plugin that
we removed months ago; the appropriate similar feature of jQuery's
built-in AJAX library is beforeSend.
2019-02-02 23:05:10 -08:00
Mohit Gupta 01d34a8575 compose: Use lightbox when clicking images in compose preview.
Fixes #11424.
2019-02-02 11:11:24 -08:00
Mohit Gupta 9ce6cc5097 lightbox: Extract arguments to payload as variables.
This extracts sender_full_name (and the existing $parent), which will
make life easier for using the lightbox for images outside the message
feed.
2019-02-02 11:09:22 -08:00
Abhinav Singh e7c8077abc edit: Add support for using video call link in message edit.
This code will correctly add video call link to the message
textarea based on whether 'Add video call' was selected from
message composition form or message edit form.

The implementation was semi-rewritten by tabbott to remove an
unnecessary global variable, with fixes for the unit tests from
showell.

Fixes #11188.
2019-02-02 11:03:31 -08:00
kunal-mohta ac55a5222c messages: Add support for quickly deleting all messages in a topic.
This is primarily a feature for onboarding, where an organization
administrator might send a bunch of random test messages as part of
joining, but then want a pristine organization when their users later
join.

But it can theoretically be used for other use cases (e.g. for
moderation or removing threads that are problematic in some way).

Tweaked by tabbott to handle corner cases with
is_history_public_to_subscribers.

Fixes #10912.
2019-02-01 17:09:44 -08:00
Shubham Dhama 5779320874 invites: Use stream_id instead of stream names in invitation.
This replaces the current usage of stream names with stream ids.

This commit also removes the `traditional` attribute from the invite
form as now we are sending stream_ids as an argument; this was the
only place in the codebase we used traditional=true, and it's great to
have it removed.
2019-02-01 15:47:20 -08:00
Shubham Dhama 8f680c3dac invite: Extract get_common_invitation_data.
This is a minor refactor to make this code reusable.
2019-02-01 15:39:58 -08:00
Shubham Dhama b4e2313cbc invite: Add stream_id stream data returned by get_invite_streams().
This is done by using `stream_data.get_invite_stream_data()` in place of
`stream_data.invite_streams()`.
2019-02-01 15:35:42 -08:00
Shubham Dhama fbd73ba637 stream_data: Add get_invite_stream_data helper function.
This function unlike `invite_streams()` returns an array of objects having
various info (name, stream_id, invite_only, default_stream) related to
streams rather than an array of names of streams.
2019-02-01 15:35:42 -08:00
Steve Howell 9ce5d51bdc user status: Fix tiny green dot in user popover.
We now compute the class that drives the tiny
green/orange/empty dot in the user popover using
the same logic as the buddy list.

This was broken in the early implementation of
set/clear-away, but it was never released.

Fixes #11413
2019-02-01 15:23:35 -08:00
Steve Howell 6375d72862 user status: Change icon for set/clear away. 2019-02-01 15:23:35 -08:00
Steve Howell 7f23b7fb98 user status: Fix wording in set-status modal. 2019-02-01 15:23:35 -08:00
Steve Howell 3e615fd8b0 user status: Fix wording in user popover. 2019-02-01 15:23:35 -08:00
Steve Howell ab8b50453b user status: Show status in user info popovers. 2019-02-01 15:23:35 -08:00
Vishnu Ks 150d9c9d3e stats: Fix the bug in showing all time actives by default.
Followup commit of 0b1e36db27
2019-02-01 11:14:03 -08:00
Abhinav Singh 07bac66db7 right sidebar: Hide user detail popover correctly.
This code will hide the user detail popover correctly
when the user wants to search other users.

Fixes #11362.
2019-01-31 11:58:24 -08:00
Steve Howell 4a56980bff starred messages: Change styling of count.
The count for "starred messages" is not a
true "unread" count.

We break out the CSS so that it's styled
differently from other elements.
2019-01-31 19:01:27 +00:00
ss62171 b7a0a45f01 people: Improve mentioning users with diacritics in their name.
This makes it possible to mention a user with a name like Gaël that
contains diacritics by typing e.g. "Gael", significantly reducing the
need to use a special keyboard to mention other users.

Fixes #11183.
2019-01-31 10:07:44 -08:00
Steve Howell a1a7047819 top left: Remove home-link markup in the main app.
The `home-link` markup wasn't used in the app,
and it was confusing, since we do use that
markup for the portico system.
2019-01-30 13:53:20 -08:00
Steve Howell 090227e809 tab bar: Remove unused markup.
The only time we set the `home` flag to true
is when it's the last (and only) item in the
list, in which case we flip `hash` to false
at the end of `make_tab_data()`.

So the section of code where both `home` and
`flag` were true is dead code.

Also, we can use `else` instead of `unless`.
2019-01-30 13:53:20 -08:00
Steve Howell 9986e41999 top left: Simplify markup for main links.
The following elements in the top left corner
are major components of our app:

    All messages
    Private messages
    Starred messages
    Mentions

We can now find them directly:

    $('.top_left_all_messages')
    $('.top_left_private_messages')
    $('.top_left_starred_messages')
    $('.top_left_mentions')

Before this, we had to build up complicated selectors
like below:

    exports.get_global_filter_li = function (filter_name) {
        var selector = "#global_filters li[data-name='"
            + filter_name + "']";
        return $(selector);
    };

I don't think any newbie would know to grep for "global_filter",
and I've seen a PR where somebody added specific markup here
to "Private messages" because they couldn't grok the old scheme.

Another thing to note is that we still have a "home-link"
class for "All messages", which overlapped with portico
code that had the same name.  (There were some inaccurate
comments in the code relating to the tab bar, but we don't
actually have a way to click to the home view in the tab
bar any more.)  I'll eliminate that cruft in another commit.

For this commit the four elements still have the
"global-filter" class, since there's some benefit to being
able to style them all as a group, although we should give
it a nicer name in a subsequent commit.

Most of this PR is basic search/replace, but I did add a
two-line helper: `top_left_corner.update_starred_count`
2019-01-30 13:53:20 -08:00
Rishi Gupta fa2b5df107 settings: Update tip strings for adding custom emoji. 2019-01-30 10:34:16 -08:00
Rishi Gupta 3f385cae38 invite: Rename guest users to guests. 2019-01-30 10:34:16 -08:00
Rishi Gupta 42deef8c57 portico: Add inspire-hep to /for/open-source. 2019-01-29 11:46:19 -08:00
Rishi Gupta 52a513b0a8 portico: Add infinispan to /for/open-source. 2019-01-29 11:46:19 -08:00
Rishi Gupta 03e12e1921 portico: Add mariadb to for/open-source. 2019-01-29 11:45:44 -08:00
Steve Howell a964977960 user status: Add ability to edit status text. 2019-01-29 10:27:49 -08:00
Rohitt Vashishtha a197959959 poll-widget: Downgrade key error to warning.
It is an error, but it is obnoxious in dev to get these.
2019-01-29 09:34:14 -08:00
Rohitt Vashishtha c176891c2e poll-widget: Refactor comment to option.
We had initially designed the poll widget like a blog
post with comments beneath it but it makes more sense
to think of it as just a simple poll with options.
2019-01-29 09:34:14 -08:00
Rohitt Vashishtha 5641afc6e2 poll-widget: Add syntax for adding options when creating poll.
We add a new syntax which converts the messages like the following:

```
/poll Who do you support?

Nadal
- Djokovic
```

to a poll with the two names as options. The list syntax is optional
since anyone making a poll is likely to want to create a list anyway.
2019-01-29 09:34:14 -08:00
Rishi Gupta 6a1017ea94 billing: Update text on /upgrade. 2019-01-29 06:30:19 -08:00
Adarsh Patel 9b740df277 api_docs: Specify max width for long code examples.
Fixes #10673.
2019-01-28 22:39:54 -03:30
ss62171 63702d50e6 poll widget: Fix duplicate options bug in poll.
This is a frontend-only change to make it difficult to accidentally
create duplicate options in the poll widget menu.
2019-01-26 15:48:28 -08:00
Vishnu Ks 5fec84221e stats: Make all time active users graph default.
We now bill by total users, whereas we used to
bill by 15 day actives.
2019-01-26 12:19:59 -08:00
Steve Howell 17c906d6bb user status: Surface status in the buddy list.
When you hover over a user that has set a user
status, we now show something like "out to lunch."

You can test this in the console by doing:

    user_status.server_update({status_text: 'out to lunch'})

And then hover over your name in the buddy list.
2019-01-25 16:53:51 -08:00
Steve Howell 49b16b5b01 activity: Rename function to redraw_user().
The name `insert_user_into_list` is sort of misleading,
since we are often just redrawing the user's existing
item in the buddy list.

I chose `redraw_user` over `update_user` to emphasize
that we're just going to redraw it with whatever data
has been updated by the callers.
2019-01-25 16:53:51 -08:00
kunal-mohta b89769420a stream_color: Extend subscribe API to support color attribute.
This fixes an annoying bug where clicking to subscribe to a stream
would change the color shown in the "manage streams" UI immediately
after you click.

Fixes #11072.
2019-01-25 16:44:59 -08:00
Vishnu Ks ce1db751d0 billing: Make tabs work with back forward buttons. 2019-01-25 16:40:46 -08:00
Vishnu Ks 537b7612cb billing: Remove hash when reloading upgrade page. 2019-01-25 16:40:46 -08:00
Pragati Agrawal 1e811b42ec org settings: Add realm level setting for missed message content in email.
This adds a setting under "Notification" section of
"Organization settings" tab, which enables Organization administrator to
control whether the missed message emails include the message content or
not.

Fixes: #11123.
2019-01-25 14:34:10 -08:00
Puneeth Chaganti 33a322baa2 paste: Hook up the paste handler to the message edit form.
This ensures that any nice pasting features we have in the compose box
also apply to message editing.
2019-01-25 11:40:33 -08:00
Puneeth Chaganti 9c377a05f3 paste: More robust check to verify if clipboard data is an image.
The commit f863a9b567 had modified
jquery.filedrop's paste method to exit early if any of the items in the
clipboardData is of the string kind. The early exit was added to prevent pasting
an image thumbnail for text copied from software like MS Word, instead of
pasting the actual copied text content. When copying an image in a (modern?)
Browser, though, the clipboard seems to contain a html `img` tag item, along
with the actual image file. This resulted in pastes being broken.

This commit modifies the condition checked for the early exit. We now actually
look at the html content in the clipboard to see if it is an `img` tag, in which
case we upload the image, instead of exiting early.

Closes #7130.
2019-01-25 11:40:33 -08:00
TharunThomas8 2ebd3f244d left sidebar: Fix scrollbar sticking up few pixels above container.
This is likely not the "right" fix in that it involved a negative
margin, but this does eliminate an annoying visual glitch where the
scrollbar overflows above its container in the left sidebar, without
creating other apparent problems.

Fixes #8731.
2019-01-25 11:17:06 -08:00
Mohit Gupta 42d886a6d5 messages: Add loading spinner for deleting messages.
User was able to click delete button multiple time which could cause
multiple delete requests. This commit disables and hides the delete
message button after the first click and shows a spinner until http
the delete request responds.

Also adds a casperjs test to ensure that spinner becomes visible and
delete button becomes invisible after clicking on delete button for
first time and hides spinner and show delete buttton when message is
deleted.

Fixes: #11219.
2019-01-25 11:07:02 -08:00
Steve Howell c172001f22 minor: Finish last fix.
See the prior commit.  I missed another info -> status_text
thing.
2019-01-25 07:55:37 -08:00
Steve Howell 45d07e8472 user status: Fix stray "info" reference.
This fixes a section of code that hasn't really
been turned on yet.  We decided to rename
"info" to "status_text", and I apparently missed
this.  We don't have any UI to set these yet,
so it was a harmless bug.

I'll try to get some better test coverage on this
when I tweak the buddy list to show user status.
2019-01-25 07:45:00 -08:00
Vaibhav 746870df65 stream settings: Hide creating admin-only streams in members UI.
This commit takes away the ability for non-admin members to create
streams where only admins can post messages by hiding the option from
them.

Fixes #11290.
2019-01-24 10:51:49 -08:00
Steve Howell 513d666ba1 user status: Add frontend data layer for "status_text".
This sets up the frontend to handle "status_text" data like
"out to lunch" or "in a meeting".
2019-01-24 09:46:35 -08:00
Steve Howell 0ef5d1f9c8 user status: Add "status_text" support in the backend.
You can now pass in an info field with a value
like "out to lunch" to the /users/me/status,
and the server will include that in its outbound
events.

The semantics here are that both "away" and
"status_text" have to have defined values in order
to cause changes.  You can omit the keys or
pass in None when values don't change.

The way you clear info is to pass the empty
string.

We also change page_params to have a dictionary
called "user_status" instead of a set of user
ids.  This requires a few small changes on the
frontend.  (We will add "status_text" support in
subsequent commits; the changes here just keep
the "away" feature working correctly.)
2019-01-24 09:46:35 -08:00
Steve Howell 01d9a3b02c quote/reply: Leave message intact for IE/Chrome.
We had a bug where if you started typing a message
and then used quote/reply (after the fact), we
would overwrite the user's original message.

The bug was kind of subtle--the internal call
to "respond" to the message would select the message
text, and then `smart_insert` would replace the
selection, unless it was Firefox.

Note that we now also allow you to cross-post
replies, which is a plausible scenario, although
possibly unintentional at times, too.  I'm erring
on the side of giving the user control here, but
I'll add a warning in the next commit.  Our compose
fade feature should also prevent unintentional
mixes here, too.
2019-01-23 10:57:40 -08:00
Steve Howell 664ee8d017 quote/reply: Dedup some logic with replace_content().
We often need to go to the server to get raw content.
The exceptions are messages for which we've already
fetched the raw content for some other reason (maybe
a previous quote-and-reply) or which are locally echoed.

Whether we can get the raw content locally or from
the server, the replace_content() logic is the same.
2019-01-23 10:57:40 -08:00
Vishnu Ks 8f3a0927c3 lint: Ban color names in CSS.
We already lint using HSL rather than RGB consistently.
2019-01-22 15:33:18 -08:00
Steve Howell 8aee6a1dd7 poll widget: Add some keyboard support.
We support enter/ESC for our input fields.

You still need to use the mouse to vote.
2019-01-22 10:27:39 -08:00
Steve Howell bacf896228 poll widget: Clean up code and add edit controls.
NOTE: If you revert this commit, you want to revert
the immediately prior commit as well.  The history
is that Ishan made some improvements to the widget,
but there were some minor bugs.  I decided not
to squash the commits together so that the git
history is clear who did what.  (In particular, I
want questions about the JS code to come to me if
somebody does `git blame`.)

Anyway...

This is a fairly significant rewrite of the polling
widget, where I clean up the overall structure of
the code (including things from before the prior
fix) and try to polish the prior commit a bit as
well.

There are a few new features:

    * We tell "other" users to wait for the poll
      to start (if there's no question yet).
    * We tip the author to say "/poll foo" (as
      needed).
    * We add edit controls for the question.
    * We don't allow new choices until there's
      a question.
2019-01-22 10:27:39 -08:00
ishanrai05 85535ae09c poll-widget: Change "Edit question" UI to edit-pencil button.
This changes the "Edit question" UI to be just an edit-pencil button
rather than a large "Edit question" button for a poll.
Fixes part of #11010.
2019-01-22 10:27:39 -08:00
Shubham Dhama 9e3423129b invite: Clean error handling and use ui_report.
This also fixes few unusual UI issues like an invitation got failed when
certain emails can't be invited then the error box is left with "warning"
even when next request got succeed and another case when invitation got
succeed after failing it's still reported with "alert-error" class alert
banner.
2019-01-17 10:28:59 -08:00
Shubham Dhama 93ddf2ca37 ui_report: Remove now redundant `type` argument from `.message()`.
It's no longer used, as can be seen in
2d52463b61, in past we use `type` for
specifiying whether status is 'subscriptions-status' or else, which isn't
used now, hence `type` is removed here.
2019-01-17 10:28:59 -08:00
Shubham Dhama 09ab874642 Revert "invite: Fix non-admins inviting new users."
This reverts the temporary fix done in commit
46f4e58782 and replaced it with the fix that
non-admins should be able to see a dropdown to select a non-admin type of
invited user i.e. normal member or guest user.
2019-01-17 10:28:59 -08:00
Harshit Bansal dc1fd61adf registration: Don't remove LDAP populated full name.
This commit fixes a bug that caused:
1: A valid full name on an onboarding form to be cleared after an
invalid submission.
2: Incorrectly cleared name populated from LDAP which was janky from
UX perspective.

Ideally we should disable name change for LDAP as next login
will overwrite any changes but I think that can be done in a
separate PR.

Fixes: #10867.
2019-01-17 10:16:48 -08:00
Rohitt Vashishtha 96aa1d4b37 markdown: Reduce mentions inside blockquotes to silent-mentions.
On the backend, we extend the BlockQuoteProcessor's clean function that
just removes '>' from the start of each line to convert each mention to
have the silent mention syntax, before UserMentionPattern is invoked.

The frontend, however, has an edge case where if you are mentioned in
some message and you quote it while having mentioned yourself above
the quoted message, you wouldn't see the red highlight till we get the
final rendered message from the backend.

This is such a subtle glitch that it's likely not worth worrying about.

Fixes #8025.
2019-01-16 16:08:37 -08:00
Rohitt Vashishtha f993fdd480 markdown: Add _@**Name** syntax for silent mentions.
These mentions look like regular mentions except they do not
trigger any notification for the person mentioned. These are
primarily to be used when you make a bot take an action and
the bot mentions you, or when you quote a message that mentions
you.

Fixes #11221.
2019-01-16 16:01:06 -08:00
Harshit Bansal 5f76a65b1d emoji: Make unicode/span emojis more accessible.
This commit adds `aria-label="<title_text>"` and `role="img"` to
the generated HTML.

Fixes: #5975.
2019-01-16 09:07:19 -08:00
Harshit Bansal 0051ca5db6 markdown: Extract `make_emoji_span()`. 2019-01-16 09:07:19 -08:00
Yashashvi Dave 54d92446db user settings: Re-open settings after closing profile preview.
Users can preview their profile from user settings. If user
open preview profile modal from user settings, then closing
preview profile modal should redirect them to settings modal
again (since probably they want to keep editing).

This commit fixes above issue.
2019-01-15 15:42:26 -08:00
Yashashvi Dave 0949419f68 user settings: Change width of "Preview profile" button. 2019-01-15 15:38:25 -08:00
Yashashvi Dave b53857b168 settings: Add admin UI for editing users' custom profile fields.
This commits add UI which will allow admin to edit every user's
custom profile field data from admin settings.

Fixes #10161
2019-01-15 15:34:35 -08:00
Jeswin 03d66abd9e settings: Add success messages for deactivation/reactivation.
This adds the same style of "Saving"/"Saved" loading spinners we use
elsewhere in our settings.

Tweaked significantly by tabbott to fix issues with the notifications
being on the wrong screen for reactiving/deactivating users; this was
done by introducing the get_status_field helper function and using it
everywhere.
2019-01-15 15:05:41 -08:00
Jeswin 060f40c356 settings: Use standard error handling in settings/invites.
Changed the error message element from organization-status to
an alert-notification block within this page.
2019-01-15 14:52:31 -08:00
Jeswin 17a5d6c1f7 settings: Improve status messages styling on "users" changes.
The legacy "Updated Successfully" message shown after saving changes,
is removed, and replaced with our standard "Saving" spinner and
animation.

Fixes: #11177.
2019-01-15 14:50:17 -08:00
Tim Abbott c70face2dc css: Make message editing controls look like compose controls. 2019-01-15 12:05:02 -08:00
Abhinav Singh e6493ef0c8 emoji: Add support for using emoji picker in message edit.
This code will correctly render emoji to the message textarea based on
whether emoji was selected from message composition form or message
edit form.

Fixes part of #11188.
2019-01-15 12:00:02 -08:00
Tim Abbott 164adcd433 user groups: Fix membership checks for unknown user groups.
AFAIK I should this never fail, hence the blueslip.error line.  But it
is failing in practice when rendering user groups after looking them
up by ID, and the error handling should definitely be softer.
2019-01-14 16:00:06 -08:00
Tim Abbott 46f4e58782 invite: Fix non-admins inviting new users.
Our recent work on inviting users as guests accidentally set the
invite_as argument in a way that would fail for non-admin users.

Fixes #11283, fixes #11255.
2019-01-14 15:09:20 -08:00
Adarsh Patel c886b53a3d help: Fix rendering correct OS-specific docs.
This fixes #11279, a bug where the OS-specific docs did not correctly
select the Uuser's OS tab as active when clicked from the left sidebar
of /help/.
2019-01-14 14:34:04 -08:00
Adarsh Patel f7b18bf68c portico: Deduplicate code for detecting browser OS.
We apparently had two copies of this in different files.
2019-01-14 14:33:22 -08:00
Aditya Bansal bb7c9a544b reminder.js: Refactor to make notify_above_composebox conditional.
We do this because now we send a message to stream if a reminder
is set and won't need the notification above the compose box saying
that we set a reminder. We would still need that notifications for
the send later feature so we make the construct conditional.
2019-01-14 12:11:27 -08:00
Aditya Bansal b2fa7a2293 popovers: Add a require for confirmDate plugin. 2019-01-14 12:11:27 -08:00
Vaibhav ac4aa16962 markdown preview: Fix `code` style for preview in night mode.
When in night mode, `code` style was still the same as in the light mode;
The fix is for the same.

Fixes #11269.
2019-01-13 23:14:19 -08:00
Harshit Bansal 4d68abd54f settings_account: Show error on failed avatar upload. 2019-01-13 08:17:31 +00:00
Harshit Bansal d5fc02557c settings_org: Fix an incorrect jquery selector. 2019-01-13 08:17:30 +00:00
Vaibhav 34ef37b1fe portico: Fix overlap of server and frontend errors.
Clears the errors received from the server whenever there is a chance of
overlap among them.

Fixes #10831.
2019-01-09 10:56:17 -08:00
Steve Howell 82e453d9fe ui: Fix scrollbar regressions.
In between releases, the following commit introduced
a bug where we agressively scroll to the top every
place we call `ui.update_scrollbar`:

    092b73d0b7

The main symptoms were that the left and right sidebars
would go to the top for things like selecting a topic,
getting activity updates from the server, and resizing
the window.  It was very jarring.

The recent commit looked innocuous--the root of the problem
was the original API expressed an intent to scroll to the
top, but didn't actually do it, so it was a bug in hiding.

There are **some** occasions where it's actually appropriate
to scroll to the top, mostly around search filtering, and
in those places we now call the new `ui.reset_scrollbar`
function.

This is a bit of an emergency fix, so particularly with
the settings stuff, we may get more reports of glitches here.

The important thing here is that you almost never want to
reset the scrollTop for sidebars.
2019-01-09 09:15:45 -08:00
Vishnu Ks b89a10676a billing: Use underscore built in contains function. 2019-01-08 10:47:35 -08:00
Steve Howell 37c78abe14 frontend: Use topic on message.
This seems like a small change (apart from all the
test changes), but it fundamentally changes how
the app finds "topic" on message objects.  Now
all code that used to set "subject" now sets "topic"
on message-like objects.  We convert incoming messages
to have topic, and we write to "topic" all the way up
to hitting the server (which now accepts "topic" on
incoming endpoints).

We fall back to subject as needed, but the code will
emit a warning that should be heeded--the "subject"
field is prone to becoming stale for things like
topic changes.
2019-01-07 19:20:56 -08:00
Steve Howell b3594c984a message scrolling: Fix "Scroll down to view" warning.
We recently added a feature to warn users that they
may need to scroll down to view messages that they
just sent, but it was broken due to various complexities
in the rendering code path.

Now we compute it a bit more rigorously.

It requires us to pass some info about rendering up
and down the stack, which is why it's kind of a long
commit, but the bulk of the logic is in these JS files:

    * message_list_view.js
    * notifications.js

I choose to pass structs around instead of booleans,
because I anticipate we may eventually add more metadata
about rendering to it, plus bools are just kinda brittle.
(The exceptions are that `_maybe_autoscroll`, which
is at the bottom of the stack, just passes back a simple
boolean, and `notify_local_mixes`, also at the bottom
of the stack, just accepts a simple boolean.)

This errs on the side of warning the user, even if the
new message is partially visible.

Fixes #11138
2019-01-07 17:17:55 -08:00
Steve Howell 6f8da1bb27 Refactor: Split up add_messages api.
We now have two functions:

    add_new_messages
    add_old_messages

This is a lot easier on the eyes, and it will also
prevent us from exceeding line length in future commits.

We also remove an unneeded stub in the narrow_activate
tests.
2019-01-07 17:17:55 -08:00
Steve Howell 9a30b51e6e minor: Simplify maybe_add_narrowed_messages.
We eliminate the messages_are_new parameter, which
was always set to `true`.
2019-01-07 17:17:55 -08:00
Steve Howell 9893256668 message_events: Reorganize code to insert new messages.
This commit makes it a bit more explicit about
why we're updating 2 or 3 message lists every time.

It looks funny now to repeat the home-list updates
in both sides of the conditional, but this will be
more obvious in a subsequent commit, where we want
to capture return values from rendering.
2019-01-07 17:17:50 -08:00
Steve Howell ed0abb8a53 minor: Move code around for setting link id/text/class.
We don't need to compute these vars if we early exit.
2019-01-07 17:11:17 -08:00
Steve Howell a8fe6a864d message scrolling: Add started_scrolled_up logic.
Figuring out whether we started scrolled up
**BEFORE** rendering is more accurate than trying
to subtract out heights of new messages after
rendering.
2019-01-07 17:11:17 -08:00
Steve Howell 632262e484 message scrolling: Avoid zero-pixel animations.
In a recent commit we allowed for `scroll_amount`
to be zero (as an indirect consequence of letting
`scroll_limit` be zero without early exiting).

See 0f75be3e8e

We want to short circuit the call to
`system_initiated_animate_scroll`, partly to save
unnecessary computation, but in particular to avoid
invoking the suppress-pointer-update logic.
2019-01-07 17:11:17 -08:00
Steve Howell f1f7f72119 message scrolling: Add visible_bottom to info.
It's convenient to have visible_bottom as well
as top/height, and the extra computation is
trivial (it's just arithmetic, no extra jQuery
involved).

There's some minor cleanup here too.
2019-01-07 17:11:17 -08:00
Shoumorup 2afdbb139d digest: Fix the styling of /digest page.
This adds a proper template for the /digest page, making it a
reasonable way to view the digest email content for development and
debugging.

Fixes: #11016.
2019-01-07 13:09:29 -08:00
Marco Burstein 9ddadd39f4 compose: Add support for using Zoom as the video chat provider.
This adds Zoom call properties to the `Realm` model, creates endpoints
for creating calls, adds a frontend and tests.

Fixes #10979.
2019-01-07 10:00:02 -08:00
Akash Nimare 1aab1594e2 settings: Fix alignment of left-side icons in org setting tab.
This fixes a part of #10954.
2019-01-07 09:36:16 -08:00
Rishi Gupta cfc1138abc org settings: Improve labels and styling for realm logo/avatar. 2019-01-05 16:26:56 -08:00
Yashashvi Dave 4bfea4cebe subscriptions: Hide add-subs html element if user is guest user.
Guest users can not add subscribers to subscribed or unsubscribed
streams. Therefore hide add-subs html element if current user
is guest user.

Tweaked by tabbott to use the early-return pattern.
2019-01-05 16:24:39 -08:00
Yashashvi Dave e8fbd855e6 subscriptions: Add tooltip, only subscribers can add user in private stream.
Add explanation in popover on disabled add-subscriptions input elements,
admin can't add subscribers to non subscribed private streams, only
subscribed users can.

Fixes #10593
2019-01-05 16:21:41 -08:00
Yashashvi Dave 7f3724dc5d subscription: Rename add subscription input placeholder.
In stream membership section, rename add subscription input
placeholder to 'Name or email' from 'Email address'.
2019-01-05 16:14:46 -08:00
Steve Howell efc1c74792 message scrolling: Move early-exit code higher.
This avoids some unnecessary computation and will
simplify testing.
2019-01-05 15:33:20 -08:00
Steve Howell 0f75be3e8e message scrolling: Extract _scroll_limit().
There's a subtle change here in how we handle the
hypothetical case that the selected message is above
the top of the feed.  Instead of early-exiting
from _maybe_autoscroll(), we just treat the limit
as zero, which will have the same effect.

We also change a var name be just `scroll_limit`
instead of `available_space_for_scroll`.  A longer
name would be valuable if it were somehow more
specific, but it was needlessly verbose.
2019-01-05 15:33:20 -08:00
Steve Howell a7c92a2590 message scrolling: Extract _new_messages_height(). 2019-01-05 15:33:20 -08:00
Tim Abbott 0c6175f27e lint: Enforce semicolon spacing in eslint.
We only had a few exceptions to this rule; the zjquery one was actually a bug.
2019-01-05 15:31:30 -08:00
Harshit Bansal 194dd5fd30 emoji: Remove now unused `emoji.emojis` data structure. 2019-01-05 15:09:04 -08:00
Harshit Bansal 25229ffeea emoji: Merge datasources for emoji picker and typeahead.
This will help us in avoiding a lot bugs where some emojis were
present in emoji picker and not in typeahead and vice-versa.
2019-01-05 15:09:04 -08:00
Harshit Bansal f8f971bfd6 typeahead: Rename `codepoint` to `emoji_code`. 2019-01-05 15:09:04 -08:00
Harshit Bansal 4251543426 emoji.js: Add `display_name` field.
The idea is to use this field for storing the best matching alias
to be displayed in search results. In subsequent commits I will
replace the search and rendering logic to use this field instead
of creating new objects on each search.
2019-01-05 15:09:04 -08:00
Tim Abbott d1b189b2cd settings: Fix casper tests on invitations page.
We don't allow arrow functions in the codebase yet.
2019-01-05 15:08:37 -08:00
Shubham Dhama e26cba062b settings_invites: Add invited_as column to the table.
This makes it possible to review the roles used in active invitations.
2019-01-05 14:53:09 -08:00
Shubham Dhama 42c262b807 invite: Replace `invite_as_admin` usage with `invite_as`.
Since we have already added the `invite_as` field to models, we can now
replace usage of `invite_as_admin` properly with its equivalent `invite_as
== PreregistrationUser.INVITE_AS['REALM_ADMIN']`.

Hence, also removed now redundant `invite_as`.
2019-01-05 14:46:38 -08:00
Rishi Gupta 925475e5b1 portico: Add endorsements to /for/open-source. 2019-01-05 10:39:20 +05:30
Tim Abbott e15b279fb3 i18n: Sync translation data from Transifex. 2019-01-04 14:42:46 -08:00
Rishi Gupta 84494c169a portico: Add link to /atlassian on /hello. 2019-01-04 12:13:10 -08:00
Amadeo234 e07ad67624 message-edit: Add press to Enter to Save edited message functionality.
This couples the behavior of Enter to Save with Enter to Send.
Extracts and exports functions responsible for checking if enter
does send/edit and handling default behavior otherwise.
Changes made in static/js/message_edit.js and
static/js/composebox_typeahead.js

Fixes #10320.
2019-01-04 11:59:15 -08:00
Amadeo234 e06867fec3 message-edit: Extract functions concerning Enter to Send.
This adds two functions to static/js/composebox_typeahead.js.
should_enter_send(event) checks if enter should actually send.
handle_enter(textarea,event) emulates browser's default behavior
if enter doesn't send.

These two are just straight extractions of portions of the compose box
logic.
2019-01-04 11:58:56 -08:00
Steve Howell d844a070fd ui: Render feedback widget client side.
We re-render the feedback widget on every call to
show().  This allows us more flexibility to mess
with the markup for particular use cases.
2019-01-04 10:54:10 -08:00
Steve Howell c3a0a22661 slash commands: Add undo for /day and /night.
This also works for the synonyms /light and /dark.
2019-01-04 10:54:10 -08:00
Steve Howell 995a26f4e5 ui: Explicity initialize night mode. 2019-01-04 10:54:10 -08:00
Steve Howell bdd7a64d19 ui: Close feedback widget with escape key.
It's a bit dangerous for the user to hit escape
to close the feedback widget, since it can
disappear suddenly, but users will try it, and
we should just close the widget.

(Hitting escape should be a noop if the box
is closed, but now it goes to "All Messages".)
2019-01-04 10:54:09 -08:00
Steve Howell 1cbcb06157 ui: Extract feedback_widget module. 2019-01-04 10:54:07 -08:00
Steve Howell 4468311620 feedback widget: Avoid duplicate handlers.
We only need these once, not during every show()
call.  We actually were only setting up the
click handlers one time, but we had redundant
mouse handlers.

More importantly, we stop a runaway timer
that tries to fade out our feedback widget
every 100ms or ten times per second!
2019-01-04 10:49:19 -08:00
Steve Howell 39cdc926a5 muting: Simplify dismiss() method. 2019-01-04 10:49:17 -08:00
Steve Howell 4baa65f38a muting: Rename container template to feedback_widget.html.
We now load the specific content for unmuting from
a handlebars template.
2019-01-04 10:48:19 -08:00
Steve Howell 0c48dad1da muting: Use more generic markup for undo-mute popup.
This makes everything generic except for the main
message given to the user.
2019-01-04 10:40:05 -08:00
Steve Howell 425df1c905 muting: Extract notify_widget class.
A few things are still hard coded, but the class exposes
show() and dismiss() now.

The show() method is configured with callbacks for
populate() and on_undo().
2019-01-04 10:40:02 -08:00
Steve Howell 51438281c7 minor: Rename $mute to $container.
The name doesn't even make sense for the specific
case, and we want to generalize this widget.
2019-01-04 10:37:31 -08:00
Vishnu Ks 2547d4ea07 billing: Remove mix option from frontend. 2019-01-04 23:52:00 +05:30
Vishnu Ks c1551405aa billing: Extract setting initial tab into helpers.js. 2019-01-04 23:52:00 +05:30
Vishnu Ks d94b0da3c8 billing: Separate billing.js into multiple modules. 2019-01-04 23:52:00 +05:30
Vishnu Ks 343e124270 billing: Remove get_form_input function. 2019-01-04 23:52:00 +05:30
Steve Howell 56ee70e2a9 refactor: Re-organize some logic in message view.
We calculate a few values higher up in the function.
This reduces a bit of code duplication and removes
a somewhat janky expression that happens against
a mutated list.
2019-01-03 17:33:47 -08:00
Steve Howell b88c3cd0d4 refactor: Rename vars in floating_recipient_bar.js.
The "label" made it sound these vars are strings, when
they are actually jQuery objects.
2019-01-03 17:33:44 -08:00
Steve Howell 78a3cb5887 Extract helper functions in floating_recipient_bar.js.
I use shorter var names in frb_botom() and do early
return in obscured_recipient_bar().

Also, we always call exports.hide() if we don't find
a valid recipient bar to "float."
2019-01-03 17:28:58 -08:00
AsociTon 0ce7e613c7 message_edit: Add maxlength attribute in template.
Previously, we didn't enforce the maximum length of a message in the
browser, resulting in potential bad experiences for users.

Fixes #11137.
2019-01-03 14:31:00 -08:00
Steve Howell f985125eb0 js: Initialize people.js earlier.
There is no reason not to initialize people.js
super early in the process, as it only reads
data from page_params.  Also, other modules
are likely to want its data during their own
initialization steps.
2019-01-03 13:49:44 -08:00
Steve Howell 5a313ccb90 presence: Use people.is_my_user_id() for check.
This is the preferred way to check that a user
id belongs to the current user.

We have a recent bug where the current user's
circle doesn't turn green right away.  It's not
clear this is the fix, though.  (It's hard to
repro locally.)
2019-01-03 13:49:44 -08:00
varunvaruns9 517718de02 user settings: Fix the position of get api key text and button.
Fix the alignment of "Current password" and move the
"Get API key" button to next line.

Fixes: #10535.
2019-01-03 13:48:25 -08:00
Steve Howell 6b7a4f8611 tests: Add unit tests for ui_init.js.
This test tries to find obvious dependency bugs, but
it really doesn't do anything other than fail when
it tries to use unavailable resources.
2019-01-03 13:44:38 -08:00
Tim Abbott a1919971e4 import: Handle invalid data-user-id values for mentions.
This is an issue with zulip -> zulip server data imports.
2019-01-02 15:23:09 -08:00
Shubham Dhama 092b73d0b7 ui: Fix wrong usage of scrolling to top in ui.updateScrollbar.
This was a bug introduced in 2363c9955a.

Fixes: #11141.
2019-01-02 11:00:01 -08:00
Tim Abbott 1a72256e05 settings: Fix hiding of email address visibility.
Apparently, the only development-only logic system broke saving this
settings block in production.

Fixes #11168.
2019-01-02 10:56:21 -08:00
Steve Howell 8444326bf3 status: Add menu option to "View PMs to myself". 2019-01-02 09:27:33 -08:00
Steve Howell 7b5f282aee status: Show "(away)" next to yourself if you're away. 2019-01-02 09:27:16 -08:00
Steve Howell cb691694d1 status: Add user menu options to set/revoke away status. 2019-01-02 09:23:20 -08:00
Steve Howell 6507804637 status: buddy list: Add basic UI to show away status.
Right now we do very simple things:

    you: make the green circle empty

    them: make the circle empty and demote to last group
2019-01-02 09:23:19 -08:00
Steve Howell bb8750c22b refactor: Export buddy_data.level().
This is mostly for testing purposes.  The code
structure here is pretty stable--we will probably
always use level() here to either sort or
group users, and being able to test it directly
is nice, rather than bringing in all the other
machinery.
2019-01-02 09:16:31 -08:00
Steve Howell 4fed3d2014 frontend: Add event handling for user status.
The UI part of this commit isn't really turned on
yet, but it works in theory.
2019-01-02 09:16:31 -08:00
Steve Howell d8d703af45 frontend: Add basic user_status module.
So far this processes page_params, but it's otherwise
an unused internal API.
2019-01-02 09:16:31 -08:00
Hemanth V. Alluri e3aed0f7bc custom profile fields: Markdown rendering for custom profile field values.
This makes it possible it include our standard markdown formatting in
one's custom profile fields, allowing for links, emphasis, emoji, etc.

Fixes #10131.
2019-01-01 21:06:21 -08:00
Hemanth V. Alluri 28d344b4b5 custom profile fields: Pass value as part of a dictionary.
While we're at it, we remove the JSON parsing that was part of the
user field code path, since this function isn't responsible for
rendering user fields.
2019-01-01 21:05:28 -08:00
Tim Abbott bdaeccbca1 custom profile fields: Remove unnecessary JSON parsing step.
Apparently, our custom profile fields feature was parsing the "user
list" field type in multiple places, and ignoring the results in one
of them.  That code had been causing some confusion; the correct
solution is to just delete it, since the template rendering process
ignores that value for this field type.
2019-01-01 21:04:23 -08:00
Steve Howell 0c668d13b6 subject -> topic: Make get_event_topic() more flexible. 2019-01-01 20:52:10 -08:00
Steve Howell 1ad30c6858 subject -> topic: Sweep "message.subject" in frontend.
These were the last remaining files.  After this, only
util.js has a non-email-related use of "subject".
2019-01-01 20:49:38 -08:00
Steve Howell 7e17b8a392 subject -> topic: Use util.set_message_topic() to set subject. 2019-01-01 20:49:34 -08:00
Cynthia Lin 55c1a2e525 settings: Add guest avatar marker to account settings. 2018-12-30 11:07:00 -08:00
Cynthia Lin 053c4a2250 popovers: Add guest avatar marker to user profile popover. 2018-12-30 11:07:00 -08:00
Cynthia Lin 4d97909764 popovers: Add guest avatar marker to user info popover. 2018-12-30 11:07:00 -08:00
Cynthia Lin bcea4f10e6 message view: Add guest avatar markers to message sender avatars. 2018-12-30 11:07:00 -08:00
Cynthia Lin 022c6d1e52 components: Add basic styling component for guest avatar marker.
Fixes #10754.
2018-12-30 11:07:00 -08:00
Vishnu Ks e35fa80745 billing: Fix the position of 'processing' text. 2018-12-30 08:00:23 +05:30
Vishnu Ks 806fa1a834 billing: Make card change use create_ajax_request. 2018-12-30 08:00:23 +05:30
Vishnu Ks 41fbc699ad billing: Make invoice upgrade use create_ajax_request. 2018-12-30 08:00:23 +05:30
Vishnu Ks 938438364f billing: Use form.serializeArray in create_ajax_request. 2018-12-30 08:00:23 +05:30
Vishnu Ks b655cfe379 billing: Extract autopay ajax request code as function. 2018-12-30 08:00:23 +05:30
Vishnu Ks 93b1795ed1 billing: Don't pass csrf token in Ajax requests.
The Ajax request will automatically fetch the value
from input[name='csrfmiddlewaretoken'] and set the
headers. This is done in csrf.js.
2018-12-30 08:00:23 +05:30
Vishnu Ks ed196bb980 billing: Rename #invoice_seat_count to #invoiced_licenses.
Followup of b4a28f3147
2018-12-30 08:00:23 +05:30
Vishnu Ks eebf526657 billing: Check for min license count in frontend. 2018-12-30 08:00:23 +05:30
Tim Abbott 25793aefa7 hotkey: Fix using pageup/pagedown inside message edit.
Our logic for doing pageup/pagedown calculation inside compose was
written too tightly, and ended up breaking the keys inside message
editing.

Fix this by using generic selectors that don't hardcode compose.
2018-12-29 15:59:28 -08:00
Vaibhav 93914d8cd8 markdown: Parse '/me' for multi-line messages.
Previously, messages with more than one line did not parse '/me' at
the beginning of the message.  Since there's a reasonable way to
render multi-line messages, this commit adds support for doing so.

This change does potentially break with the expected behavior of other
slash commands, but it seems worth providing useful functionality over
a blind focus on consistency.

Fixes #11025.
2018-12-29 15:32:50 -08:00
Vishnu Ks 96bb27fa84 signup: Fix bug in import settings when subdomain is root.
If branch for showing the profile details would
not have executed if the subdomain was root ("").
The check was changed to check for select input
instead of checking for subdomain.
2018-12-29 15:01:09 -08:00
Archit Kaushik 830dd68e45 message_list: Hide the message control icons when editing.
This avoids a bunch of potential confusion around users trying to
interact with these UI in situations that don't make sense.

(E.g. showing a menu to start editing the message when the menu is
already open).

Fixes #3802.
2018-12-29 14:37:56 -08:00
Steve Howell 053a41d816 subject -> topic: Fix notifications.js. 2018-12-29 14:34:06 -08:00
Steve Howell 56a893cd94 subject -> topic: Fix hash_util.js.
This includes using a more modern URL for topic links.
(We already supported "../topic/..." urls.)
2018-12-29 14:34:06 -08:00
Steve Howell 95e213df87 subject -> topic: Fix message_list_view.js. 2018-12-29 14:34:06 -08:00
Steve Howell 4fec91d5b1 subject -> topic: Fix message_events.js. 2018-12-29 14:34:06 -08:00
Steve Howell 3fc8597119 popovers: Avoid passing message to actions popover template.
We instead get the specific fields from message
that we use.  This is particularly helpful
for subject -> topic migration; we no longer
have to account for "subject" fields in
client-side templates.
2018-12-29 14:19:18 -08:00
Steve Howell c293e37237 unread: Rename zero-subject-unreads to zero-topic-unreads. 2018-12-29 14:18:32 -08:00
Steve Howell 1903cc8ac7 refactor: Use message/topic in muting_ui.toggle_mute(). 2018-12-29 14:15:43 -08:00
Steve Howell 411743e6dd narrow: Use get_message_topic() helper. 2018-12-29 14:15:43 -08:00
Steve Howell dc5321fed3 message_edit: Add util.get_edit_event_topic(). 2018-12-29 14:14:43 -08:00
Steve Howell 9b4f804fd1 message_edit: Add util.get_edit_event_orig_topic().
This extracts this bit of parsing logic for message_edit events.
2018-12-29 14:14:40 -08:00
Steve Howell bcc92744c2 compose fade: Use "topic" internally. 2018-12-29 11:40:59 -08:00
Steve Howell 773e85309c topics: Make util more flexible about subject/topic. 2018-12-29 11:40:57 -08:00
Steve Howell 4e0969bb49 Rename util.set_topic -> set_message_topic(). 2018-12-29 11:38:39 -08:00
Steve Howell 4b2181ffa2 Rename util.get_topic -> get_message_topic().
The specific name will help us when we fully cut
over to "topic" on message objects.
2018-12-29 11:38:39 -08:00
Steve Howell 2fdb44803d filter: Eliminate a few "subject" references.
This continues the effort to isolate "subject" references
to util calls.

Also, we fix a comment.

Finally, we use canonicalized operators in a switch
statement.
2018-12-29 11:38:39 -08:00
Steve Howell 8121d19122 minor: Change "subject" to "topic" in comments. 2018-12-29 11:38:39 -08:00
Steve Howell 76a73e00f4 unread: Use topic_name as var. 2018-12-29 11:38:39 -08:00
Hemanth V. Alluri b928bb3b26 static: Replace an if-else block in popovers.js with a switch statement. 2018-12-29 11:24:10 -08:00
Archit Kaushik 43fd8e658d notifications: Fix styling for long compose alerts.
This adjusts the spacing so that the out-of-view notifications for
group PMs (which have particularly long text) don't end up with the
"x" to close the notification overlapping the text.

Fixes #11058.
2018-12-29 11:15:39 -08:00
AsociTon 7a80456832 reactions: Make styling for night mode reactions more distinctive.
Fixes #10840.
2018-12-29 10:40:32 -08:00
Eeshan Garg c4fd0a659f webhooks/statuspage: Update docs, logo and screenshots. 2018-12-29 10:29:16 -08:00
Eeshan Garg 1b539a51de webhooks/opsgenie: Update docs, logo and screenshots.
Note that the word "genie" in Opsgenie is not supposed to be
capitalized.
2018-12-29 10:29:16 -08:00
Eeshan Garg 8bab4ceba4 webhooks/bitbucket2: Update docs, logo and screenshots. 2018-12-29 10:29:16 -08:00
Eeshan Garg da663104f3 webhooks/trello: Update logo and screenshots. 2018-12-29 10:29:16 -08:00
Eeshan Garg 776bdab567 webhooks/jira: Update logo and screenshots. 2018-12-29 10:29:16 -08:00
Steve Howell 015af605cf Use stream_id in web app for muting endpoints.
This is set up by the previous commit, which allows
stream_id as alternative for stream on the server side.
2018-12-27 20:26:30 -08:00
Rishi Gupta b4a28f3147 billing: Rename seat_count to licenses where appropriate. 2018-12-22 13:30:15 -08:00
Rishi Gupta 7ab1406962 billing: Prepare for moving Plan to CustomerPlan.billing_schedule. 2018-12-22 13:30:15 -08:00
Vishnu Ks 8176d112fe billing: Add frontend for license-based billing system. 2018-12-22 13:30:15 -08:00
Vishnu Ks d086efd33f billing: Deduplicate get_form_input in billing.js. 2018-12-22 13:30:15 -08:00
Steve Howell 72576b3a77 compose: Fix recent autocomplete regression.
As part of giving the stream/topic fields in the
compose box longer ids, I broke the autocomplete
code that handles re-focusing the cursor after
a user hits enter.  The worst symptom of this was
that we tried to send a message before compose
finished (although it wouldn't fully deliver the
message).

The new code should be a bit easier to grep for
if we rename these fields again, as we explicitly
use selector syntax.
2018-12-22 08:07:23 -08:00
Steve Howell ca22302763 minor: Avoid ui_util.focus_on() call.
The helper is unnecessary at this point and obscures
greps for selectors.  We completely eliminate it in
the next commit.
2018-12-22 08:07:23 -08:00
Vishnu Ks 30a61d7505 billing: Fix plan input bug in upgrade. 2018-12-21 09:34:27 -08:00
Rishi Gupta 19645354c7 user docs: Update about-streams-and-topics. 2018-12-20 16:26:19 -08:00
Steve Howell 1656fd7729 Fix recent regression with mute undo.
The undo button was bound to the stream id
and topic for only the first call, when
the click handler was set.
2018-12-20 15:58:05 -08:00
Akash Nimare bd49b2ad63 portico: Fix height of carousel container. 2018-12-20 18:49:41 +05:30
Tim Abbott a4dccec356 linkifiers: Fix the new linkifier field widths.
This makes it much more reasonable to enter a longer URL.
2018-12-19 09:15:41 -08:00
seresheim 49dbd85a89 auth: Add support for Azure Active Directory authentication.
This takes advantage of all of our work on making the
python-social-auth integration reusable for other authentication
backends.
2018-12-18 16:39:03 -08:00
Tim Abbott ba77303ee4 message_list: Slightly optimize content editing logic.
Previously, we were searching the whole message_row object for emoji,
mentions, etc., which has a bunch of UI elements that can't contain
the syntax we want to modify.  This should be a slight improvement in
the performance of message post-processing, which runs a lot of times
and thus is fairly important.
2018-12-18 14:50:05 -08:00
varunvaruns9 c2ced75d5a message_list_view: Rerender names of user groups and streams on change.
Rerender the mentions for user groups and streams when
they are not in search.

Fixes part of #11026.
2018-12-18 14:44:11 -08:00
varunvaruns9 424127012f message_list_view: Add highlight for user group mentions.
Add green highlight to mentions of user groups the current user
is a member of.

Fixes part of #11026.
2018-12-18 14:43:32 -08:00
varunvaruns9 eca1ce7f1f message_list_view: Remove check for mention class.
This check caused us to only run the code inside that block if the
message mentioned the current user (since that's when the `mention`
class is added to the main message row).

While this was a useful performance optimization, it probably was a
small one, not worth it for the correctness cost.
2018-12-18 14:41:46 -08:00
varunvaruns9 8426785286 message_list_view: Fix mention text in search condition.
Use length property of find function to check if highlight
class was present because find return an object even if
highlight class was not present.
2018-12-18 12:55:03 -08:00
Joshua Pan ad1df0ebeb settings: Add support for customizing the top-left logo.
This adds a new realm_logo field, which is a horizontal-format logo to
be displayed in the top-left corner of the webapp, and any other
places where we might want a wide-format branding of the organization.

Tweaked significantly by tabbott to rebase, fix styling, etc.

Fixing the styling of this feature's loading indicator caused me to
notice the loading indicator for the realm_icon feature was also ugly,
so I fixed that too.

Fixes #7995.
2018-12-18 12:44:52 -08:00
Tim Abbott 34f5218a0d ui_report: Add support for passing "".
I'm not really a fan of the "Failed:" pattern in some places, and this
lets us avoid it.
2018-12-18 12:33:42 -08:00
Joshua Pan 5c196d70bd css: Switch upper left logo and text to a single image.
This is preparation for allowing customization of this field.
2018-12-18 12:19:56 -08:00
Vaibhav 7371fd2647 notifications: Refactor code using logic from message_viewport.
Logic for checking if the last message in the current table is visible was
already written in message_viewport.js; Code in notifications.js is changed
to reduce redundancy.
2018-12-18 11:53:08 -08:00
Steve Howell f4f59a7557 presence: Rename presence.set_user_status() -> set_info_for_user(). 2018-12-18 11:01:10 -08:00
Steve Howell ba69dcc74c presence: Rename activity.set_user_status().
We are trying to carve room for a more specific
"user_status" concept, which refers to statuses
that users specifically set, like "I'm away".

So we call this function "update_presence_info",
which reflects that it's more about actual
"presence"--i.e. the user really is present
in the browser, even though the actual human
may not want to be disturbed.
2018-12-18 11:01:06 -08:00
Steve Howell 2c719bdb3f buddy list: Exclude current user from searches.
The current user gets excluded from all non-empty
searches, even ones that match the user, since
it can look funny when the user's at the top of a
search, and you'd never need to search for yourself
(again, since the current user is at the top of
the buddy list).
2018-12-18 11:01:06 -08:00
Steve Howell bf152b94b5 presence: Put current user back at the top of the buddy list.
We tried this out, reverted it, and then put it back.
2018-12-18 11:01:01 -08:00
Tim Abbott bdb3da4504 eslint: Add key-spacing linter rule.
Apparently, we didn't have one of these, and thus had a moderate
number of generally very old violations in the codebase.  Fix this and
clear the ones that exist..
2018-12-18 10:41:06 -08:00
Rishi Gupta d2b47dc270 org settings: Rename linkification regular expression field to pattern.
We use pattern in the table, so we should match that in the form.
2018-12-17 12:58:52 -08:00
Tim Abbott d469c14d11 docs: Advertise arbitrary org GitHub patterns for linkifiers.
Now that we support this, we should make it really obvious that we do.

Also, link to the Help Center article.
2018-12-17 12:58:52 -08:00
Tim Abbott ad9e063a5c settings: Rename realm_filters template to use linkifiers. 2018-12-17 12:29:39 -08:00
Tim Abbott 12b3e79661 settings: Rename "settings_filters" to "settings_linkifiers".
This makes the JS codebase match the UI for how to describe this
feature.  No user-facing effect.
2018-12-17 12:28:55 -08:00
Steve Howell 7a44d99b96 settings: Eliminate admin_sections module.
We move all of its logic into settings_sections.

Note that this is slightly more than a refactor.
We are slightly more aggressive about resetting
sections.  For example, if you go into Settings,
then exit the overlay, then go into Manage
Organization, we will now reset sections for both
groups.
2018-12-17 10:13:20 -08:00
Steve Howell 0543e8fbc1 settings: Call maybe_disable_widgets() in set_up() methods.
We now rely on set_up() methods to call their
own module-specific versions of maybe_disable_widgets()
in the codepath for admin_sections.load_admin_section().

And then for live updates, we just explicitly call
all four modules that support maybe_disable_widgets().

This should make switching between sections slightly faster,
and it also reduces the risk of module A messing with
module B's state.  (Granted, we have lots of other ways
that modules can mess with each other's state.)
2018-12-17 10:13:18 -08:00
Steve Howell b88a5700f6 settings: Extract multiple versions of maybe_disable_widgets(). 2018-12-17 10:13:16 -08:00
Tim Abbott cb9b526f0c third: Extract bootstrap typeahead to its own module.
Bootstrap's typeahead is the main part of the project that we've
forked, and moving it to its own module should help unlock our ability
to upgrade bootstrap itself.
2018-12-17 09:06:52 -08:00
Steve Howell d8c454b097 todo lists: Make lists sharable.
We no longer restrict who can add tasks or check
them off.

Fixes #10440
2018-12-17 07:40:27 -08:00
Tim Abbott e9f889d57e portico: Fix totally broken ToS re-accept form styling.
This form isn't actively used, which is how it ended up broken, but it
basically didn't display its content properly at all.

Convert it to use our standard white-box framework.

This still doesn't look great in various ways, but it's at least not
obviously totally busted now.
2018-12-17 07:28:29 -08:00
Tim Abbott 7485cb2a50 widgets: Rename voting_widget to poll_widget.
This ensures greater consistency with our other widgets' naming
convention.
2018-12-16 19:46:48 -08:00
Tim Abbott 2cca6a1be8 csrf: Improve API for when no CSRF input is available.
Since we're adding this to a large number of portico pages, there's no
guarantee that these pages actually have a CSRF input.

Though given that the logout template contains a CSRF input,
realistically it should always be present.
2018-12-16 16:19:23 -08:00
Tim Abbott adebe1bd4e js: Extract csrf.js and include in common bundle.
This should make it possible to use this AJAX setup code in logged-out
code as well, which is necessary to use blueslip from portico pages.
2018-12-16 16:18:42 -08:00
Tim Abbott ed9430f3a6 Revert "js: Extract csrf.js and include in common bundle."
This reverts commit dbffa66b6d.

This broke the logged-in app, due to some webpack issue.
2018-12-16 16:16:06 -08:00
Tim Abbott 6416737e70 Revert "csrf: Improve API for when no CSRF input is available."
This reverts commit 9198fa4ec9.
2018-12-16 16:15:54 -08:00
Steve Howell 7d23076a0e drafts: Fix bug in finding current element.
We weren't using the actual sorted data to find
the last element.  This probably worked by accident
in some cases, but this commit makes it more
deterministic.
2018-12-16 15:46:41 -08:00
Steve Howell ebd6d84326 refactor: Call format_drafts() more directly.
We want the return value from this for the next
commit, so we no longer call `format_drafts` indirectly
from `populate_and_fill`, and we rename the latter
to `render_widgets`.
2018-12-16 15:46:41 -08:00
Steve Howell 1584789916 refactors: Move format_draft() to module level.
This is a pure code move.
2018-12-16 15:46:41 -08:00
Steve Howell e22a50a3e3 drafts: Use lists instead of dicts.
We were using a dict to return a sorted list of
formatted drafts, instead of building a list.
2018-12-16 15:46:41 -08:00
Steve Howell 29052b36a5 minor: Rename last_draft -> curr_draft. 2018-12-16 15:46:41 -08:00
Steve Howell c82233c435 drafts: Avoid callback mechanism.
We had an anonymous callback for drafts that was
hard to read.  It's much easier to flatten the code,
give functions actual names, and stub them as needed
in the unit tests.
2018-12-16 15:46:41 -08:00
Tim Abbott 9198fa4ec9 csrf: Improve API for when no CSRF input is available.
Since we're adding this to a large number of portico pages, there's no
guarantee that these pages actually have a CSRF input.

Though given that the logout template contains a CSRF input,
realistically it should always be present.
2018-12-16 15:35:54 -08:00
Tim Abbott dbffa66b6d js: Extract csrf.js and include in common bundle.
This should make it possible to use this AJAX setup code in logged-out
code as well, which is necessary to use blueslip from portico pages.
2018-12-16 15:35:54 -08:00
Steve Howell 840210a0ba minor: Move setup_event_handlers() in code.
We place this code under populate_and_fill().

And instead of calling this at the end of
populate_and_fill(), we call it AFTER
populate_and_fill().
2018-12-16 14:38:28 -08:00
Steve Howell e38496ddc0 drafts: Show active element clearly. 2018-12-16 14:38:28 -08:00
Tim Abbott 0779d343fa message_list: Fix handling of unknown email in mentions.
If a user has an old mention and has since been renamed, there's
really nothing for us to do to render it; we should just return as
though we have no data.
2018-12-16 14:36:26 -08:00
Marco Burstein 046ecc5d50 styles: Fix compose options hidden when editing.
Fix an issue that when a message is being edited, sometimes compose
options are hidden if there is no time limit. Also, move the options
further from the time limit to make them more noticeable.

Fix #11056.
2018-12-16 13:45:43 -08:00
Tim Abbott 728c601ff4 poll widget: Only show "Add option" if a question has been set.
This makes the UI less confusing.
2018-12-16 11:59:21 -08:00
Tim Abbott 5d31c57638 poll widget: Move the "Add option" feature below options.
This is the more normal ordering for a poll.  Fixes part of #11010.
2018-12-16 11:39:04 -08:00
Steve Howell 35b904b184 subject -> topic: Fix subject in opts.
It's kinda difficult to track down all the interactions
with the opts that go through compose_actions.start(),
but I think I got everything.
2018-12-16 11:26:18 -08:00
Steve Howell 057ee6633a reload: Use "topic" to encode compose topic. 2018-12-16 11:26:18 -08:00
Steve Howell 9861cdfeb6 drafts: Use "topic" internally.
We still have to support "subject" for old drafts,
but we write "topic" for new drafts.
2018-12-16 11:26:18 -08:00
Steve Howell 9ba7b4fcbb drafts: Extract drafts.restore_message().
We make our deep-copy more explicit, change
the var name from draft_copy to compose_args,
and clean up some code formatting.
2018-12-16 11:26:16 -08:00
Steve Howell d7aa5fcc38 compose: Remove obsolete references to replying_to_message.
The `replying_to_message` field was used in some
early versions of compose fade, but it has no more
use in the current code.

The drafts implementation didn't really make any sense,
anyway, as we were claiming to reply to the same
message we were drafting.
2018-12-16 11:26:02 -08:00
Tim Abbott bdc4876948 notifications: Fix missing translation tags for above-compose alerts.
Apparently, these had never made it to being translated.  Since
they're an important part of the user experience, we add translation
tags for them now.
2018-12-16 11:14:09 -08:00
Tim Abbott 6c7725d21f notifications: Compute link earlier in mix notifications code.
This should make it more obvious how to later add a feature to include
a link for out-of-view-scroll-down notifications, should we ever want
that.
2018-12-16 11:02:52 -08:00
Vaibhav 372cb20f9e notifications: Notify when sent message is scrolled down in view.
A common source of confusion for new users is sending a message when
you're scrolled up in the message feed; in this case, it's nice to
communicate to the user why the message is not in view.

Fixes #10792.

Restructured by tabbott to replace overly complex logic for getting
the position of the new message with a `message_list.get_row()` call.
2018-12-16 10:59:25 -08:00
Tim Abbott 008722b809 portico: Fix logic for whether a password field is present.
Now, we correctly avoid calling various password quality/strength
functions in the registration flow in the event that there isn't a
password form on the current page.

Before, some code wasn't inside a block at all, while other code was
using an incorrect check (an empty jQuery object is not falsey).

The overall result was that this would often crash on certain
pages/flows, stopping JS execution and causing various secondary
problems.
2018-12-15 13:58:38 -08:00
Steve Howell a4c80089f3 page load: Fix two bugs related to muting/unreads.
The first bug fixed here has been around for a long
time--we were redundantly updating unread counts
indirectly via muting_ui.initialize(). The
unread counts also get updated in
unread_ui.initialize(), when we have more valid
state.  (And it's worth noting here that the unread
counts get updated yet again once message fetches
complete.)

The second bug was a very recent regression from
my recent stream name -> stream id cleanup in the
muting system.  We now depend on stream_data to
initialize muting data, so we need to initialize
muting.js slightly later in the process.

These fixes are intertwined, because they were both
somewhat caused by the anti-pattern of having
muting_ui.js initialize unread_ui.js and muting.js,
instead of doing more direct, fine-grained initialization
from ui_init.js.

Essentially we replace this code:

    exports.update_muted_topics = function (muted_topics) {
        muting.set_muted_topics(muted_topics);
        unread_ui.update_unread_counts();
    };

with this:

    exports.initialize = function () {
        exports.set_muted_topics(page_params.muted_topics);
    };

And the modules load like this:

    stream_data
    ...
    muting
    ...
    unread_ui

And we don't need any page-load initialization for muting_ui,
which is mostly used for Settings/Muted topics.
2018-12-15 13:44:30 -08:00
Steve Howell 625388ccf0 refactor: Call stream_data.initialize() more directly.
This function used to be called initialize_from_page_params(),
and we called it indirectly through `subs.js`.

Now we call it directly from `ui_init.js`, which gives us a
bit more control over how things are initialized.  In fact,
this sets us up for the next commit, where I fix a recent
regression I introduced.
2018-12-15 13:44:30 -08:00
Rishi Gupta 111eda604b portico: Add /atlassian for Zulip users migrating from HipChat. 2018-12-14 23:42:47 -08:00
Steve Howell c8cee5d900 topic list: Remove unnecessary markup.
The data attribute here has some value if you're
inspecting the HTML in the browser, but it's not
worth the extra code.

All the list items have data-stream-id, so there's
no need for the parent to have it.
2018-12-14 16:05:40 -08:00
Steve Howell 012bb7b6c7 Use stream_id for by_stream__uri().
The stream_list test that was fixed here was sort of
broken.  It accomplished the main goal of verifying
what gets rendered, but now the data setup part is
more like the actual app code (and simpler, too).
2018-12-14 16:05:40 -08:00
Steve Howell aea074e744 Use stream_id for by_stream_topic_uri(). 2018-12-14 16:05:40 -08:00
Steve Howell 7a22d47338 Use stream_id for mark-topic-read handler. 2018-12-14 16:05:40 -08:00
Steve Howell 87851b0db0 muting: Use stream_id in muting.get_muted_topics(). 2018-12-14 16:05:37 -08:00
Steve Howell f18ce4f923 muting: Use stream_id in markup for action menus. 2018-12-14 16:05:37 -08:00
Steve Howell d75ff80eb2 muting: Add stream_id to markup for mute settings.
We also prefer `attr` over `data` (it's more greppable).
2018-12-14 16:05:35 -08:00
Steve Howell bf6f5e7bc5 muting: Pass stream_id to muting_ui.mute and unmute.
We temporarily allow settings_muting to have
incomplete line coverage--we will fix this soon.
2018-12-14 16:02:48 -08:00
Steve Howell 10b045f91b muting: Use stream_id as arg for notify_with_undo_option.
Also remove the unused meta.stream and meta.topic variables.
2018-12-14 16:02:40 -08:00
Steve Howell ba04ec7e85 muting: Use stream_id for persist_mute/persist_unmute. 2018-12-14 16:02:37 -08:00
Steve Howell a8718c9051 muting: Use stream_id for internal data structures.
This fixes the most core data structures inside of
muting.js.  We still use stream names for incoming
data to set_muted_topics and outgoing data from
get_muted_topics.

This will make us more resilient to stream name changes.
Before, if you were logged on when a stream rename
occured, topics that were muted under that stream would
appear to be unmuted.  (You could fix it with a reload,
but it can be jarring to have a bunch of unread messages
appear in your feed suddenly.)

Fixes #11033
2018-12-14 15:58:35 -08:00
Vishnu Ks 0fd6ff722b billing: Migrate /upgrade endpoint to JSON.
The fixture changes are because self.upgrade formerly used to cause a page load
of /billing, which in turn calls Customer.retrieve.

If we ran the full test suite with GENERATE_STRIPE_FIXTURES=True, we would
likely see several more Customer.retrieve.N.json's being deleted. But
keeping them there for now to keep the diff small.
2018-12-13 17:01:12 -08:00
Rishi Gupta 647103a4e0 message visibility: Make stylistic improvements to history-limited-box. 2018-12-13 16:50:52 -08:00
Cynthia Lin c9b75a8a65 night mode: Alter compose warning background to fit night mode.
Fixes #10916.
2018-12-13 13:29:14 -08:00
Vishnu Ks e5b3d39ce9 messages: Show banner when message history is limited.
This communicates to users clearly about the situation when the
history_limited flag is set by the backend (because message history
was cutoff).
2018-12-13 09:02:11 -08:00
Tim Abbott 1054d63820 message_fetch: Deduplicate logic for finish_newer_batch.
Like the other similar commits, we were doing the same work in all
code paths, just with a much more error-prone approach.

We can also now remove the now-unused finish_initial_narrow function.
2018-12-13 08:43:56 -08:00
Tim Abbott ce187b0899 message_fetch: Deduplicate logic for start_newer_batch.
Like the other commits in this series, we were already doing this in
all of the callers of load_messages; this centralizes that logic in a
less ad-hoc feeling way.

We no longer use or need the start_initial_narrow function.
2018-12-13 08:43:56 -08:00
Tim Abbott 7febf724f3 message_fetch: Deduplicate logic for start_older_batch.
We were doing this work individually in all the callers of
load_messages; better is to just do it in one place.
2018-12-13 08:43:56 -08:00
Tim Abbott 9ccb3a2ad1 message_fetch: Deduplicate logic for finish_older_batch.
Previously, each individual caller of load_messages that passed
num_before > 0 would do its own manual management of fetch_status;
now, we just do it inside load_messages.
2018-12-13 08:43:56 -08:00
Tim Abbott cd118bbc7e message_fetch: Track history_limited property. 2018-12-13 08:43:56 -08:00
Tim Abbott b8a45d889e message_fetch: Fix home_msg_list older FetchStatus tracking.
Apparently, the older side of the FetchStatus object for home_msg_list
was incorrectly not being maintained.  We got away with this, because
the do_backfill code path (which runs after we're done with the
load_more cycle) will correct the error for found_oldest.  But we
didn't have proper handling for history_limited here.
2018-12-13 08:43:56 -08:00
Tim Abbott ba6ef745fe message_fetch: Fix home_msg_list newer FetchStatus tracking.
When we're doing the load_more frontfill, we were not correctly
declaring that we were in the process of doing a fetch.  Because the
next load_more call clears this state anyway, this was generally a
short race, off-screen, but it is still a data flow bug.

See the upcoming commits for a refactor that will eliminate the
possibility of this sort of bug.
2018-12-13 08:43:56 -08:00
Tim Abbott 982a70431f message_list_view: Rerender mentions when user names change.
When a user's name is edited, currently we still show the old name is
mentions (though clicking on the item does the right thing).

However, at present, it creates a new problem in search results, where
the highlighting is removed by this substitution.
2018-12-12 13:38:12 -08:00
Tim Abbott 9f8cc925b8 i18n: Update translation data from Transifex. 2018-12-11 11:31:00 -08:00
Steve Howell dfddb0a636 left sidebar: Remove unneeded overlay code.
These handlers are not reachable if overlays are
open.
2018-12-10 16:55:25 -08:00
Max Nussenbaum 536de666df register: Style avatar that shows when importing settings.
This styles the avatar and username that show when the registering
user is importing their settings from an existing Zulip account.

Tweaked by tabbott to fix the test/linter failures, a bit of styling,
and tag strings for translation.
2018-12-10 15:40:30 -08:00
Aditya Jain 8f0ccdf1c9 user settings: Fix active background links when a modal is visible.
A bug caused background links to open even when a modal in the user
settings overlay was active in the foreground. This commit fixes this
by disabling mouse events for the background when the modal is active,
and restoring them as soon as the modal starts closing.

Fixes #10654.
2018-12-09 22:32:53 -08:00
Akash Nimare b90eeee1ec stream: Vertically align check icons on the left of streams list. 2018-12-09 22:25:36 -08:00
Amadeo234 38aa44ef31 message_edit: Fix tab navigation to "Close" button.
This adds a line to static/js/hotkey.js for focusing the "Close"
button.  Tweaked by tabbott to make more clear that we don't expect
there to ever be both a close button and a save button, since in that
case this code would be busted.

Fixes: #3830.
2018-12-09 21:50:39 -08:00
Steve Howell d7c2577ffb subject -> topic: Rename compose fields.
The stream/topic edit areas now have these ids:

        #stream_message_recipient_stream
        #stream_message_recipient_topic

They are pretty verbose, but being able to grep
for these without noise does have some value.
2018-12-09 21:28:45 -08:00
Marco Burstein ba46dc83c6 notifications: Add a setting for changing the notification sound.
Also, add a new notification sound, "ding". It comes from
https://freesound.org, where the original Zulip notification sound comes
from as well. In the future, new sounds can be added by adding audio
files to the `static/audio/notification_sounds` directory.

Tweaked significantly by tabbott:
* Avoided removing static/audio/zulip.ogg, because that file is
  checked for by old versions of the desktop app.
* Added a views check for the sound being valid + tests.
* Added additional tests.
* Restructured the test_events test to be cleaner.
* Removed check_bool_or_string.
* Increased max length of notification_sound.
* Provide available_notification_sounds in events data set if global
  notifications settings are requested.

Fixes #8051.
2018-12-09 21:25:30 -08:00
Tim Abbott 838dd6d273 lint: Add eslint enforcement for comma-spacing.
We've been enforcing this manually for a long time, and hadn't
realized it was missing from our eslint configuration.
2018-12-07 12:22:24 -08:00
Tim Abbott 46d0ecdfe8 css: Organization account-settings specific CSS.
This puts most of our account-settings specific CSS into a single
block for better readability.
2018-12-07 12:07:34 -08:00
Akash Nimare e827e36429 settings: Show current user's role in Your Account.
This makes it easier to figure out what's going on if you're a guest.

Fixes: #10969.
2018-12-07 12:07:12 -08:00
Steve Howell 78e20c82a8 settings: Handle back button within settings/orgs panels.
The Casper code that I eliminated here seems to be
bogus, in that I don't think it really waited for
all the clicks.

I **think** the intent of the test was to verify that
when you leave settings and go back into it, it remembers
the panel.  I was able to verify this manually.
2018-12-07 11:45:25 -08:00
Steve Howell 3544688b35 settings: Call replaceState() when entering settings/orgs.
We have an upcoming change that lets us use the
back button after going arrowing through multiple
settings pages.

Without first adding this commit, we would have an
infinite loop when you came back to '#settings' and
then '#settings' would rewrite the url with the current
hash.

Just replacing the browser state allows the browser
to do the right thing.

The history protocol is pretty well supported:

    https://caniuse.com/#search=history
2018-12-07 11:45:23 -08:00
Steve Howell 2a1a55af8a settings: Streamline how we launch settings.
We can eliminate the janky `setup_page` methods
and just pass in section from `hashchanged`.

This sets us up to handle browser history more
nicely when you load '#settings' and we could essentially
redirect you to '#settings/your-account' (or similar
things).  A future commit will address that.

We also use `launch` as the new entry point, which
is more consistent with other modules.
2018-12-07 11:40:56 -08:00
Steve Howell 5a4a357afc cosmetic: Use early-return instead of else/if. 2018-12-07 11:40:56 -08:00
Steve Howell 3acc6fe080 settings: Extract admin.build_page(). 2018-12-07 11:40:54 -08:00
Steve Howell b9aecabdb7 settings: Extract settings.build_page(). 2018-12-07 11:40:50 -08:00
Steve Howell fcf31cedbc settings: Extract gear_menu.update_org_settings_menu_item().
The prior name of this was a bit inaccurate, as we no
longer ever hide the menu item for non-admins.  Also,
it belongs more naturally in `gear_menu.js` at this point.

Also, we remove one call to this, which was in a place
where it was no longer necessary.
2018-12-07 11:40:40 -08:00
Steve Howell 1d07d0a532 settings: Extract admin_sections.maybe_disable_widgets().
We now run the code to disable widgets every time
we reload a section, which was the original intention
of the code, but the call to it only happened when
you first launched the page.

We also continue to run this logic for live updates
of is_admin, although it's worth noting that the
code still only handles the "demotion" case of going
from admin to non-admin. (If somebody makes you an
admin, you continue to need to reload to get
widgets enabled.)
2018-12-07 11:40:37 -08:00
Akash Nimare 1dc741b963 help: Fix left sidebar content in smaller window.
This fixes an issue where some of the content of left
sidebar gets visible even in smaller window which looks ugly.

Fixes: #10898.
2018-12-07 08:20:45 -08:00
Steve Howell b5645848d6 minor: Move line of code to set default language.
There was no reason for this code to be separated
from similar lines of code.
2018-12-07 08:04:09 -08:00
Steve Howell ead356971c hashchange: Pass in a "section" to subs.change_state.
We also eliminate get_hash_components() and clean up the
code a bit in change_state().
2018-12-07 08:03:55 -08:00
Steve Howell a2fd901bec hashchange: Add hash_util.get_hash_section().
We'll use this mostly for streams/settings URLs at first.
2018-12-07 08:03:41 -08:00
Steve Howell 7cbf031f18 hashchange: Add warning if pushState is not available. 2018-12-07 08:03:39 -08:00
Steve Howell 0914037bed hashchange: Extract get_full_url(). 2018-12-07 08:03:29 -08:00
Steve Howell a39c7096c0 hashchange: Use overlays.close_active() in a few places.
The `change_tab_to` calls are a relic of very
early versions of Zulip.
2018-12-07 08:03:20 -08:00
Steve Howell 6d22634e56 streams: Remove subs.show_and_focus_on_narrow().
We stopped calling this in this commit:

    3d77aa49db

We also remove its helper function and the obsolete
event that only it was looking for.
2018-12-07 08:03:14 -08:00
Steve Howell 75bdd2c62c hashchange: Remove unreachable code for drafts.
I missed this in an earlier commit where I swept
the overlays for unreachable code.
2018-12-07 07:39:51 -08:00
Joshua Pan bc74abae41 user_events: Create delivery_email update event procedure.
This ensures the "account settings" UI for managing a user's own email
address uses the delivery email, since that's what users care most about.

Eventually, we'll need to add support for at least viewing both email
addresses in "account settings", but this is the right long-term
behavior.
2018-12-06 20:09:57 -08:00
Joshua Pan 67f0b1bbca admin: Add UI for editing realm_email_address_visibility.
This new setting is still hidden in the UI when not in the development
environment, because the feature isn't ready for production, but
merging this will help simplify future work on the feature.
2018-12-06 16:01:09 -08:00
Akash Nimare 1b18f8b896 team: Update list of core team members.
This removes Brock from the team section.
2018-12-06 11:34:51 -08:00
Akash Nimare 3bcb524d33 team: Add Desktop app team member to core team. 2018-12-06 11:34:51 -08:00
Tim Abbott be0604dcf0 left sidebar: Show recipients in "private messages" hover.
When the list of recipients of a group private message conversation is
truncated due to being long in the "Private messages" area, we didn't
provide easy access to the full list of people.  Fix this by adding a
title attribute for the area.

Fixes #10978.
2018-12-06 10:23:10 -08:00
Vishnu Ks 51b39901b9 portico: Add create organization link to goto realm page. 2018-12-06 09:24:54 -08:00
Vishnu Ks 18f90754da portico: Change wording of finding organization in /accounts/go. 2018-12-06 09:24:22 -08:00
Vishnu Ks 2a0b23df46 portico: Move goto account page styles to portico-signin.scss. 2018-12-06 09:23:13 -08:00
Tim Abbott cc54dddd84 settings: Fix settings UI indicators for guest users.
This correctly shows guest users that they cannot interact with
anything in the "Organization" tab, though we preserve the read-only
access to it so that they can (e.g.) browse the organization's custom
emoji.
2018-12-05 17:41:48 -08:00
Archit Kaushik 5254d77b7c onboarding: Fix help text overflow on new organization registration page.
Fixes #10866.
2018-12-05 12:44:32 -08:00
onkar shedge ba7e78bc65 message_edit: Allow editing topics indefinitely.
Previously, Topic editing was offered in the UI even to message
senders and organizations admins only if the message was no more than
one day old.  This was correct for the "community topic editing" case,
but not for message senders and organization admins.

While we're at it, this also centralizes some previously haphazard
logic to always call message_edit.is_topic_editable().

Tweaked significantly by tabbott to fix the logic.

Closes #10568.
2018-12-04 17:41:21 -08:00
Tim Abbott c21247abf9 Revert "Position sidebars with top instead of margin-top."
This reverts commit c4620af2161283fe2cff0ba8f89789211d02bbdd.

This broke the positioning of the permissions request layer when that
appears.
2018-12-04 17:26:37 -08:00