Commit Graph

7589 Commits

Author SHA1 Message Date
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