Commit Graph

2546 Commits

Author SHA1 Message Date
Harshit Bansal 3498c01e1b admin: Make restricted to domains checkbox readonly incase of no domains.
If there are no domains then there is no meaning of setting restricted to
domains checkbox and hence it should be disabled.

Fixes: #3436.
2017-02-17 11:55:15 -08:00
Steve Howell 3e3444848d Remove avatar timestamp logic in the client.
We use to have client-side logic that would append timestamps
or random numbers to avatar URLs to force browsers to
refresh their cache.

We no longer need this now that the back end maintains
versions for avatar changes and puts the version in the URLs.
2017-02-17 10:19:56 -08:00
aakash-cr7 b72262e8ec Add UI for seeing all muted topics in settings page.
Fixes #2322.
2017-02-17 00:10:18 -08:00
paxapy 9a5179c460 Add support for managing and deleting attachments.
Modified substantially by tabbott to fix tons of issues.

Fixes #454.
2017-02-16 23:44:44 -08:00
Raghav Jajodia c1dfa348a1 alert_words: Trim whitespace around alert words.
"Add a new alert word" box now displays an alert when filled with only spaces.
Fixes #3369
2017-02-16 21:06:18 -08:00
Tommy Ip abf522adfb Add styling to distinguish bots from human users in message view.
With work by Brock Whittaker and Tim Abbott on rebasing + changing
styling.

Fixes #1107
2017-02-16 17:00:21 -08:00
Steve Howell 10e220f516 Handle email changes in user_events.update_person().
This code isn't active yet, since the back end doesn't send
events yet for email changes.
2017-02-14 23:25:22 -08:00
Steve Howell 4c53ad59f2 Update PM unread counts more dynamically in the client.
When we process messages for unread counts, we now call
people.pm_reply_user_string() to get a string of user ids,
rather than using emails that may have changed since the
message was originally created.
2017-02-14 23:25:22 -08:00
Steve Howell ed4adc5650 refactor: Simplify people.pm_reply_to().
We now call people.pm_with_user_ids() to avoid some duplicate
code.
2017-02-14 23:25:22 -08:00
Steve Howell 8d3a5e7f02 Add settings.update_email(). 2017-02-14 23:25:22 -08:00
Steve Howell 0bd3af2bc8 Create narrow.update_email(). 2017-02-14 23:25:22 -08:00
Steve Howell 0eeb023a03 Create filter.update_email().
This helper function will help us process email changes.
2017-02-14 23:25:22 -08:00
Brock Whittaker ca428cfc24 Fix tab click unresponsiveness.
There is a particular case in which when a user clicks on a tab, then
uses the goto method to go to another, and then clicks on the original
tab again, it will not load the original tab. This is due to the fact
that the goto function that is used to navigate to a tab without
clicking does not set the last_value, therefore leaving a state that is
incorrect and denying a view update in the case that a user performs
the following:

Click B -> Goto A -> Click B

In this case, it saves the last_value as “B” and so when a user clicks
back on “B” it does not trigger any change as it thinks the user is
going from “B” to “B”.
2017-02-14 23:20:38 -08:00
Steve Howell d406d34fe0 Use user_id in admin_user_list.handlebars.
For our user administration, we now primarily work with user ids
that get put into data-user-id attributes.  We still put emails in the
tags to make our Casper tests easy to maintain.

This requires a minor change to the back end to pass down user ids
for the /users endpoint (in get_members_backend).
2017-02-14 23:07:44 -08:00
Tim Abbott a0aa2ca0f2 hotkey: Fix incorrect test for open subscriptions overlay. 2017-02-12 13:29:12 -08:00
Durga Akhil M u1604vbox f833f68bfd mute_ui: Add UI for mute on recipient bar.
Like the topic edit pencil icon, the new UI is mostly invisible, but
appears when you hover over the recipient bar.

* Added a tag to hold the mute button in recipient_row.handlebars with
corresponding styling in zulip.css.
* Added an event handler for the mute button in click_handlers.js.

Fixes: #2235.
2017-02-12 00:45:20 -08:00
Igor Tokarev 55cffa1e69 Added keyboard shortcut to edit the last message.
Tweaked significantly by tabbott to update Casper tests, document the
new feature, and fix hotkeys.

Fixes #1147.
2017-02-12 00:29:28 -08:00
Tim Abbott 5c34c601d9 compose: Trim trailing whitespace in messages.
This should ensure that local echo matches the backend in handling of
unusual input like `/me `.
2017-02-11 23:01:22 -08:00
Rafid Aslam 241794c586 Change "Reply" to "Quote and reply" in message popover
Change "Reply" in message popover to "Quote and reply"
which is reply and quotes the selected message.

Fixes #3302.
2017-02-11 14:51:55 -08:00
Elliott Jin 4092aab620 unread: Refactor to move DOM element updates into UI layer. 2017-02-11 08:36:39 -08:00
Elliott Jin ba449d7c23 unread: Refactor to move server calls into UI layer. 2017-02-11 08:36:39 -08:00
Elliott Jin ef7d4e417c unread: Refactor to move bankruptcy modal into UI layer. 2017-02-11 08:36:39 -08:00
Elliott Jin d233f617dd muting: Refactor to move side effects into UI layer. 2017-02-11 08:36:39 -08:00
Steve Howell 2e07533b4e Add compose.update_email().
When we get notified of an email change and the compose box is
open for PMs, we should update the email in the compose box.
This helper will be useful when we start handling such events.
2017-02-10 21:57:50 -08:00
Steve Howell f56d3807cc Add people.update_email_in_reply_to() helper.
This will be used for live updating.
2017-02-10 21:57:50 -08:00
Steve Howell f8d59c8108 Make compose replies for PMs more robust.
We now use user_ids from the message to generate the
reply_to more dynamically.
2017-02-10 21:57:50 -08:00
Steve Howell 37509da20d Display sender's most current email in message popover menu. 2017-02-10 21:57:50 -08:00
Steve Howell ffd45971de Use user ids when processing recent PMs. 2017-02-10 21:57:50 -08:00
Steve Howell 12c4478a3f Use user ids in JS-side "pm-with" filter.
We now convert our pm-with search operand to a list of user ids
for matching against messages, rather than using emails.  On the
message side we look at user ids from display_recipient.
2017-02-10 21:57:48 -08:00
Tim Abbott ce880b0d0c hotkey: Fix incorrect return value from informational overlays.
In theory, whenever an event is handled, it should return true.
2017-02-10 15:18:41 -08:00
brockwhittaker 642dac27b9 Replace the modal footers with an exit button at top of overlay.
This replaces the bootstrap default modal footers that have a
[data-dismiss] button with an .exit button in the top section of the
overlay that is styled congruently to the current subscriptions page.
2017-02-10 15:18:41 -08:00
brockwhittaker 1a28564ed4 Switch information overlay to key-based toggle.
This switches the overlay to a key based system where it uses the
toggle keys to open the correct modals.
2017-02-10 15:18:41 -08:00
brockwhittaker 2ef8e425d1 Change information overlay to use toggle component.
This switches from a custom tab interface to the toggle component
layout.
2017-02-10 15:18:41 -08:00
Brock Whittaker 1500e93092 Convert overlay modals to unified modal system.
This converts three modals:

1. Markdown Help
2. Keyword Shortcuts
3. Search Operators

Into a system in which they all appear in the same overlay now.
2017-02-10 15:18:41 -08:00
brockwhittaker 2ea6eda785 Add keys to components.toggle.
This adds keys — unique non-human identifiers to the toggle component.
2017-02-10 14:43:18 -08:00
brockwhittaker 5fbf7de1cf Add usage notes on the component.toggle mechanism.
This adds usage notes and comments to the component.toggle class
to make it more readable and usable for those who are unaware with
the prototype of the class or how to create a new instance.
2017-02-10 14:43:18 -08:00
Rishi Gupta 68a7f91022 stats: Add a fixed display order to summary charts.
API: Adds a "display_order" to the response, which is a suggested order of
importance for the clients or recipient types respectively.

frontend: Changes messages_sent_by_{client,recipient_type} to use a fixed
order for any given user.
2017-02-10 14:41:18 -08:00
Rishi Gupta cf3ae2eafe stats: Turn messages_sent_by_client into a bar chart.
Also includes a number of changes to messages_sent_by_recipient_type that
were convenient to do at the same time, since the two charts share a lot of
code.
2017-02-10 14:41:18 -08:00
Rishi Gupta e01f80bf93 stats.js: Move creation of pie traces into the populate functions.
In preparation for turning messages_sent_by_client into a bar chart.
This removes the "pie-specific" pieces from the functions used by
messages_sent_by_{client,type}.
2017-02-10 14:41:18 -08:00
Rishi Gupta ce89c64f43 stats.js: Move name_map computation to the backend. 2017-02-10 14:41:18 -08:00
Rishi Gupta 8ad7c96382 stats.js: Refactor trace variable to not be list of trace. 2017-02-10 14:41:18 -08:00
Brock Whittaker 1143ed7219 redesign: Change /#settings and /#administration to an overlay.
This also adds a box-shadow to the #deactivate_self_modal so that it
looks similar to the old backdrop.
2017-02-09 23:35:10 -08:00
Brock Whittaker 2dd36aa422 Make subscriptions page responsive.
This makes the subscriptions page responsive by having the settings tab
slide over when a user taps on a stream, giving almost the whole screen
to view the settings.
2017-02-09 14:01:00 -08:00
Tim Abbott 0aa07b9d0f subs: Improve transitions styling for subscriptions page. 2017-02-08 23:28:10 -08:00
Harshit Bansal 7d10cbc32b Add RealmAlias.allow_subdomains to model, frontend, and API.
Includes a database migration.

Fixes #1868.
2017-02-08 22:03:27 -08:00
Elliott Jin 0e0584aeaa muting: Fix calling update_unread_counts in a loop.
Previously, set_muted_topics was calling update_unread_counts once for each
topic in the input; this results in poor performance when there is a large
number of muted topics.

Fixes: #3605
2017-02-08 11:13:19 -08:00
Rishi Gupta 677b9e1ec6 stats: Preserve visibility of traces when changing aggregations.
In messages_sent_over_time. Previously, every aggregation kept its own state
regarding which of {Humans, Bots} was showing.
2017-02-07 21:31:34 -08:00
Rishi Gupta 22df58289f stats.js: Fix round_to_percentages when percentage is 100.
Fixes bug introduced in 9901128.
2017-02-07 21:31:34 -08:00
Rishi Gupta 18508ca02c stats.js: Clean up code for the number of users chart. 2017-02-07 18:55:35 -08:00
Rishi Gupta ac42ad0322 stats.js: Replace font and button colors with variables. 2017-02-07 18:55:35 -08:00
Rishi Gupta 5f2c70c61f stats.js: Refactor code for the two pie charts.
Also fixes a bug where we didn't probably update the labels when clicking on
the Me/Everyone/10/30/Cumulative buttons.
2017-02-07 18:55:35 -08:00
Rishi Gupta 9901128b33 stats.js: Change how we set the precision for percentages close to 100%. 2017-02-07 18:55:35 -08:00
Rishi Gupta 5f7cb9db16 stats.js: Reorder code to match the order of the charts on /stats. 2017-02-07 18:55:35 -08:00
Rishi Gupta 796ac7bfe6 stats.js: Remove the throw_error helper function. 2017-02-07 18:55:35 -08:00
Steve Howell e6bcc01c33 email -> id: Make browser's filter for "sender" more robust. 2017-02-07 17:37:05 -08:00
Steve Howell 64125a76e2 Use data-user-id for message popover menu. 2017-02-07 17:37:05 -08:00
Steve Howell ae850fdeb4 Use message.sender_id to create URLs in message popover. 2017-02-07 17:37:05 -08:00
Steve Howell 44f155e7b2 Generate message.pm_with_url more directly from ids.
We have added people.pm_with_url(message), which computes a
PM url from a private message using user ids rather than emails.

We call this in add_message_metadata(), since the slugs will
be valid even if emails change, so we don't need to compute
them on the fly during message rendering.
2017-02-07 17:37:05 -08:00
Harshit Bansal 8ed0e09c1f subs.js: Make `redraw_privacy_related_stuff()` a global function. 2017-02-07 17:02:16 -08:00
Rishi Gupta e0cb009f1b analytics: Refactor and clean up messages_sent_over_time. 2017-02-07 15:35:43 -08:00
Rishi Gupta 3c692684a0 analytics: Move stats.js out of portico/.
stats.js is a logged-in view.
2017-02-07 15:35:43 -08:00
kpdp cda7faee83 compose: Fix the compose box not resizing when restoring drafts.
Fixes #3592.
2017-02-07 14:41:44 -08:00
Elliott Jin 9b854c62bc search_suggestion: Suggest multiple people in `pm-with` searches.
Currently, searching for group private messages requires typing each
person's email individually.  This change improves the typeahead
suggestions for group `pm-with` searches by suggesting additional people
whenever a comma is entered.

Fixes: #3575
2017-02-07 14:13:29 -08:00
Tim Abbott 7badc39b02 reactions: Fix exceptions reacting to locally echoed messages.
Previously, we were incorrectly not updating the data-message-id used
in the .message_reactions section to use the final ID when
echo.reify_id was called.

This meant in particular that if someone else reacted to a message you
sent, and you clicked it to share the reaction, you'd get an exception.
2017-02-07 14:13:29 -08:00
Rishi Gupta a99f5ca066 analytics: Update bar colors on message_sent_over_time. 2017-02-07 11:07:51 -08:00
Steve Howell 5b8e217bf4 Add people.update_email().
The function people.update_email() is not yet connected
to anything, but it sets the stage for upcoming changes.

When emails get updated, fundamentally we just update
the appropriate person object and add a new key to
people_dict.  We sort of get a shim for free--old email
lookups will continue to work--but we add blueslip warnings
for stale lookups.
2017-02-06 22:38:22 -08:00
Steve Howell 0555970fae message_store: Populate sender_email based on people.js.
Messages that come to us from the server may have an out
of date sender email, so we use message.sender_id and
people.js to get the current email.
2017-02-06 22:38:22 -08:00
Steve Howell a8f706b1b5 refactor: Use user_id as key for people.realm_people_dict. 2017-02-06 22:38:22 -08:00
Steve Howell 2ed85263c8 refactor: Use user_id as key for people.cross_realm_dict. 2017-02-06 22:38:22 -08:00
Steve Howell 955b85f515 Use user_id to check if a message has a new person.
This prepares us for the upcoming ability to update
emails.
2017-02-06 22:38:22 -08:00
Steve Howell d01493bc42 refactor: Use user_id as key for pm_recipient_count.
We now key people.pm_recipient_count by user_id, which makes
one less dictionary that we'll need to update when we support
email updates.
2017-02-06 22:38:22 -08:00
Steve Howell 08bc69f8af huddles: Calculate huddle strings more robustly.
We now build huddle strings used in activity.js from
user ids in message.display_recipient.
2017-02-06 22:38:22 -08:00
Harshit Bansal 50800d4993 Refactor: De-duplicate the message rendering code in message_list_view.js.
Extract the duplicated message template rendering code in
message_list_view.js to `_get_message_template()` helper function.
2017-02-06 22:30:50 -08:00
Harshit Bansal 8350866406 popovers: Rename `data-msgid` to `data-message-id`.
Rename the `data-msgid` to `data-message-id` to match the style of our
other data objects.
2017-02-06 22:30:50 -08:00
Rishi Gupta 86b45b57df analytics: Fix rangeselector buttons for messages_sent_over_time.
Previously was using the daily_rangeselector regardless of whether we
started in the daily or weekly view.
2017-02-06 17:48:56 -08:00
Tim Abbott babb6aaa47 settings: Stop serving zxcvbn from node_modules/.
Now that we have the minified_source_filenames feature, we don't need
to serve zxcvbn from node_modules/ directly to avoid re-minifying it.

Moving this this allows us to stop shipping the (duplicate)
node_modules directory in release tarballs, which will save many
megabytes of unnecessary increase in our release tarball size.
2017-02-06 17:21:34 -08:00
Steve Howell 0ab832cc49 bug fix: Clean up blue highlighting in the left corner.
In a96fdd18b1, I introduced a few
regressions related to the blue highlighting that happens
in the top left corner for Home, Private messages, Starred
messages, and @-mentions.  Basically, we weren't clearing
the highlighting when we thought we were, so Home would stay
blue too long and the other filters wouldn't turn blue.

We went a surprising long time before noticing the regression.
This fix adds a function called deselect_top_left_corner_items()
to clear the blue backgrounds, so that will happen more explicitly.

And then I restored a line of code to pm_list.js that puts the
blue in place when you are in an is:private narrow (vs. a
specific PM narrow).
2017-02-06 16:10:24 -08:00
khantaalaman c3fd0d4e0c subs: Fix incorrect use of RegExp in stream filtering.
When filtering streams, we were incorrectly treating the regexp input
provided by the user as a regular expression, meaning that terms like
`c++` would trigger errors because they are invalid regular expression
syntax.  We fix this by replacing RegExp with a simple IndexOf check.

Node test added by tabbott.

Fixes #3559.
2017-02-05 13:01:43 -08:00
Rishi Gupta e5441af2c3 analytics: Add word wrap to pie chart legend text. 2017-02-04 00:24:09 -08:00
Rishi Gupta 12e8373692 analytics: Change pie chart colors to be more differentiated. 2017-02-04 00:22:39 -08:00
Amy Liu 24f0716df3 analytics: Clean up graph styling.
This fixes a number of issues in the prototype /stats graphs, including:

* Adding a Total Users number to the Users graph.
* Changing the Messages sent over time graph so that the bot
trace is hidden by default.
* Fades out the last bars in the weekly view to represent unfinished
ata.
* Sets the default view to weekly only if the realm is > 12 weeks old.
* Gets rid of the tooltips and replaces them with hover text
for the Number of Users graph.
* Fixes a bug in the legend colors for the Messages Over Time
graph.
* It also adds the year to the hover text.
* Sets the pie chart colors and adds spaces between sectors.
* Changes the font to Humbug.
2017-02-03 17:17:23 -08:00
Steve Howell 89b9c5eece blueslip: Avoid blueslip spam for failed email lookups.
If an email lookup fails, we now wait for five seconds before
doing a blueslip.error() call (after re-checking the email).
2017-02-03 13:02:26 -08:00
Rishi Gupta aafb1c70f0 analytics: Fix pie chart sorting computations in stats.js. 2017-02-02 18:19:48 -08:00
Brock Whittaker 377592802c hashchange: Fix exiting #subscriptions overlay not updating hash.
This applies fixes a bug where if a user used the Esc key, the
subscriptions hash did not get restored to its previous state.
2017-02-02 12:13:08 -08:00
khantaalaman 8c7321abad compose: Show restore-draft option in write mode only.
Fixes #3491.
2017-02-02 11:42:56 -08:00
brockwhittaker 894f0b5bf0 Fix hashchange closing #subscriptions on IE.
This fixes an issue where Array.prototype.split is called on an
undefined instance due to the EventTarget.oldURL property not being
recorded in IE. We fix this by recording it ourselves.
2017-02-02 11:40:26 -08:00
Rishi Gupta 2bd214077b analytics: Limit pie charts to 6 segments. 2017-02-02 09:20:53 +00:00
Amy Liu 0a39e354dc analytics: Add graphs of usage statistics on /stats.
This adds a frontend for the analytics system we've had for a few
months, showing several graphs of the data in Zulip.

There's a ton more that we can do with this tooling, but this initial
version is enough to provide users with a pretty good experience.

Fixes #2052.
2017-01-31 22:18:54 -08:00
Steve Howell bc20692a91 Prevent tracebacks when admin screens aren't loaded.
Various server events can be passed into admin.js before
the initial widgets have been set up.  This code short
circuits live update code when these events happen.

Note that live updates don't consistently work for the
admin pages before this fix (and after it), since don't
store data changes when the widgets aren't built.
2017-01-31 10:34:06 -08:00
khantaalaman e72107dec0 left-sidebar: Fix + icon opening stream-search box.
The of stream-search box in left-sidebar was being opened incorrectly
when clicking the + icon to add a new subscription (because that's
what would happen if you clicked the area around the +). Changes were
made in click_handlers.js by adding e.stopPropagation and
e.preventDefault in appropriate click handler.

Fixes #3517.
2017-01-31 10:00:07 -08:00
Steve Howell 373c8a0bb5 Live-update PM list for full-name changes.
We now trigger an event in user_events.js, and we dynamically
build the list of names in pm_list.js by calling out to
people.get_recipients().

We have a few variations of functions that build lists of names
for huddles, which should be cleaned up eventually.  They are
called at different times in the code path, so the different
functions, while doing mostly the same thing, start with different
data sources.
2017-01-30 11:49:19 -08:00
Steve Howell f836ae0dfb Live-update name changes in the recipient bar.
We now call message_store.get_pm_full_names() when
re-rendering a message list view, rather than reading
msg.display_reply_to, which could be stale.
2017-01-30 11:49:19 -08:00
Steve Howell 2980a9e33d Use user's current full name in recipient bars.
This breaks the function
message_store.get_private_message_recipient into two functions:
get_pm_emails and get_pm_full_names.

The get_pm_emails function behaves the same way as the original
function, but get_pm_full_names now dynamically gets full names
from people.js using the user_id in the message.display_recipient
row.

This makes the recipient bar show the correct new name if you reload
your page.  It doesn't help with live updates.
2017-01-30 11:49:19 -08:00
Steve Howell a98cbff788 Use user's current full name when rendering messages.
The field message.sender_full_name can be out of date, so
we recompute is using data from people.js in
add_message_metadata().
2017-01-30 11:49:19 -08:00
Steve Howell 97243dcd52 Live update full names for senders in the message pane.
Note that this only works for people who are currently logged in.
Folks that log in after you may pick up the old full name from
the message.  (I'll address this in a separate commit.)
2017-01-30 11:49:19 -08:00
Rishi Gupta 6b3abce541 build_emoji: Generate emoji names and codepoints from emoji_map.
Replaces the hardcoded list of emoji_names and unicode_emoji_names in
static/js/emoji.js with a list generated from emoji_map.json, both to get
the list out of version control and so we can start modifying it for our
autocomplete. This does not change the contents of emoji_names. It sorts and
removes duplicates from unicode_emoji_names (causes no change in behavior,
since unicode_emoji_names is only used as if it were a set).
2017-01-28 17:05:32 -08:00
khantaalaman 04591d1ce5 js: Fix pressing escape with modals open.
Previously, if you pressed the escape key with various modals open
(keyboard shortcuts, markdown help, etc.), the modals would close but
also the compose box would close and the user would be unnarrowed.
This changes makes it so all that happens is the modal closes.

Fixes #3472.
2017-01-28 15:54:36 -08:00
sinwar 21083278b5 Fix banners for unknown streams.
Fixes #3443
2017-01-28 13:11:31 -08:00
Steve Howell 5251e4981c Prevent traceback in PM recipient matching code. 2017-01-28 04:39:02 -08:00
Brock Whittaker 1dd8fb7966 Display realm emojis in the emoji picker container.
This displays the realm emojis in the emoji picker container in their
own divs styled similarly to the existing .emoji divs.
2017-01-27 15:39:22 -08:00
Tim Abbott f33a9fe384 js: Fix linter errors from rebased code. 2017-01-27 14:54:11 -08:00
Steve Howell f14e2de985 Handle spaces better in compose typeaheads.
We now allow spaces and other special characters to be part
of the token (following "#", "@", or ":") that the typeahead
code will further evaluate as a typeahead candidate.

This is important for folks with short/common first names
on larger realms.
2017-01-27 12:35:46 -08:00
Brock Whittaker ac710be9ae On enter, submit content editable.
On the enter key, the value of the content editable box should be
submitted.
2017-01-27 12:20:21 -08:00
Brock Whittaker 14b471a29f Stream Name to Content Editable.
This changes the stream name component to be content editable.
2017-01-27 12:05:08 -08:00
Brock Whittaker eaeb0e32a7 Stream Description Content Editable Piece.
This makes the stream description a content-editable piece.
2017-01-27 12:04:37 -08:00
Brock Whittaker 214b011bb5 Add subscribe button inside subscription settings.
This adds a subscribe/unsubscribe button inside the subscription
settings container for a stream right next to the stream name.
2017-01-26 21:02:57 -08:00
Brock Whittaker bcdd326b65 Change data-stream-name referencess to data-stream-id.
This changes all references of the data-stream-name to more
predictable data-stream-id references in the subscriptions overlay.
This prevents unescaped characters from breaking selectors and stream
renames from breaking selectors.
2017-01-26 17:32:35 -08:00
Harshit Bansal b4186fdfdd views/realm_aliases.py: Use domain instead of id as handle for RealmAlias.
We need to make the change for the API, and the next commit introduces a
unique_together constraint on (realm, domain) anyway.
2017-01-26 17:24:25 -08:00
Harshit Bansal 06cc306d00 Add stricter domain validation and improve error messages. 2017-01-26 17:24:25 -08:00
Harshit Bansal f0e5380ff1 handlebar templates: Rename admin_alias_list to admin-alias-list. 2017-01-26 17:24:25 -08:00
Harshit Bansal 38c50a81ad admin settings: Restyle realm alias modal. 2017-01-26 17:24:25 -08:00
Harshit Bansal ec02599336 admin.js: Simplify wording around the restricted to domain setting.
Remove stringify_list_with_conjunction, which would have been tough for
i18n, and make it clear that the setting only affects new users.
2017-01-26 17:24:25 -08:00
Brock Whittaker 1a63f15382 Only run popovers.hide_all() once on scroll start.
This function throttles the function and only allows the on scroll
event to fire the popovers.hide_all() function once on scroll start
(determined as > 250ms after the last scroll event fire on .app.

This should resolve some performance issues surrounding constantly
firing queries and potentially changing the document tree.
2017-01-26 13:59:14 -08:00
Tim Abbott b52f606c3a Revert "deps: Upgrade and move `jquery-mousewheel` from `static/third` to `npm`"
Apparently, the updated version of this has a serious scrolling
performance problem in the left sidebar that basically makes scrolling
in that area unusable.

This reverts commit b683b2d3c3.
2017-01-26 13:42:00 -08:00
Steve Howell f7c3765c77 Make "Copy from Stream" more transparent/flexible.
This change makes it so that when you are creating a stream
and use "Copy from Stream", the UI will immediately
check/uncheck the user checkboxes that correspond to the
stream's subscribers.

In concrete terms this allows Cordelia to create a new
stream call "Paris" that has all the "Verona" subscribers
except for Hamlet.

It also makes it so that when you go to create the stream,
the response is a little quicker, because we don't have to
iterate the streams.

Finally, it removes an odd quirk from the original design,
where if you clicked on Denmark but then collapsed the
streams, we wouldn't actually add the Denmark subscribers
to your new stream.

The current UI will still be slightly intuitive for people, as
I think checkmarks don't really make sense here.  What we
really want are Add/Remove links (or buttons) next to each
of the existing streams.
2017-01-26 10:24:15 -08:00
Steve Howell 8cfb9e427f Simplify the "Copy from Stream" feature.
I moved the UI element for "Copy from Stream" to be above
the list of users, including the filter box and check/uncheck
links, which no longer get applied to the list of streams.

The reason I no longer apply the filter to streams is...

    * It's kind of confusing to have filters apply to both
      streams and users.  There should be separate filters for
      them, and I will try to resuscitate that feature later.
    * The code to filter the streams was doing a sketchy
      regex operation against user-inputted data. (`match()`)
    * We want to use the same stream filtering code as the
      right sidebar uses.
    * It improves performance for the common case that you
      are filtering users.

The reason I no longer apply the check-all/uncheck-all actions
to streams is that it would be crazy to select all your streams
to copy users from, and it would be expensive/slow for large
realms, and it would likely be done by accident if somebody was
trying to manage individual users.

Finally, the check-all/uncheck-all actions have been scoped
to the users filtered by the text box, so I moved the links
under the text box to make that hopefully more clear to users.
2017-01-26 10:24:15 -08:00
Steve Howell 5c091437da Improve empty user filter handling for stream creates.
If we blank out the user filter for users (by hitting backspace,
for example), then we now have short-circuit logic to display all
the user checkboxes.  (The user-facing behavior doesn't change here,
but now we don't have to process all the strings.)
2017-01-26 10:24:15 -08:00
Steve Howell 88870c316f Use Dict[user_id] in people.filter_by_search_terms.
The function people.filter_by_search_terms() used
to return a JS object with emails as keys to represent
a set of users.  Now we return a Zulip Dict() object
with user_ids as keys.
2017-01-26 10:24:15 -08:00
Steve Howell beb3782e6c Speed up user filtering during stream creation.
The old implementation was O(N squared) for N = number of
users due to its using an O(N) selector inside of a loop.

Now we simply iterate through all the checkboxes and turn them
on or off based on a bunch of O(1) operations.
2017-01-26 10:24:15 -08:00
Raghav Jajodia fc965eb5f6 admin: Add No-change-made message.
A 'no changes made' message is displayed whenever save-changes button
is clicked, albeit no changes are made in the admin page.
2017-01-25 23:10:14 -08:00
Sampriti Panda 4e78ca32de register: Improve styling for frontend errors 2017-01-24 13:39:43 -08:00
Eitan Adler 0ce29d7ad6 Remove some some duplicate words in copy. 2017-01-23 23:15:04 -08:00
Steve Howell 01aad70910 bug fix: Fix recent regression with at-mentioning.
One of my commits from yesterday erroneously set the
"mentioned" flag on messages that weren't mentioning
the current user, so you would get the pink/salmon
background when you sent at-mentions to other people.

Now we check the user_id before setting the flag.
2017-01-23 16:42:43 -08:00
Tim Abbott a3b51bb9d2 Fix JS error syncing starred out-of-view messages.
Previously, if one starred very old messages (or ones in a stream
you're not subscribed to), your other open browsers would likely throw
an exception syncing the message flag.
2017-01-22 20:39:05 -08:00
Tim Abbott c082564c66 reload: Catch exceptions aborting pending AJAX requests.
It's probably a bug that this throws exceptions sometimes, but it's
not consistently reproducible (or maybe, browser dependent?), and it
isn't really a problem to fail to abort some requests as part of the
page reload process; the abort was just there to make sure as little
as possible is happening so we can garbage-collect effectively.
2017-01-22 20:23:37 -08:00
Raghav Jajodia dd4ea5e56e Fix bot edit cancel button updating name anyway.
Apparently, the bot cancel button was incorrectly tagged with
"submit", and thus ended up saving the changes anyway!

Fixes #3412.
2017-01-21 22:47:29 -08:00
Steve Howell 0fc2f18c1d bug fix: Fix already-rendered messages for avatar updates.
Most of the magic happens in message_live_update.update_avatar().

The prior code was buggy, as it was using person.id instead of
person.user_id, and it was not setting the image resolution.
2017-01-21 21:45:12 -08:00
Steve Howell f75af94984 bug fix: Prefer person.avatar_url to message.avatar_url.
This change is a partial bug fix for avatar live updates.
It makes it so that we prefer the person.avatar_url to
the message.avatar_url when rendering messages.  Our live
update code was already populating person.avatar_url, but
we were ignoring it until now.

This commit does not affect messages that were already
rendered with the old url.
2017-01-21 21:45:12 -08:00
Steve Howell e7e2e388c5 Move small_avatar_url() to people.js. 2017-01-21 21:45:12 -08:00
Steve Howell 4eb1a8f07d Extract user_events.js.
This moves people.update() to user_events.person().

We now also use user_id as the key for finding person
objects in people.js (instead of email).
2017-01-21 21:45:12 -08:00
Steve Howell 601bad554e bug fix: Limit updating full names in admin screens.
If we get a realm_user update for a user that is **not**
changing their full name, we no longer call
admin.update_user_full_name().

This was probably a fairly minor bug.
2017-01-21 21:45:12 -08:00
Steve Howell 28164d68b4 Extract people.set_full_name(). 2017-01-21 21:45:12 -08:00
Steve Howell ee00d848b9 refactor: Eliminate use of page_params.fullname.
We now use people.my_full_name().
2017-01-21 21:45:12 -08:00
Steve Howell 53308b49b2 refactor: Remove last uses of page_params.email in JS code.
Earlier commits removed all uses of page_params.email outside
of people.js, and it turns out we have page_params.user_id, so
we don't even need page_params.email for seeding the data.
2017-01-21 21:45:12 -08:00
Steve Howell 9d16993011 refactor: Use people.my_current_email() in subs.js. 2017-01-21 21:45:12 -08:00
Steve Howell 58fb9e45e4 Fix flaw when subscribing using "Add" button.
When we subscribe ourselves using the "Add" button in the
right pane of "Stream settings", we now call
stream_data.subscribe_myself(), which properly updates our
data structures (more than just sub.subscribed) and prevents
some console errors when you un-subscribe yourself using
the check mark.
2017-01-21 21:45:12 -08:00
Steve Howell f476f5be7d refactor: Add early return to subs.mark_subscribed().
The code now handles the `sub.subscribed` condition up front to
make the code less nested.
2017-01-21 21:45:12 -08:00
Steve Howell 0ccb2e38f8 refactor: Use people.my_current_email() in settings.js. 2017-01-21 21:45:12 -08:00
Steve Howell 2af0302ed0 refactor: Use people.my_current_email() in search_suggestion.js. 2017-01-21 21:45:12 -08:00
Steve Howell 038164ff04 Remove unneeded data param in pointer.fast_forward_pointer(). 2017-01-21 21:45:12 -08:00
Steve Howell 2c684bf39f refactor: Use people.my_current_email() in filter.js. 2017-01-21 21:45:12 -08:00
Steve Howell e10c6719d9 refactor: Use people.my_current_email() in echo.js. 2017-01-21 21:45:12 -08:00
Steve Howell 8c6dab9750 Use data-user-id for mention buttons in local echo.
The local echo code now marks up mention buttons with user ids
instead of email.  Our code in message_list_view.js deals with
either the old style or the new style of markup now to determine
which mention buttons need to be highlighted.

As part of this commit we extract mention_button_refers_to_me().
2017-01-21 21:45:12 -08:00
Steve Howell efdcfcaea2 Clean up message flag handling for mentions in echo.js.
After this change, if a user sends a message with at-mentions, the
local echo code will add the `mentioned` flag to 'message.flags`
as part of the callback to build the HTML, rather then doing it
hackily during a post-processing step.
2017-01-21 21:45:12 -08:00
Steve Howell 894282222a refactor: Move echo.userMentionHandler code.
The userMentionHandler callback now closes on `message` inside
of echo.apply_markdown().  This sets the stage for the next commit.
2017-01-21 21:45:12 -08:00
Steve Howell 2539ed0563 refactor: Have echo.apply_markdown take message as param.
The function echo.apply_markdown() actually applies markdown to
a message now, instead of simply computing markdown.  Passing
in the outer `message` object will allow us to avoid some hacky
post-processing of messages after rendering, because we can
have our parser callbacks update message on the spot in a more
atomic fashion.
2017-01-21 21:45:12 -08:00
Steve Howell ee8502ef0e refactor: Use people.my_current_email() in custom_markdown.js. 2017-01-21 21:45:12 -08:00
Steve Howell 0b9a3251dd refactor: Use people.my_current_user_id() in stream_data.js.
In stream_data.unsubscribe_myself(), we no longer look at
page_params.email.
2017-01-21 21:45:12 -08:00
Steve Howell 5bce806c4e refactor: Introduce people.my_current_email().
This commit doesn't change any behavior yet, but it starts us
down the road of deprecating page_params.email and allowing
people.js to control all access to the current user's email,
which will be important for email changes.
2017-01-21 21:45:12 -08:00
Steve Howell 73125e2718 refactor: Move is_current_user() to people.js.
We no longer have it in util.js, because we will
want to encapsulate this better for upcoming commits
related to email changes.
2017-01-21 21:45:12 -08:00
Rafid Aslam b683b2d3c3 deps: Upgrade and move `jquery-mousewheel` from `static/third` to `npm`
- Remove `jquery-mousewheel` from `static/third` and fetch it from npm.
- Upgrade `jquery-mousewheel` to 3.1.6.
- Bump up the `PROVISION_VERSION` to 4.5.
- Change some js code to comply with this `jquery-mousewheel` version.

Part of #1709.
2017-01-19 17:24:53 -08:00
Steve Howell 477b4af39d Direct new users to the "new members" stream.
If a new user is auto-subscribed to a stream called "new
members", we will automatically narrow them to that stream
after the tutorial.  Otherwise, we fall back to the code's
previous behavior, which is to direct them to the notifications
stream (often called "announce").

This is somewhat experimental.  If we try this concept out on
the public Zulip realm and it works well, we will create a nice
realm setting for the "new members" stream.
2017-01-19 14:58:31 -08:00
Steve Howell cd6115c24d Make nicer slugs for "sender" narrows.
Slugs are now like our "pm-with" slugs:

    narrow/sender/3-cordelia
2017-01-19 14:54:50 -08:00
Steve Howell 1ae3feac3e Use blueslip.warn, not error, for unknown emails.
In people.emails_strings_to_user_ids_string, we just warn
for bad emails going forward.

Users can enter bad emails into the search location bar,
for example, and that causes us to compute a browser hash,
which in turn uses this function.

(It's possible that we should adjust the search code not
to compute hashes for narrowing when the narrow doesn't
make sense, but that could be a non-trivial fix.)
2017-01-19 14:54:50 -08:00
Brock Whittaker 2ed598c619 Change actually_filter_streams to only run if subs overlay is open.
This change makes it such that the stream filtering operation will only
run if the subscription overlay is visible, preventing any issues with
the lack of existence of elements or processing something that users
won’t be able to see.

Fixes #3388.
2017-01-19 14:26:36 -08:00
Brock Whittaker eccca8fc61 Unify subs modal closing with subs.close().
The new subs.close() function should unify all closing events of the
subscriptions overlay. The function also now tracks whether the
subscription overlay is in a closed or open state.
2017-01-19 14:23:25 -08:00
Rishi Gupta 3a72b5cda9 analytics: Rename messages_sent_to_realm.
Several additional stats in the pipeline that also relate to messages sent
to the realm.
2017-01-17 15:54:57 -08:00
Steve Howell c0281498e6 group PMs: Fix hrefs in right sidebar for groups.
For the "GROUP PMs" part of the right sidebar, we now have
accurate hrefs when you hover over the groups or right-click
to copy links or open links in new tabs.
2017-01-17 15:13:49 -08:00
Steve Howell c94b8c39d0 Add narrow.huddle_with_uri() convenience method.
This will be used in a subsequent commit.
2017-01-17 15:13:49 -08:00
Steve Howell d757f840dd Make nicer slugs for "pm-with" narrows.
The slugs for PM-with narrows now have user ids in them, so they
are more resilient to email changes, and they have less escaping
characters and are generally prettier.

Examples:

    narrow/pm-with/3-cordelia
    narrow/pm-with/3,5-group

The part of the URL that is actionable is the comma-delimited
list of one or more userids.

When we decode the slugs, we only use the part before the dash; the
stuff after the dash is just for humans.  If we don't see a number
before the dash, we fall back to the old decoding (which should only
matter during a transition period where folks may have old links).

For group PMS, we always say "group" after the dash. For single PMs,
we use the person's email userid, since it's usually fairly concise
and not noisy for a URL.  We may tinker with this later.

Basically, the heart of this change is these two new methods:

    people.emails_to_slug
    people.slug_to_emails

And then we unify the encode codepath as follows:

    narrow.pm_with_uri ->
    hashchange.operators_to_hash ->
    hashchange.encode_operand ->
    people.emails_to_slug

The decode path didn't really require much modication in this commit,
other than to have hashchange.decode_operand call people.slug_to_emails
for the pm-with case.
2017-01-17 15:13:49 -08:00
Tim Abbott 9bb390133b admin: Fix emoji creation.
f3b9abee14 apparently failed to update
the frontend.
2017-01-17 00:21:32 -08:00
Tim Abbott 9821b3ebef reactions: Fix JS error for not-yet-fetched messages. 2017-01-17 00:10:41 -08:00
Steve Howell c36932d29e Fix unread counts display when pinning/un-pinning.
The fix works by having build_stream_sidebar_row()
automatically update its own unread count when we
build a sidebar row.  Currently we rebuild sidebar
rows when we pin/unpin rows.

As an aside, we currently don't really need to rebuild
the sidebar row when we pin, since we're only moving
the DOM, not altering it.  But this may change in the
future, so I decided to leave that code path in place.
We may decide to do things in the future like showing
pinned streams with bolder fonts or special icons or
whatever.

Fixes #2902
2017-01-16 20:07:08 -08:00
Steve Howell 9616d91bdd minor: Move update_count_in_dom() higher in module.
This change will prevent a lint error in the subsequent
change.  This just moves code in the file.
2017-01-16 20:07:01 -08:00
Steve Howell 9806d429af Add unread.num_unread_for_stream() function. 2017-01-16 20:07:01 -08:00
Steve Howell 4597fdae27 refactor: Change params to update_count_in_dom().
We now just pass in unread_count_elem and count to
update_count_in_dom(), and it does the work of finding
count_span and value_span now.
2017-01-16 20:07:01 -08:00
Tim Abbott c4836bca44 Rename titles for 'Zulip Labs' to 'Experimental settings'. 2017-01-16 18:00:10 -08:00
Tim Abbott 284931967a Rename 'All Streams' to 'All streams'. 2017-01-16 18:00:10 -08:00
Tim Abbott dd8fb093c8 Rename 'Stream Settings' to 'Stream settings'. 2017-01-16 18:00:10 -08:00
Sampriti Panda b4b6516ca0 narrow: Fix narrowing errors for topics with name 'home'.
Added a `.home-link` class to 'Home' links to separate them
from topic links with the name 'home'

Fixes #3340
2017-01-16 09:46:05 -08:00
JefftheBest1 69f9c300b8 ui: Change grey to gray in ui.js comment. 2017-01-14 12:36:06 -08:00
Sampriti Panda 196cf4367b urls: Move /messages/render to POST endpoint 2017-01-13 16:11:51 -08:00
Robert Hönig 89a64de986 De-dup "outside_viewport" notifications on different tabs.
Pass down 'local_id' through functions that handle notifications for messages
that are sent locally. If 'local_id' is undefined, the message was not sent in
the respective tab, so no "outside_viewport" notification should be displayed.
This fixes #1783.
2017-01-12 17:08:18 -08:00
Katy310 7206685dae Make more streams visible when window is narrow.
When user list displays on the left, the maximum height of the
<code>stream-filters-container</code> is determined by the function
<code>confine_to_range(lo,val,high)</code>. By changing the value of
<code>lo</code> to 80, the <code>stream-filters-container</code>
resizes to 80 px instead of 40 px.

Fixes #2510.
2017-01-12 16:53:45 -08:00
brockwhittaker 7762614482 Add deep link to unsubscribed streams list.
This adds a deep link behind a “+” icon above the streams list on the
left-sidebar which opens the subscriptions page and then also toggles
the tabs to go to the unsubscribed stream list.
2017-01-12 16:47:32 -08:00
Anirudh Jain 705ae523db emoji picker: Add emoji next at cursor instead of end of message.
Simplified by tabbott.

Fixes: #3155
2017-01-12 15:31:18 -08:00
Rafid Aslam d3ee53bdef Move endpoints to use stream_id instead of stream_name in their URLs
- Change `stream_name` into `stream_id` on some API endpoints that use
`stream_name` in their URLs to prevent confusion of `views` selection.

For example:
If the stream name is "foo/members", the URL would be trigger
"^streams/(?P<stream_name>.*)/members$" and it would be confusing because
we intend to use the endpoint with "^streams/(?P<stream_name>.*)$" regex.

All stream-related endpoints now use stream id instead of stream name,
except for a single endpoint that lets you convert stream names to stream ids.

See https://github.com/zulip/zulip/issues/2930#issuecomment-269576231

- Add `get_stream_id()` method to Zulip API client, and change
`get_subscribers()` method to comply with the new stream API
(replace `stream_name` with `stream_id`).

Fixes #2930.
2017-01-12 15:23:31 -08:00
Rafid Aslam ead32b179c Add missing `encodeURIComponent()` on some API uses
Fixes #2930.
2017-01-12 15:23:31 -08:00
Brock Whittaker de6c7ad360 Fix Emoji Popover being leaked in certain circumstances.
Fixes the leaked popover issue where a popover for a dead element was
unable to be removed because it wasn’t connected to a parent that
existed in the DOM. Now they are cleaned up on every call to
popovers.hide_all().

Fixes: #3077.
2017-01-12 15:06:38 -08:00
polypmer 2c58af9305 Check and Uncheck All only on visible (filtered) users.
When filtering users in the new stream form, check all
and uncheck all will only effect those users who are filtered,
visible in the dom.

Includes a Casper test for the new condition.
2017-01-12 13:58:54 -08:00
JefftheBest1 f0afa3e8df Fixed typos with receive 2017-01-12 04:52:44 -08:00
Steve Howell 3ee733eb51 Extract encode_operand/decode_operand in hashchange.js.
These are just one-liners for now, but they will set us up
to do different encodings for different narrows.
2017-01-11 18:31:17 -08:00
Steve Howell 030c6649ae tests: Improve hashchange coverage for operators.
Test round tripping of operators in hashchange.js.
2017-01-11 18:31:17 -08:00
Sampriti Panda e666a62c6a search: Extract 'Sent by me' suggestion logic into separate method.
This also adds a nice test suite for it.
2017-01-11 16:30:07 -08:00
Sampriti Panda c613e510ed search: Add autocomplete for 'from' operator.
Fixes #2932.
2017-01-11 16:29:58 -08:00
Tim Abbott 998dff9e50 lint: Add dangling commas in JavaScript objects. 2017-01-11 15:23:42 -08:00
Yago González a613bc43fe frontend: Keep showing hover menu after opening popovers.
Fixes: #3172
2017-01-11 14:20:48 -08:00
Robert Hönig 52641a2b11 Fix exception thrown by custom notification.
The exception was thrown by a misplaced quotation mark in notifications.py.
Fixes #3175.
2017-01-11 12:49:45 -08:00
Anirudh Jain dcc13c504b Move the reactions popover to point towards the chevron.
This fixes an issue where the actions popover being replaced by the
reactions popover would feature an unnecessary jolt.

Fixes: #3174
2017-01-10 17:18:55 -08:00
Tim Abbott 007d4becfd Revert "update-sockjs: Update sockjs from version 0.3.4 to 1.1.1."
This reverts commit 7bf10ec74f.

Apparently, SockJS 1.1.1 is broken with the browser used in our legacy
desktop app, resulting in messages being silently not sent.
2017-01-10 11:46:15 -08:00
Bojidar Marinov 786dd0fca4 auth: Make min password length and strength configurable.
This adds some configuration options to settings.py, namely
PASSWORD_MIN_LENGTH and PASSWORD_MIN_QUALITY, which control
when the frontend validator invalidates the password.

Closes #2628
2017-01-10 04:55:41 -08:00
Tim Abbott 81a19375d2 hotkey: Fix exiting the subscriptions page with "escape".
This had apparently regressed because it was checking the wrong
selector, and also didn't do the right thing to exit.
2017-01-06 23:45:03 -08:00
Tim Abbott 9f1fca30df subs: Access streams to copy from by ID in new stream creation. 2017-01-06 23:19:45 -08:00
Tim Abbott 9ff8c9e358 subs: Access users by ID in new stream creation. 2017-01-06 23:18:53 -08:00
Harshit Bansal ceb636dbd9 Manage allowed domains from admin settings.
Fixes: #1867.
2017-01-06 12:03:31 -08:00
Brock Whittaker 7b00bd6f7e Remove the old spinner, replace with new one.
This removes the old content loading spinner and replaces it with a new
SVG.
2017-01-06 10:37:54 -08:00
Brock Whittaker 3d5c24ab40 Show date correctly on message headers.
This shows a date on a message header whenever the date of that
message is different than the date of the previous message.

The previous logic was bugged and didn't display dates in headers at
date transition points.
2017-01-05 17:28:08 -08:00
Steve Howell 90fa797f9b Use stream id to live-update messages for name changes.
When we change a stream name, we now use the stream id as the
key to find messages we need to live update.  This eliminates
some possible race conditions from two users renaming a stream.

This commit introduces message_live_update.js.

The new call stack is this:

    subs.update_subscription_properties
    subs.update_stream_name
    message_live_update.update_stream_name
    message_list.update_stream_name
2017-01-05 15:32:45 -08:00
Sampriti Panda 45a5e47e1b compose: Fix bug on sending message to invalid streams.
The issue is that we were trying to validate the mentions before
checking that the recipient stream was valid, leading to problems
checking the membership of the stream.

Fixes #3040.
2017-01-05 15:26:54 -08:00
Sampriti Panda c15d1ff343 compose: Split validate_stream_message into separate functions. 2017-01-05 15:26:03 -08:00
Rishi Gupta 83392bf974 message edit: Change the empty topic placeholder to be the original topic.
If a user removes the topic in the message edit form, we use the original
topic, not the empty topic.
2017-01-04 22:51:36 -08:00
Akhil d8caf16e59 compose: Show description in autocomplete.
Stream descriptions are now displayed along with the name. The
autocomplete results include streams with matches in the stream
descriptions. Added styling for description in compose.css.

Fixes #2398.
2017-01-04 22:48:34 -08:00
Steve Howell ef893dc8dd Live-update user list for name changes.
When somebody changes their name, we will now update
the buddy list right away.  The old code was trying
to do this through a code path that was designed for
true presence updates, but it was also passing in an
empty array, instead of undefined, which caused it to
fail to invoke the intended part of the codepath to
redraw the buddy list.

Now we just call the new activity.redraw() function,
which does the right thing for the buddy list.

The group PM list was live-updating before this change,
and it continues to live-update as part of the new
activity.redraw() function.
2017-01-04 19:45:15 -08:00
Bojidar Marinov e293a84331 narrow: Fix the client sending more than one search operator. 2017-01-04 16:02:41 -08:00
Brock Whittaker 6079584c85 perf: Use offsetHeight rather than getBoundingClientRect() in condenser.
Using the offsetHeight getter is ~2.5x faster than
getBoundingClientRect() on what can be an expensive operation to do in
the hundreds of times.

Note: Tim thinks that this may have been different a few years ago,
since we tested fairly carefully before settling on
getBoundingClientRect, but benchmarks pretty clearly show offsetHeight
is faster today, so we should use that.
2017-01-04 12:42:16 -08:00
Brock Whittaker e7687bff6f Hide/Show Optimization with #group-pm-list.
The #group-pm-list now only should change state from hidden to
displayed once, which removes time spent recalculating styles in the
DOM.
2017-01-04 12:36:55 -08:00
vaibhav 268770489b typeahead: Prevent duplicate private message recipients.
This matches the recipients and displays the ones which haven't been
added already.

Fixes: #2499.
2017-01-03 20:37:47 -08:00
Bojidar Marinov 1c044688a4 compose: Make ctrl-enter, meta-enter, etc. add newline with enter_sends.
Tweaked by tabbott to ensure we update the compose box size as well.

Fixes #2989.
2017-01-03 19:14:38 -08:00
Tim Abbott e943c1d247 compose: Export autosize_textarea. 2017-01-03 19:14:38 -08:00
Tommy Ip 92dd4c1b98 Automatically hide all popovers on scroll. 2017-01-03 18:45:21 -08:00
Brock Whittaker d8fc30a776 Change escape key interception with subscription overlay.
The escape key used to be intercepted if the subscription pay display
was set to “block”, but now since we use the class “show” and lack to
hide and show the overlay, the query needs to change.
2017-01-03 17:55:22 -08:00
Jackson 29ce856843 Clean PUT /users/me/pointer to POST /users/me/pointer. 2017-01-03 15:43:11 -08:00
Jackson 6ec8abab86 Clean PUT /default_streams to POST /default_streams. 2017-01-03 15:40:00 -08:00
Brock Whittaker 50f6681319 Fix z-index Issues.
This fixes the z-index issue with the navbar along with hiding any
popovers when you enter into the lightbox.

Fixes #3078.
2017-01-03 15:33:54 -08:00
Tim Abbott 0c9eccfa58 reactions: Fix missing preventDefault in actions handler. 2017-01-03 10:58:46 -08:00
Tommy Ip 7719a34e2c Automatically hide actions popover on scroll.
Fixes #3012.
2017-01-03 09:33:05 -08:00
Robert Hönig 4f9bbb1c8a Fix duplicate notifications when multiple Zulip tabs are openend.
We attempted a number of different approaches to solving this problem:

First, we tried using HTML5 local storage to keep track of which
browser should have created the desktop notification.  This failed
because one needs locking, and it doesn't appear there is an working
locking implementation for HTML5 local storage that could allow us to
do this across tabs.  See #2936 for details.

Ultimately we went with setting the message ID as a tag.  Tags are
intended to be used for updating existing desktop notifications, which
means this implementation causes new notifications to flicker in and
out sometimes when multiple tabs are open, but that certainly beats
having duplicates.

Fixes #99.
2017-01-02 16:58:51 -08:00
Brock Whittaker fb6d35871b notifications: Cleanup click-through implementation.
This refactors the notification on click by storing values through the
jQuery $.fn.data option.

Substantially modified by tabbott.

Replaces #2940.
2017-01-02 16:51:23 -08:00
Tim Abbott 2003fb7b12 notifications: Fix raw_operators not being set for 1:1 PM messages. 2017-01-02 16:46:51 -08:00
Tim Abbott 2ef19901dd notifications: Improve HTML/CSS for desktop notifications. 2017-01-02 16:42:04 -08:00
Tim Abbott 0b78fe54e8 notifications: Wrap notifications_html definition. 2017-01-02 16:40:18 -08:00
Tim Abbott ec3e5e844a reactions: Clean up popovers and hover logic.
Previously, the emoji reactions popovers were keyed off the
edit_content area, which is problematic because that area was
created/deleted on hover, resulting in orphaned popovers (which
wouldn't close properly normally).  That had been hackishly addressed
in the original PR with the overbroad `$('.popover').remove();`.  To
remove that, we fix the actions popover to always be based on an
element that exists in the page.

There probably more to do here, but this is good enough to merge emoji
reactions and iterate from here.
2016-12-30 21:42:54 -08:00
Arpith Siromoney 9c64a08cad Add frontend support for emoji reactions.
This commit replaces the placeholder "clipboard" button with a reaction button.
This is done on any message that can't be edited. Also, on messages sent by
the user the actions popover (toggled by the down chevron icon) contains
an option to add a reaction.

When clicked, a popover with a search bar and a list of emojis is displayed.
If the right sidebar is collapsed (the viewport is small), the popover is placed
to the left of the button.
Focus is set to the search bar. Typing in the search bar filters emojis.

Emojis with which the user has reacted to this message are highlighted.
Clicking them sends an API request to remove that reaction.
Clicking on non-highlighted emojis sends an API request to add a reaction.
When the popover loses focus it is closed.

The frontend listens for reaction events. When an add-reaction event is
received, the emoji is displayed at the bottom of the message with a
count initialized to 1. If there was an existing reaction to the message with
the same emoji, the count is incremented.

Old messages fetched from the server contain reactions.
They are displayed (along with title and count) at the bottom
of each message.

When clicking the emoji reaction at the bottom of the message, if the
user has already reacted with that emoji to this message, the reaction
is removed and the count is decremented. Otherwise, a reaction is added
and the count is incremented.

Hovering over the emoji reaction at the bottom of the message displays
a list of users who have reacted with this emoji along with the
emoji name.

Hovering over the emoji reactions at the bottom of the message displays
a button to add a reaction.

Fixes #541.
2016-12-30 21:42:54 -08:00
Brock Whittaker 338dcfc889 Partial match previous search terms in streams page.
Before in a query string like:

“all, s, verona”

It would only strong match the first two terms, but now it’ll partial
string match all terms equally.
2016-12-30 17:13:48 -08:00
Rishi Gupta 386e22c564 Add node tests for message_edit.get_editability. 2016-12-30 16:51:00 -08:00
Tim Abbott c9a1d4a074 Move portico-only JS to static/js/portico/.
Fixes #3014.
2016-12-30 14:47:49 -08:00
Prabod Rathnayaka 6f087e468e Add setting hiding private message content in desktop notifications.
Tweaked by tabbott to fix a refactoring bug, set the default to True,
fix the real-time sync, and add tests for this.

Fixes #2355.
2016-12-30 14:10:34 -08:00
Brock Whittaker a9e49338de Change #name_change_container to class.
This changes the selector #name_change_container to a class because
there should never be more than one of an ID.
2016-12-29 16:15:14 -08:00
Bojidar Marinov 8876179ef7 message-edit: Always rerender home view after topic editing.
When editing a message changes the current narrow, we rerender the
narrowed view earlier in the function, so we don't need to do it here.
But we still need to rerender the home view, or the messages will be
displayed incorrectly once the user unnarrows!

Tweaked by tabbott for clarity and simplicity.

Fixes #2464.
2016-12-29 16:11:54 -08:00
Brock Whittaker 1046f16bb6 Add debugging device to check for duplicate IDs in markup.
This checks for duplicate IDs in the markup of the body.
2016-12-29 15:56:48 -08:00
lonerz e1d4fb90d7 hotkeys: Add '@' as a hotkey to compose message with mention. 2016-12-29 15:43:35 -08:00
lonerz c80bad5b55 popovers: Add popover actions to mention a user.
This adds actions to the user and message popovers to mention the user
(either the sender of a message or the selected user).
2016-12-29 15:39:41 -08:00
Rishi Gupta 9e5325a164 Add /stats page with basic stats graph.
Adds a new url route and a new json endpoint.
2016-12-29 14:20:13 -08:00
Arpith Siromoney 5639f21188 Add missing exports to js modules 2016-12-29 06:01:33 -08:00
Tim Abbott 5ad9a9d014 compose: Fix websockets having been accidentally disabled.
When we renamed use_socket to use_websockets, we only renamed it on
the backend, and thus it became effectively hardcoded to false.
2016-12-28 09:24:19 -08:00
Tim Abbott 39f0ffdedd Move static/third/gemoji to static/generated/emoji.
Fixes #1153.
2016-12-27 20:16:23 -08:00
Bojidar Marinov 9682d26561 invite: Leave not yet invited users in the invite modal's textarea.
Also, make zerver tell us whether invitations were sent.

Fixes #2287.
2016-12-27 17:14:21 -08:00
paxapy 8e7fa6b2de emoji: Add add_emoji_by_admins_only realm setting.
This setting controls whether normal users can add realm emoji.

Fixes #978.
2016-12-27 15:46:14 -08:00
Igor Tokarev 3cb7d665da emoji: Display emoji author in admin interface.
Fixes: #984.
2016-12-27 15:45:55 -08:00
Steve Howell a96fdd18b1 Make Private Messages work better when zoomed in.
Some of the work here was done Tomasz Kolek.

When we click on "more conversations" in "Private Messages,"
we call it being "zoomed in."  Before this change, when
new PMs arrived, we would rebuild the list and zoom out
again.  Now we track the zoomed_in state with a variable.
Also, if you are zoomed in and switch from one PM narrow
to another, we also keep you zoomed in.

This fix also removes some extraneous/redundant code.

Fixes: #2561
2016-12-27 13:36:30 -08:00
Sampriti Panda cc2cae7fdb subs: Refactor filtering logic from subs.filter_table into seperate function 2016-12-26 07:42:38 -08:00
Rafid Aslam d0502537ab API: Migrate POST `/ui_settings/change` to PATCH `/settings/ui` 2016-12-24 11:02:02 -08:00
KingxBanana 5f77ce1ce8 notifications.js: Make in-browser notifications clickable
You can now click the notifications you get in your browser and go
to that stream/topic/private message using jQuery's .on() method.

Fixes: #1996.
2016-12-24 10:17:24 -08:00
Juanvulcano 2fd1316d70 Removed json/update_message
Update test_alert_words.py

Update test_messages.py

Update messages.py
2016-12-24 10:08:22 -08:00
JefftheBest1 b8ee0e91d2 Migrated json/subscribtions/remove to REST endpoint 2016-12-24 09:27:25 -08:00
Jackson 3a109a56df Migrate notify_settings to settings/notifications
Remove notify_settings from legacy_url.py
2016-12-24 09:24:23 -08:00
anirudhjain75 8acdbef8aa Eliminate legacy json/make_stream_public and json/make_stream_private URL
Migrate from POST to PATCH
2016-12-24 08:54:49 -08:00
Sampriti Panda 87e7dc6799 urls: Remove legacy URL for left_side_userlist and move over to REST PATCH endpoint 2016-12-24 08:38:33 -08:00
Jackson 333cf0f015 Migrate legacy /json/time_setting to new REST style endpoint. 2016-12-23 08:08:27 -08:00
Tommy Ip 1e0de94293 API: convert get_subscribers from legacy URL to REST endpoint. 2016-12-22 09:25:12 -08:00
anirudhjain75 c9db6b6658 Clean up legacy language_settings endpoint. 2016-12-22 06:54:04 -08:00
Tim Abbott a90532e074 admin: Clean up Zulip labs changing reloading browser. 2016-12-21 14:21:06 -08:00
Sampriti Panda 425a55e568 settings: Implement delete avatar functionality 2016-12-21 13:35:22 -08:00
Sampriti Panda e72cd0b1cc urls: convert set_avatar from legacy URL to REST endpoint 2016-12-21 13:35:22 -08:00
Tim Abbott e538d7ef03 admin: Fix waiting period status UI not hiding. 2016-12-21 13:19:40 -08:00
Rafid Aslam bfe84a10f0 API: Migrate POST `json/fetch_raw_message` to GET `json/messages/<id>` 2016-12-21 13:08:40 -08:00
Tommy Ip 400c8c1f65 Prioritize stream subscribers in typeahead list.
When autocompleting names using @mention, subscribers of the stream
would appear at the top of the list. Added new test module to reflect
this change.
2016-12-21 12:59:43 -08:00
Sanskar Modi e6beaa2711 Improve @all warnings user interface significantly.
* Doesn't pop up the warning until you actually try to send the message
* Eliminates the red warning.
* Changes confirm text to "Yes, send".
* Adds a stream size threshhold of 15 people; smaller streams don't
  prompt about this.

Fixes #2257.
2016-12-21 11:40:47 -08:00
Shubham Singh bade6f496b Fix autocompleting stream names inside message editing.
Fixes #2577.
2016-12-21 11:09:42 -08:00
KingxBanana 23f3271551 Clear popovers on stream narrows fix (Issue #2281) 2016-12-19 21:05:18 -08:00
Akhil 06615bee00 streams: Implement copy-subscribers feature.
In the new stream creation modal, added checkboxes for each stream
and a toggle to see or hide the checkboxes. Altered filtering to
filter streams and users. Added corresponding casper tests.

When a stream is checked/unchecked, it does not affect the state
of any user checkbox. This may be visually unclear as users can be
added even if their checkboxes are empty.

Fixes #2448
2016-12-17 11:20:47 -08:00
paxapy 28bd9d035c click_handlers.js: Handle clicks on stream links using data-stream-id.
This causes Zulip to correctly handle clicks on announcements for
renamed streams.

The stream name that the user typed will still be displayed, which
isn't ideal, but is probably the best we can do without more invasive
rerendering of old messages.

Fixes #426.
2016-12-15 22:48:19 -08:00
Tim Abbott 7cd3a5873d admin: Remove unnecessary set_up_deactivate_user_modal. 2016-12-15 18:18:26 -08:00
Brock Whittaker d20e643c59 admin: Fix Deactivate/Reactivate User Buttons.
This fixes the behavior to be consistent and remove the “Working…” bug.
2016-12-15 18:17:07 -08:00
Steve Howell 47a655a3cc Extract people.extract_people_from_message() and fix bug.
This commit extracts people.extract_people_from_message()
from message_store.add_message_metadata(), and now
add_message_metadata() extract people before it calls
process_message_for_recent_private_messages(), which
fixes a bug where we are trying to look up an email
for a deactivated user who was in the message but not
in the pre-loaded list of people.

Fixes #2701
2016-12-15 17:44:58 -08:00
Steve Howell b46d7654f8 Change people.remove() to people.deactivate() and fix bug.
This commit changes people.remove() to be people.deactivate(),
and it fixes a bug where deactivating users was causing tracebacks
in the PM list if somebody had PM'ed the deactivated user
recently.
2016-12-15 17:44:58 -08:00
Steve Howell b2bb2f8ea0 Extract people.init() function.
We need this for node tests, so that you don't have to explicitly
remove every user between tests.  (Also, people.remove() is about
to have different semantics.)
2016-12-15 17:44:58 -08:00
vaibhav 75bf501553 Add optional waiting period for users to create streams.
This adds support for only allowing normal users with account age
equal or greater than a "waiting period" threshold to create streams;
this is useful for open organizations that want new members to
understand the community before creating streams.

If create_stream_by_admins_only setting is set to True, only admin users
were able to create streams. Now normal users with account age greater
or equal than waiting period threshold can also create streams.

Account age is defined as number of days passed since the user had
created his account.

Fixes: #2308.

Tweaked by tabbott to clean up the actual can_create_streams logic and
the tests.
2016-12-15 16:54:30 -08:00
Tim Abbott f0f4be4af7 lint: Fix remaining no-unused-vars eslint rule violations. 2016-12-14 22:36:47 -08:00
Tim Abbott fe2d38392f subs: Restore debouncing of stream filtering.
This appears to have been accidentally removed in the redesign.
2016-12-14 22:36:47 -08:00
Rafid Aslam 45f39be37f lint: Fix many no-unused-vars eslint rule violations.
These have been carefully audited by tabbott to ensure they are
unlikely to cause regressions.
2016-12-14 21:34:51 -08:00
Brock Whittaker 80ad28bab5 Don't repeat date header if message date is same as previous.
This primarily works to make sure that new queued messages don’t end up
with redundant date headers on them.
2016-12-14 20:41:33 -08:00
Tommy Ip 0329b67048 admin: Limit bots in settings page.
Updated `get_editable()` so that organization admins only see their
own bots in their personal settings page; this removes a lot of
unnecessary clutter.

Fixes #2657.
2016-12-14 19:29:02 -08:00
Tommy Ip fa4050d62d Improve error handling in is_current_user().
Realm bots have a owner of `null` but that is not explicity handled
in `is_current_user()`.
2016-12-14 19:27:43 -08:00
Steve Howell 546cc27f0d minor: Add code comment re:unread counts. 2016-12-14 19:10:55 -08:00
Steve Howell 5444486acb Have unread_topic_counter.get_counts() return a result.
Before this change, we passed in a hash to get_counts() to
mutate, but now we make the caller responsible for splicing
results into a bigger data structure.

The function now involves no mutation.
2016-12-14 19:10:55 -08:00
Steve Howell b11fbf0b4b Consolidate stream/topic logic for unread messages.
This change introduces an unread_topic_counter object
that manages unread counts for streams and topics.  Consolidating
all the logic into a single class will set us up to add
logic for dealing with topic counts that includes provisional
counts of unread messages from the server.  It also makes
the current code a little easier to reason about.

Most of this change was simply extracting functions, but
I also removed a few unnecessary and inconsistent calls to
`stream_data.canonicalized_name` that preceded our use of
Dict with a fold_case argument.
2016-12-14 19:10:55 -08:00
Brock Whittaker c25694a9d9 Do not reload page on form submission in settings page.
Currently under Zulip Labs and Notifications, saving changes reloads
the page. This shouldn’t happen.

Fixes #2697.
2016-12-14 16:32:32 -08:00
Brock Whittaker 6ed7ba8935 Blur all links after clicking.
The links don’t have to stay focused and produce unintended side
effects.
2016-12-14 15:37:43 -08:00
Brock Whittaker 660144a79d Blur the active element on settings/streams modal exit.
This blurs any focused element so that you can’t accidentally enter
into anything on a hidden modal.
2016-12-14 15:37:43 -08:00
Brock Whittaker a460fcddef Add Date Headers to Floating Bar and Message Headers.
This adds the date of a block of messages to the floating recipient
bar along with message headers of blocks that are the first of a
particular day.
2016-12-13 20:36:39 -08:00
Bojidar Marinov 8b44ace3a8 frontend: Make global notifications live-update on changes.
Fixes #2527
2016-12-13 20:22:13 -08:00
Brock Whittaker 65288848b1 Fix Hiding Stream Creation Prompt on "Enter".
The stream creation prompt would be hidden if someone clicked “Enter”
and the form failed. This is presumably due to some bootstrap magic.
2016-12-13 13:16:51 -08:00
Bickio 868f343980 Do not open compose box if user sidebar search is empty.
Fixes #2357.
2016-12-13 11:04:08 -08:00
Brock Whittaker 1886f0a015 redesign: Convert subscriptions page to overlay.
This is a major change to the /#subscriptions page, converting it to
by a side-by-side list of streams and their settings in an overlay.
There are no new features added/removed, but it's a huge changeset,
because it replaces the old navigation logic and moves the stream
creation modal to appear in the right side of this overlay.
2016-12-09 11:08:08 -08:00
Igor Tokarev 0bac986f26 Fixed compose box PM recipient typeahead handling of focus.
This closes #2315.
2016-12-07 22:13:47 -08:00
Tommy Ip fe4a0e72fc Add new button to download ~/.zuliprc from settings page.
Added new option to download .zuliprc file directly from settings
page.  This should help reduce friction when setting up new
bots/integrations. This new feature is available in the bot cards and
the 'show your API key' section. One caveat is that the filename is
automatically set to 'zuliprc' instead of '.zuliprc', since as most
browsers do not allow filenames to start with a dot.

Fixes #2327.
2016-12-07 21:28:41 -08:00
Rafid Aslam 7856217a63 Migrate JS modules to CommonJS style.
Closes #1488.
2016-12-07 16:11:52 -08:00
Yago González e65c42cb5f eslint: Turn on errors for new-cap rule.
Now the eslint rule "new-cap" is set as: ["error", { "newIsCap": true, "capIsNew": false }]
2016-12-07 05:33:16 -08:00
Rafid Aslam ce94fb2eb1 deps: Change zxcvbn download method from download-zxcvbn to npm.
- Replace download-zxcvbn with downloading it from npm.
- Change zxcvbn.js path to node_modules (because npm put it to
`node_modules` directory.
- Bump `PROVISION_VERSION` in `version.py` to 2.4.

Fixes #2423.
2016-12-06 17:54:56 -08:00
Rafid Aslam 0951b838ca deps: Update zxcvbn to 4.4.1
Update zxcvbn to 4.4.1, and change `crack_time` to
`crack_times_seconds` because `crack_time` has been changed to
`crack_times_seconds` in 4.4.1.
2016-12-06 17:51:33 -08:00
Zac Pullar-Strecker e6e11aefb3 settings: Add option to disable websockets.
This can be useful in scenarios where the network doesn't support
websockets.  We don't include it in prod_settings_template.py since
it's a very rare setting to need.

Fixes #1528.
2016-12-05 21:55:22 -08:00
K.Kanakhin 7bf10ec74f update-sockjs: Update sockjs from version 0.3.4 to 1.1.1.
- Add browserify to npm dependencies.
- Add SockJS-client to npm dependencies.
- Add npm postinstall script to generate browser version of SockJS-client
  from npm package.
- Change deprecated SockJS object property 'protocol_whitelist' to
  'transports'.
- Fix settings.
2016-12-05 21:36:10 -08:00
lonerz abde152d9c eslint: change array-callback-return from warning to error. 2016-12-05 21:21:19 -08:00
lonerz dc6849952b eslint: change space-before-function-paren from warning to error.
Also fix violations.
2016-12-05 09:50:37 -08:00
lonerz a8b39e6c0f Switch yoda eslint rule from warning to error (in .eslintrc) 2016-12-04 19:48:10 -08:00
lonerz 025fe9980b Switch no-empty eslint rule from warning to error (in .eslintrc) 2016-12-05 01:35:14 +00:00
Rafid Aslam 0290aeb6ab lint: Fix several no-unused-vars eslint rule violations.
These changes were extracted by tabbott from the original commit
to merge now because they have been reviewed as safe.
2016-12-03 18:43:47 -08:00
Rafid Aslam 426cb13e23 Remove `enforce_arity` function from util.js.
Remove `enforce_arity` function from util.js, because it is
not used anymore.
2016-12-03 18:43:46 -08:00
kevv87 1fb9220354 lint: Remove old jslint linter.
Now that we're using eslint, jslint is no longer required.
2016-12-02 18:49:42 -08:00
Tim Abbott 2c940b93ab js: Fix some minor whitespace issues. 2016-12-02 18:39:30 -08:00
AZtheAsian 5e9918135b eslint: change quote-props from off to error and fix violations. 2016-12-02 18:35:53 -08:00
Krzysztof Zbudniewek b8fc3f0e65 eslint: change space-before-blocks from warning to error and fix violations 2016-12-02 17:40:09 -08:00
AZtheAsian 9c0ebc7359 eslint: change no-else-return to error and fix violations 2016-12-02 14:43:09 -08:00
AZtheAsian ed0bc831be eslint: change one-var from warning to error and fix violations 2016-12-02 11:25:16 -07:00
Tommy Ip b3f4feb996 eslint: change max-len from warning to error and fix violations. 2016-12-02 14:16:33 +00:00
kevv87 e6369fc29b eslint: change no-plusplus from warning to 2 and fix violations. 2016-12-01 14:27:17 -08:00
Tommy Ip c90da24541 eslint: change keyword-spacing from warning to error and fix violations. 2016-12-01 14:22:15 -08:00
aakash-cr7 d99b17070e edit: Fix traceback when saving edits to unsent messages.
7b0c6459b4 accidentally failed to update
one of the calleers of update_private_messages, resulting in this code
path failing consistently.

Fixes #2416.
2016-12-01 10:39:43 -08:00
Tommy Ip 7b2c313f37 eslint: change brace-style from warning to error and fix violations. 2016-12-01 10:20:22 -08:00
Brock Whittaker 4935f0c693 popovers: Hide actions popover once the muting button is clicked.
The popover shouldn’t still display once a valid action on the popover
has been taken.

Fixes #2366.
2016-11-29 16:47:03 -08:00
Arpith Siromoney f7dc2f33cd Change name of eslintrc file to .eslintrc.json
Currently it does this for the eslintrc files in zulip,
zulip/frontend_tests and static/js

This commit also fixes json style issues (quotes)
2016-11-29 08:58:39 -08:00
Tim Abbott 3d1bcb05e1 tornado: Move event_queue.py to zerver/tornado/.
Fixes #729.
2016-11-26 22:29:28 -08:00
Calvin Lee 4e5c4c5ffb streams: Add support for setting stream description during creation.
Add new box for stream description in the stream creation form,
modify backend so its contents end up as the stream description.

Fixes: #2283.
2016-11-26 16:55:35 -08:00
Steve Howell 604079a9d4 Fix formatting for Group PMs in the right sidebar.
We now sort users by the lower case value of their
full names in each of the links in the "GROUP PMs"
section of the right sidebar.  We still use "+n others"
for big huddles.
2016-11-26 11:48:52 -08:00
Steve Howell d953eca14c Make group PMs reply-to's more consistent in case.
We now sort lists of users ids deterministically, and we also
sort list of emails deterministically and without regard to case.

This probably fixes the bug #2343, although I never got a great
repro on that.
2016-11-26 11:48:52 -08:00
Steve Howell 578b276523 node tests: Add tests for message_store.js. 2016-11-26 11:48:52 -08:00
Steve Howell af9ff9a030 Have unread.num_unread_for_person accept a user_id.
(It used to take an email as its parameter.)
2016-11-26 11:48:52 -08:00
Steve Howell 772571fd82 Use data-user-ids-string in Private Messages sidebar.
This commit also changed message_store.recent_private_messages
to use user_ids_string instead of reply_to.
2016-11-26 11:48:52 -08:00
Steve Howell aadfe133e2 buddy list: Use user_ids in DOM list elements. 2016-11-26 11:48:52 -08:00
aakash-cr7 79b4ac8155 Add tooltips to buttons appearing when message is not delivered. 2016-11-26 10:13:48 -08:00
Arpith Siromoney 29d3019262 Switch no-loop-func eslint rule from warning to error (in .eslintrc)
The one error that needed to be fixed was in static/js/echo.js.
The function in the loop was being used by _.each(). This has been
replaced by iterating through the array using a while loop instead.
2016-11-25 14:02:44 -08:00
Arpith Siromoney 497c7702cc Run eslint in tools/lint-all with npm run --silent lint
This commit adds a basic eslintrc that emulates jslint defaults.
Rules that conflict with our existing code have been switched to
warnings instead of errors. Globals have been added to the eslintrc. The
bundled js file (generated by webpack) and blueslip.js are ignored with
.eslintignore.

To display warnings, run npm run lint-loud. This runs eslint without the
--quiet option on static/js and frontend_tests.

npm run --silent lint is run by tools/lint-all (in addition to jslint).
The --silent option is used to suppress the default output from npm run.

Fixes #535.
2016-11-18 16:15:45 -08:00
Vladislav Manchev d7e1e4a2c0 Add initial implementation of custom realm filters.
This PR was abandoned by Vladislav and then substantially modified by
Igor Tokarev and Tim Abbott to complete it and fix a number of bugs.

Fixes #544.
2016-11-17 17:11:25 -08:00
Steve Howell 8f96853fcb presence: Convert presence_info to use user IDs.
When we filtered buddy lists, a recent change introduced some
bugs related to case-insensitive emails.  We now circumvent the
bug by indexing presence_info with user_ids.
2016-11-17 13:27:28 -08:00
Brock Whittaker 5d2b81358c Code Simplification and Emoji Drag Fix.
There’s no need for four separate `$(sel).is()` statements, one will
do. This also added .drag to the list to ignore.
2016-11-17 11:21:15 -08:00
Brock Whittaker 2663215625 Do not close message compose box on drag.
On the drag to resize emoji box action, do not close the message
compose box.
2016-11-17 11:21:15 -08:00
Steve Howell 82a497ec08 Remove spurious blueslip error for topic lists.
If we update an unread count for a topic that is not part of
our truncated list, we don't need to complain.
2016-11-16 22:01:30 -08:00
Brock Whittaker 9582079cd9 edit: Fix "View source" icon being orphaned post-hover.
It turns out it wasn’t a one-liner, it was actually a -2-liner. :)
2016-11-16 14:03:54 -08:00
Steve Howell 3b594a6efa bug fix: Keep old, active, upper-case topics in the topic list.
If you narrowed to a topic that was not one of the most recent 5
topics and had uppercase characters, it would disappear from the
topic list as soon as all of its messages were read.
2016-11-16 12:17:31 -08:00
Steve Howell f4bf154981 bug fix: Fix topic unread counts for upper-case streams.
If stream names weren't entirely lowercase, then our function
topic_list.is_for_stream() was improperly reporting false and
failing to update unread counts for the active topic widget.

This regression was probably introduced in the fairly recent
53eea250d0 commit.

Fixes #2330.
2016-11-16 10:08:44 -08:00
Steve Howell 9eb825fff5 Refactor PM unread counts to use user_ids as keys.
We now use comma-delimited lists of user_ids for the following
data structures in unread.js:

    - unread_privates[<user_ids_string>]
    - get_counts.pm_count[<user_ids_string>]
2016-11-15 18:31:59 -08:00
Steve Howell 1783879108 people.js: Add methods for user_ids_string/emails_string.
Added:
    * people.user_ids_string_to_emails_string
    * people.emails_strings_to_user_ids_string
2016-11-15 18:31:59 -08:00
Steve Howell 7750d43d23 Simplify finding elements in pm_list.js.
We no longer need iterate_to_find, and we just use simpler
selectors.
2016-11-15 18:31:59 -08:00
Steve Howell f5e1dcd11d buddy list: Sidebar menu now uses user_id, not email. 2016-11-15 18:31:59 -08:00
Tim Abbott 49d24cee2a subs: Fix clearing filter table on subscribe. 2016-11-15 12:49:40 -08:00
Brock Whittaker 3d8ed7b55f subs: Rewrite Stream Filter Function.
This is more performant, along with accepting a parameter for
filtering only streams that are subscribed to if the toggle is set to
subscribed only.

Also, it now does substring matches, rather than just matching if an
entire word matches the search query.

Fixes #2141.
2016-11-15 12:21:43 -08:00
Brock Whittaker 1def0b6701 hashchange: Add hashchange ignore mechanism for overlays.
This will make it possible to do hash changes in soon-to-be-overlay
pages like the /#subscriptions and /#settings page.
2016-11-15 11:53:38 -08:00
Brock Whittaker 75db036733 Add toggle component.
This adds the toggle component which removes the necessity to have HTML.
2016-11-15 10:20:37 -08:00
Steve Howell 26857ac3aa admin: Use helpers when opening user form. 2016-11-15 09:37:47 -08:00
Steve Howell 7656c31769 Extract admin.get_email_for_user_row(). 2016-11-15 09:37:47 -08:00
Steve Howell 33a87492e2 admin: Remove obsolete active_user_row class. 2016-11-15 09:37:47 -08:00
Steve Howell ecfac010fc Extract admin.set_up_deactivate_user_modal().
This sets us up to eliminate the "active_user_row" hacks in
our next commit.
2016-11-15 09:37:47 -08:00
Steve Howell dcfb5c30c6 admin users: Fix real-time-sync for full names.
When an ordinary user changes their name, the admin sees the change
when they open the edit form now.
2016-11-15 09:37:47 -08:00
Tim Abbott e40e756d47 echo: Fix local echo sending a message to "yourself, ".
Previously, this would incorrectly include a user with name and email
"" in the recipients list shown in the local echo code path.

We fix this and add a test for the issue.
2016-11-14 21:43:13 -08:00
Steve Howell 59750a1cb9 Move more unread logic out of stream_list.js.
There are two split-outs code of the code here:

    - Animation stuff is in unread_ui.js.
    - PM unread counts get handled by pm_list.js.
2016-11-14 17:50:55 -08:00
Steve Howell 7c1711179c Rename subject_count class to topic-unread-count. 2016-11-14 16:16:55 -08:00
Steve Howell 72b8200b0b refactor: Extract update_unread_count() in topic_list.js.
This function does the "heavy" lifting of updating an unread
count.  (It's not exactly heavy lifting, but it makes it so
the parent just needs to find the outer element of the unread
div, using whatever method makes sense for the parent.)
2016-11-14 16:16:55 -08:00
Steve Howell e7a2b51647 Consolidate people searches (buddy list/subscribers).
We now use the same people-filtering code for the buddy
list that we use in subscriber search.
2016-11-14 16:01:13 -08:00
Steve Howell 71d93207cd Match "Charles Dickens" with "ch di" in subscriber search. 2016-11-14 16:01:13 -08:00
Steve Howell 6eb1dc3e73 Refactor filter_people_by_search_terms().
Build individual matchers for each search term.
2016-11-14 16:01:13 -08:00
Steve Howell 2746518f3c Make subscriber filter match on emails.
We will match emails that start with search terms.
2016-11-14 16:01:13 -08:00
Steve Howell 8fa519ded6 Remove some dead code in stream_list.js.
I forgot to remove this code in a recent refactoring that copied
this code into activity.js.  It should not have caused any errors,
but it's no longer needed.
2016-11-14 15:53:23 -08:00
Steve Howell 47ef26fa55 refactoring: Let activity.js manage its own unread counts.
This change breaks a needless dependency of activity.js on
stream_list.js.
2016-11-11 12:27:03 -08:00
Steve Howell f3373d62e1 stream sidebar: Clean up unsubscribe logic.
From subs.js we don't redundantly try to remove an element
from ths sidebar; we just trigger the event.

In stream_list.js we continue to remove the element from
the DOM, and we also remove the widget from our internal
Dict of sidebar rows, so that if we re-subscribe, we know
we'll automatically re-build the widget from the template
and the latest data from stream_data.js.
2016-11-11 12:12:13 -08:00
Steve Howell d867cba90b Add stream_list.stream_sidebar() class.
This new class lets us store sidebar rows inside of stream_list.js
instead of putting them on sub objects from stream_data.js.
2016-11-11 12:12:13 -08:00
Steve Howell 7b0c6459b4 Extract static/js/pm_list.js.
This handles most of the details of building the Private Messages
section in the upper left corner of the app.
2016-11-11 12:12:13 -08:00
Steve Howell af794bec7a Remove unused stream_list.get_count(). 2016-11-11 12:12:13 -08:00
Steve Howell 6a3254f83f Clean up how we build individual stream sidebar rows.
We used to have hacky code where various functions would call
build_stream_sidebar_row() to get a jQuery object, and then they
would attach the jQuery object to the "sub" object from stream_data.js.

Now build_stream_sidebar_row() localizes the hack of attaching
a UI object to the "sub" object to just one function (and we can
clean this up in a follow-up commit).

Also, the UI object is now a JS object that can close on some useful
state information like the stream name and encapsulate how we
toggle the inactive_stream class.

Finally, we don't have build_stream_sidebar_row() needlessly append
list items to $('#stream_filters') when we know that our callers are
going to re-build the list anyway.
2016-11-11 12:12:13 -08:00
Steve Howell 13fbb96178 Remove unnecessary call to build_stream_list().
In refresh_pinned_or_unpinned_stream(), we no longer call
build_stream_list(), because that's already called in
update_streams_sidebar().
2016-11-11 12:12:13 -08:00
Steve Howell 16cb2bce8b Remove duplicate loop in build_stream_list().
The code removed in this commit added pinned streams to a list
of elems, only to have them added again by the next block of code
(but more concisely).  Through some strange quirk of appendTo() this
never created user-facing bugs, but you could clearly see in the console
that it was doing double work.
2016-11-11 12:12:13 -08:00
Steve Howell 06f4857221 buddy list: Make Group PMs appear more quickly.
It used to be the case that you would get new messages for a
huddle, but the huddle wouldn't show up on your buddy list until
the every-50-seconds mass update of the buddy list.

Now we make sure to work with non-stale jQuery objects, and,
more importantly, we resize ourselves if we add new huddles.

(The resize issue arises due to some complicated heuristics
where we don't want group PMs to take up too much of the buddy
list for users who don't have many in their history.)
2016-11-11 12:02:48 -08:00
Steve Howell 197edcca0e buddy list: Update huddles when you fetch PMs.
This fixes a bug with the group pm section of our
buddy list.  It wasn't updating when you fetched
old private messages.

We had been calling activity.process_loaded_messages() as
part of message_store.do_unread_count_updates(), which was
called sometimes unnecessarily and sometime not called when
we needed to get huddle info.

Now we call it when we need it most, which is when you
click on "Private Messages".
2016-11-11 10:41:18 -08:00
Steve Howell eef633efa0 minor: Make get_huddles() internal to activity.js. 2016-11-11 10:41:18 -08:00
Brock Whittaker d45c050994 message_edit: Restyle message_controls options to have better spacing.
This restyles the message_controls options to center them horizontally
while fixing them closer to the right side of the edge, along with just
replacing the edit button with a preview source button once editing is
disabled.
2016-11-10 19:47:26 -08:00
Brock Whittaker 5497416a36 Move edit button to underneath message timestamp.
This moves the edit button to underneath the timestamp such that when
you hover over a message now the timestamp hides itself and the edit
button appears (if editing is allowed).

Fixes #1733 and other annoying issues with this field.
2016-11-10 19:45:09 -08:00
paxapy ade3bda025 markdown: Fix stream link handler in corner cases.
* Fixes handling of multiple stream links and invalid stream names.
* Fixes text regex so it handle hash sign the right way.
* Adds tests for these stream link cases.
2016-11-10 19:22:19 -08:00
Igor Tokarev 852bc6b491 bugdown: Re-enable support for italics in bugdown.
Fixes: #1103.
2016-11-10 19:14:40 -08:00
Rishi Gupta eeca06ea08 message_edit: Fix message editing for messages that threw a backend error.
Changes editibility type from NONE to FULL, and makes Save and Cancel
buttons work. Exposes a new bug, which is that changing the topic changes
the topic for the recipient row, rather than the message. See #2278.
2016-11-10 16:45:18 -08:00
Steve Howell b0a8e4befe topic lists: Rebuild DOM when we zoom in or zoom out.
This change sets the stage to reload more topics from the back
end when we zoom in, and it slims the DOM for the typical use
case of being zoomed out.
2016-11-10 15:55:31 -08:00
Steve Howell f923320de8 topic lists: Add get_stream_name() to topic list widget. 2016-11-10 15:55:31 -08:00
Steve Howell d8b5558699 topic lists: Refactor handling of parent element.
The widget that gets built in topic_list.build_widget()
now knows how to add itself to its parent element and expose
an interface to retrieve the parent.
2016-11-10 15:55:31 -08:00
Steve Howell 3b7430ba82 topic lists: Refactor zoom-out logic for un-narrows.
For cases where we are zoomed in to a stream and then go
to a different narrow (Home, PMs, etc.), we now let
topic_list.zoom_out orchestrate the removal of the topic list
instead of stream_list.zoom_out.

This will help us when we move to a world where topic_list
redraws topic lists on zoom-in/zoom-out, because we won't
waste effort rebuilding lists that are about to be removed.
2016-11-10 15:55:31 -08:00
Steve Howell bfc6f57195 topic lists: Move some zooming logic into topic_list.js.
The flow for topic list zooming is kind of complicated now, but
it's mostly a consequence of the way the UI works.

* stream_list tells topic_list to set up the topic list
  click handlers to have callbacks to stream_list
* topic_list click handlers call to stream_list zoom methods
  to hide/show all the other streams
* stream_list zoom methods call back to topic_list methods to
  redraw topics as needed (this isn't happening yet, but allowing
  topic_list.js to know that it's zoomed will set the stage for
  this to happen in a more controlled manner)
2016-11-10 15:55:31 -08:00
Steve Howell 53eea250d0 topic lists: Formalize that we only ever have one widget.
We now only keep zero or one widgets around in memory, and
we don't need jQuery magic any more to find the DOM elements
to remove.
2016-11-10 15:55:31 -08:00
Steve Howell 06816d19e6 topic lists: Call narrow.topic() in topic_list.js.
We no longer need stream_list.js to pass in the currently
active topic to us; we just call narrow.topic() for it.
2016-11-10 15:55:31 -08:00
Steve Howell 853126344e Add narrow.topic() helper method.
This has similar semantics to narrow.stream().
2016-11-10 15:55:31 -08:00
Steve Howell e76422b946 Use narrow.stream() instead of stream_list.active_stream_name().
We no longer use active_stream_name(), which was mostly a
duplicate of narrow.stream().  For nonsensical queries like
"stream:foo stream:bar" the behavior may change slightly here.

We know that we don't handle non-sensical queries particularly
well, but at least if we always go through narrow.stream(),
the behavior will be consistent.

I did test this with some sensible compound narrows, like searching
for a keyword within a stream.
2016-11-10 15:55:31 -08:00
Steve Howell 16e37f8874 Limit compose at-mention typeaheads to realm users.
Fixes #2240
2016-11-09 19:20:58 -08:00
Steve Howell 5e51a93688 Change stream_data.remove_subscriber() to accept user ids. 2016-11-09 15:03:08 -08:00
Steve Howell 00068f3164 Extract stream_data.unsubscribe_myself(). 2016-11-09 15:03:08 -08:00
Steve Howell 537a3b8ca8 Change stream_data.add_subscriber() to accept user_ids.
We no longer require passing in an email to
stream_data.add_subscriber(), since we only track user ids
in stream_data.js.
2016-11-08 15:49:23 -08:00
Steve Howell a03a7d4c95 peer_remove: Send user_id, not email, for unsubscribe events. 2016-11-08 15:36:29 -08:00
Mohsen Ibrahim 44c8e4c58c streamLinkHandler: render stream links correctly.
After adding the ability to add stream links to messages using
the following pattern '#**stream_name**' there was a problem
with rendering this using our markdown engine because '**' means
bold text so that would render just to bold text.
To solve this I had to add regular expression in marked.js to match
that pattern and when it matches I call handleStreamLinks in echo.js
which will correctly render it to HTML.

Fixes #2218.

[tweaked by tabbott to url-encode the stream name in the URL and
adding the missing "#" in the display].
2016-11-08 13:52:31 -08:00
Meena Rajan 30acb23314 bugdown: Add support for strikethrough in markdown processor.
[Tweaked to move tests to bugdown_data.json, add additional tests, and
add frontend processor support by tabbott]
2016-11-07 22:26:38 -08:00
umkay f4c621ffe3 admin: Enable admins to toggle supported auth methods via UI.
Add a table to the administration page that will allow realm admins to
activate and deactivate the supported authentication methods for that
realm.
2016-11-06 16:29:35 -08:00
Steve Howell 06fe4bc943 Rename subject_box to pm-box/topic-box.
I'm not crazy about the names pm-box and topic-box, but they
are less confusing now.
2016-11-05 15:03:29 -07:00
Steve Howell 8b7e9101ca topic lists: Rename expanded_subjects -> topic-list. 2016-11-05 15:03:29 -07:00
Tim Abbott ee361cbe30 js: Eliminate process_loaded_for_unread global. 2016-11-05 11:33:04 -07:00
Tim Abbott d60ec24c1f js: Move set_user_statuses to activity.js initialization. 2016-11-05 11:33:04 -07:00
Tim Abbott 6daf2b1e46 js: Move pointer initialization code out of zulip.js. 2016-11-05 11:33:04 -07:00
Tim Abbott d76f9b09a3 unread: Move consider_bankruptcy into unread module. 2016-11-05 11:33:04 -07:00
Brock Whittaker 4400665a6d subs: Move stream settings into an independent overlay.
This replaces the scrolling stream settings feature with a stream
settings overlay.
2016-11-04 17:13:26 -07:00
Tim Abbott 78ec0341c4 subs: Fix color picker issue with subscribing. 2016-11-04 17:13:26 -07:00
Tim Abbott 73f020645f subs: Remove unnecessary update_stream_color call.
The color was already being updated in the response from the server.
2016-11-04 16:37:29 -07:00
Tim Abbott a70c5eb923 colorpicker: Migrate to use stream IDs to access things. 2016-11-04 16:37:29 -07:00
Tim Abbott ab6fd87161 subs: Fix rename stream handling of email addresses. 2016-11-04 16:37:29 -07:00
Tim Abbott e6734bfada subs: Cleanup stream rename logic. 2016-11-04 16:37:29 -07:00
Tim Abbott ee976a9bdc subs: Use subscription_settings when changing descriptions. 2016-11-04 16:37:29 -07:00
Tim Abbott 45c7945818 subs: Use sub_settings in subscriber add/remove flow. 2016-11-04 16:37:29 -07:00
Tim Abbott 8e522cd933 subs: Convert stream_home_view_clicked to use sub_settings. 2016-11-04 16:37:29 -07:00
Tim Abbott 2467f765ad subs: Stop using sub_row when rendering settings. 2016-11-04 16:37:29 -07:00
Tim Abbott 16408da823 subs: Cleanup change_stream_privacy.
We now:
(1) Only look up streams by ID

(2) Correctly look up both the stream-row and subscriptions_row after
the success handler returns.
2016-11-04 16:37:29 -07:00
Tim Abbott 32a571445a subs: Use settings_for_sub when redrawing privacy stuff. 2016-11-04 16:37:29 -07:00
Tim Abbott b67c0a4ad5 subs: Move settings_for_sub and button_for_sub earlier. 2016-11-04 16:37:28 -07:00
Tim Abbott b1a5d57405 subs: Update get_subscriber_list to use subscription_setings. 2016-11-04 16:37:28 -07:00
Tim Abbott 109287dceb subs: Update descriptions in settings separately from stream rows. 2016-11-04 16:37:11 -07:00
Tim Abbott 7a59ae591a subs: Fix get_stream_name to use IDs from the DOM.
We haven't added a data-stream-name to the subscription_settings
object yet, and ideally we'd be moving away from using
data-stream-name anywhere.
2016-11-04 16:16:07 -07:00
Brock Whittaker 7d51b6a454 subs: Create get_stream_name to get stream name from UI.
This accepts an arbitrary click target in the DOM inside a stream row
or stream settings element and returns the stream name.
2016-11-04 13:53:12 -07:00
Steve Howell 2088e8420f User user_id, not email, in peer_add events. 2016-11-04 11:37:14 -07:00
Steve Howell 17e39a88ef Remove people.test_set_people_name_dict().
We use a cleaner approach to setting up test data in echo.js to
allow us to remove the one call to test_set_people_name_dict().
2016-11-04 11:37:14 -07:00
Steve Howell 8c47f7f7db Remove people.test_set_people_dict(). 2016-11-04 11:37:14 -07:00
Steve Howell 472f049cae Alphabetize subscription event cases in server_events.js.
I also split up peer_add and peer_remove into their own cases,
since they do opposite things and didn't share that much code
in common.
2016-11-04 11:37:14 -07:00
Steve Howell 38f2789152 Remove page_params.email_dict. 2016-11-04 11:37:14 -07:00
Steve Howell 3941334d00 Use user_ids for subscribers in stream_data.js.
We still shim a lot of methods to keep using emails, but the
internal data structure now has user_ids.
2016-11-04 11:37:12 -07:00
Steve Howell 7509f73f02 Clean up stream renaming in the JS code.
We now use stream_id as our key to rename streams, which
should prevent a few race conditions long term.  (We are
still possibly contending with other events that use
stream_name as a key, so this is not perfect.)
2016-11-04 11:30:18 -07:00
Steve Howell e1372ddf5d Add people.get_user_id(). 2016-11-04 11:30:18 -07:00
Steve Howell 4ace9bbd77 Remove dead code related to subs.create_sub().
Since we started handling the stream/create event properly,
create_sub() became dead code.
2016-11-04 11:30:18 -07:00
Steve Howell 4cd39010d1 Add people.get_person_from_user_id().
This requires the introduction of people_by_user_id_dict
and changes to people.add() and people.remove().
2016-11-04 11:30:18 -07:00
Tim Abbott 368b585980 subs: Redesign the rows of the #subscriptions table. 2016-11-03 17:33:33 -07:00
Steve Howell e4930d73c4 Add user_id for new users who we discover in new messages.
This change also creates a copy of the objects so that we
don't couple ourselves to the message store.
2016-11-03 16:20:45 -07:00
Steve Howell 30e01306d9 Eliminate people.reify() and mostly ignore unknown users.
If I try to send a message to an unknown user (which is possible
for some types of realms), then I simply ignore them during the
send codepath, so that I don't later need to patch up their attributes.
2016-11-03 16:20:45 -07:00
Steve Howell 15d44f8d71 Encapsulate pm_recipient_count.
We no longer store pm_recipient_count on person objects, but we
instead use a Dict to store them.  Then the new API is this:

    people.get_recipient_count()
    people.incr_recipient_count()
2016-11-03 16:20:45 -07:00
Steve Howell 9b04ec7472 Send dicts for cross realm users to JS.
We now send dictionaries for cross-realm bots.  This led to the
following changes:

* Create get_cross_realm_dicts() in actions.py.
* Rename the page_params field to cross_realm_bots.
* Fix some back end tests.
* Add cross_realm_dict to people.js.
* Call people.add for cross-realm bots (if they are not already part of the realm).
* Remove hack to add in feedback@zulip.com on the client side.
* Add people.is_cross_realm_email() and use it in compose.js.
* Remove util.string_in_list_case_insensitive().
2016-11-03 09:51:23 -07:00
Tim Abbott ebe959f2b0 tutorial: Remove low-quality alert bar onboarding flow.
This alert bar thing was buggy and didn't look that good, so let's
just remove it.  We can always write a nicer thing advertising the
desktop app later.
2016-11-02 23:41:16 -07:00
Rishi Gupta a2b6793174 message_edit.js: Put cursor at end of input on initial focus. 2016-11-02 20:54:54 -07:00
Rishi Gupta 5251460eda message_edit.js: Remove edit_row from edit_message.
I believe row.find(..) and edit_row.find(..) are the same in all these
cases.
2016-11-02 20:54:54 -07:00
Rishi Gupta 8104485c41 message_edit.js: Refactor how edit_message accesses elements.
Currently, message_edit.edit_message accesses elements of
message_edit_form.handlebars by a number of different means, and in a number
of different places. This commit is the first of two that standardizes it.
2016-11-02 20:54:54 -07:00
Rishi Gupta 9ed45eb4a1 message_edit.js: Change disabled fields to readonly to allow copying text.
Previously we disabled fields in message_edit_form.handlebars that you
couldn't edit. This meant you could see the content of the field, but not
copy it. This commit marks those fields as readonly instead.
2016-11-02 17:49:04 -07:00
deekshaarul 05d252da71 compose.js: Add translation tag to empty_topic_placeholder.
Moves the variable definition from the top of the file to inside the export
since i18n seems not be loaded at the time the file is parsed.
2016-11-02 17:46:32 -07:00
deekshaarul 6624d4e56e message_edit.js: Fix message editing behavior around empty topics.
Previously,
* We displayed "(no topic)" in .message_edit_topic when there was no
  topic;this commit changes that to a placeholder.

* We showed the .message_edit_topic_propagate dropdown when the user
  cleared .message_edit_topic, despite the fact that one cannot save
  or propagate an empty topic. This commit fixes the behavior.

Fixes #1273.
2016-11-02 17:45:23 -07:00
paxapy 2f711a070d bugdown: Add autocomplete for #StreamName links.
Fixes #1858.
2016-11-01 20:19:44 -07:00
Tim Abbott acf43f91fa composebox_typeahead: Improve whitespace. 2016-11-01 20:15:57 -07:00
Tim Abbott 6c96f3f2c7 composebox_typeahead: Refactor @mentions logic to not block #streams. 2016-11-01 20:15:57 -07:00
Tim Abbott fe2aab7571 composebox_typeahead: Remove last_at variable. 2016-11-01 20:06:34 -07:00
Tim Abbott ae336ce8b5 composebox_typeahead: Extract autocomplete_checks. 2016-11-01 20:06:03 -07:00
Steve Howell a0dadfd40a Widgetize topic_list.set_count().
This change makes most of the logic on set_count() live
on our per-stream topic list widget.  We can find the
jQuery object directly now rather than using the
complicated iterate_to_find() method.
2016-11-01 19:30:41 -07:00
Steve Howell b7b6fedf12 Widgetize activate_topic() in topic_list.js.
The activate_topic() function now lives on the object created
by build_widget().
2016-11-01 19:30:41 -07:00
Steve Howell 8c9488a904 Add topic_list.build_widget().
This gets us closer to a component model for topic lists.
2016-11-01 19:30:41 -07:00
Steve Howell eacaa37754 Make update_count_in_dom() be private in topic_list.js.
I also moved the function in the file to be nearer to other
non-stream specific functions.
2016-11-01 19:30:41 -07:00
Steve Howell aca6ba182e Render topic list items individually.
This is a precursor to being able to find topic list
items without the complexity of iterate_to_find().
2016-11-01 19:30:41 -07:00
Steve Howell 148e1e6add subs: Avoid duplicate prepend_subscriber() call.
We don't want to prepend new subscribers to our list of
subscribers in the settings page when they hit enter; we
want to wait till we get the event from the server.

This is a fairly new regression that was added when we
live-updated peer subscriber changes.
2016-11-01 14:01:29 -07:00
Steve Howell a126be3db6 Call add_in_realm() when loading people from page_params. 2016-11-01 13:55:48 -07:00
Steve Howell d70ac2fc0d Remove obsolete code for page_params.people_list.
The only module that uses people_list now is people.js, and that's
only during the page load process.
2016-11-01 13:55:48 -07:00
Steve Howell 758c040558 Make stream-invite typeahead more dynamic and accurate.
The typeahead for inviting users to an existing stream now
uses a function, not a static list, and it now only shows
users from your realm.
2016-11-01 13:55:48 -07:00
Steve Howell aadc198510 Make PM typeaheads more dynamic.
We now set source as a function, not a static list, and we grab
persons from people.get_all_persons() instead of page_params.
2016-11-01 13:55:48 -07:00
Steve Howell 40ec0189e4 Use people.get_all_persons() in at-mention typeaheads.
This is more robust than using page_params.people_list.
2016-11-01 13:55:48 -07:00
Steve Howell 06d7012113 Use people.get_all_persons() for search_suggestion.js.
This is better than using page_params.people_list, which may
go out of sync when live updates happen.
2016-11-01 13:55:48 -07:00
Steve Howell 2d945d7296 Add people.get_realm_persons(). 2016-11-01 13:55:48 -07:00
Steve Howell aa07b32d58 Add people.get_all_persons(). 2016-11-01 13:55:48 -07:00
Tim Abbott 1bc9be7aed subs: Fix stream privacy changes not working after renaming.
This fixes and issue where the change_stream_privacy template had its
own duplicate copy of the data-stream-name attribute, which wasn't
updated when streams were renamed.

Fixes #2016.
2016-10-28 16:42:32 -07:00
Tim Abbott 6927a9bdc4 subs: Update subscription settings data when renaming streams. 2016-10-28 16:41:54 -07:00
Tim Abbott 0185764be7 subs: Fetch stream name from data-stream-name. 2016-10-28 16:12:50 -07:00
Tim Abbott 9507ed8a05 subs: Move show_settings_for earlier in file. 2016-10-28 16:10:59 -07:00
Tim Abbott c10fd243f1 subs: Rename subscriber_count class to subscriber-count.
Also remove the unused subscriber-count-row class.
2016-10-28 16:07:28 -07:00
Tim Abbott c0a774ef8c subs: Remove use of $-based variable names. 2016-10-28 16:07:02 -07:00
Tim Abbott b8304c3359 subs: Find elements using the new data-stream-id value.
This is preparation for no longer having the subscription inside the
subscription_row object.
2016-10-28 16:06:40 -07:00
Tim Abbott 3727ea6fb0 subs: rename .subscription_description to .description. 2016-10-28 14:47:23 -07:00
Tim Abbott dd2fab9374 subs: Rename data-subscription-id to data-stream-id. 2016-10-28 14:47:23 -07:00
Tim Abbott 66e2632809 subs: Rename .subscription_name to .stream-name. 2016-10-28 14:47:22 -07:00
Tim Abbott f18d53d46a subs: Rename .subscription_row to .stream_row.
The new name is clearer, since we show these rows for streams whether
or not you're subscribed.
2016-10-28 14:25:00 -07:00
Steve Howell eb64b32bc8 Fix "subjects" in JS comments. Say "topics" instead. 2016-10-28 13:52:25 -07:00
Steve Howell 5fd71a6381 Rename var in sidebar_subject_list.handlebars.
s/subjects/topics/
2016-10-28 13:52:25 -07:00
Steve Howell dba3ed3d90 Rename variables in topic_list.build_list().
(s/subjects/topics/ in a couple places)
2016-10-28 13:52:25 -07:00
Steve Howell 78861d4e01 Rename recent_subjects to recent_topics. 2016-10-28 13:52:25 -07:00
Steve Howell 0a4579711d Add stream_data.get_recent_topics().
This removes the last remaining references to
stream_data.recent_subjects() outside of stream_data.js.
2016-10-28 13:52:25 -07:00
Steve Howell 6a54dfc127 Remove recent_subjects from node tests.
We now use stream_data.populate_stream_topics_for_tests(),
which hides some of the implementation details of initializing
the data structure.
2016-10-28 13:52:25 -07:00
Steve Howell 8acdf718bc Move process_message_for_recent_topics() to stream_data.js. 2016-10-28 13:52:25 -07:00
Steve Howell c799ac3126 Extract stream_data.is_active(). 2016-10-28 13:51:21 -07:00
Steve Howell ecbd77d8a5 Flip conditional in stream_list.add_sidebar_li(). 2016-10-28 13:51:21 -07:00
Steve Howell 15602ee6bb Stop using /json/streams on the client.
We no longer need to fetch streams from the server when
we render the settings page.

The name populate_and_fill() may not be a great name any
more.
2016-10-28 13:44:46 -07:00
Steve Howell 10bc093375 Stop using server data to draw "Manage Streams".
We have all the data we need on the client side.
2016-10-28 13:44:46 -07:00
Steve Howell 9d4debd1eb Live-update added/removed subscribers. 2016-10-28 13:43:09 -07:00
Tim Abbott 01f0be27a7 subs: Combine another set of settings show handlers. 2016-10-27 22:24:40 -07:00
Tim Abbott 426f2b0405 subs: combine some settings show handlers. 2016-10-27 22:22:28 -07:00
Tim Abbott 3fd94cc58a subs: s/subrow/sub_row/ in variable names. 2016-10-27 22:19:30 -07:00
Tim Abbott 12331e2596 subs: Extract show_subscription_settings. 2016-10-27 22:06:56 -07:00
Tim Abbott 30c654f83f templates: Fix stack traces throwing handlebars errors.
This fixes the fact that we weren't using `throw` correctly, and also
the "handlerbars" typo.

Fixes #2143.
2016-10-27 22:06:56 -07:00
Steve Howell f98e605840 Extract topic_list.set_click_handlers(). 2016-10-27 15:49:25 -07:00
Steve Howell 8ebf48793c minor: Remove copy/pasted comment. 2016-10-27 15:49:25 -07:00
Steve Howell 9de7551f4f Extract topic_list.rebuild().
This was pulled from rebuild_recent_topics(), which still
exists to wrap passing in the stream_li parameter.
2016-10-27 15:49:25 -07:00
Steve Howell f7e6cfc892 Extract topic_list.build_list().
This used to be stream_list._build_subject_list().  The code
didn't change except for one s/subject/topic fix.
2016-10-27 15:49:25 -07:00
Steve Howell 8783a0e51d Move remove_expanded_topics() to topic_list.js. 2016-10-27 15:49:25 -07:00
Steve Howell 9b6b743a1a Move get_topic_filter_li to topic_list.js.
This also brought along:
    iterate_to_find (copied, see large comment explaining why)
    activate_topic (extracted from a one-liner)
    set_count (formerly stream_list.set_subject_count)

For get_topic_filter_li, we now pass in stream_li instead of
stream to decouple parent/child responsibilities between the
components.

Also, I made some s/subject/topic/ fixes.
2016-10-27 15:49:25 -07:00
Steve Howell 4f38cfdc7f Extract topic_list.update_count_in_dom().
This creates the new topic_list.js module, and the first
function that we extract is topic_list.update_count_in_dom().

This function needed to be decoupled from some non-topic-list
stuff which was overly complicated.
2016-10-27 15:49:25 -07:00
Steve Howell 65a2f012d4 Simplify pin/unpin code path.
I make server_events slimmer by not handling a specific
property when subs.update_subscription_properties() should
do all the dispatching (and mostly did).

And then since update_subscription_properties() has
a "sub" already, I can call directly to stream_list code
and remove a function from subs.js.  Since I lose the
wrapper function in subs.js, I rename the stream_list
function as part of this commit.

The only code that gets slightly heavier here is that
we have two lines in the 'pin_to_top' case instead of one.
2016-10-25 23:29:15 -07:00
Steve Howell 1a927a424f Avoid passing around full_name parameter in subs.js.
All of the eventual callers to prepend_subscribers()
and format_member_list_elem() call people.get_by_email()
anyway, so now we do it one place.  The one exception
was using page_params.fullname, which is awkwardly
different than what we call that variable elsewhere
(fullname vs. full_name).
2016-10-25 18:15:24 -07:00
Steve Howell 51f0f7c7c4 Simplify creating subscriber list.
We were awkwardly reversing a list to use a one-line
helper method that did exactly the opposite of what
we wanted. :)  Now we just append simply.
2016-10-25 18:15:24 -07:00
Steve Howell 89b17ec2a4 Extract prepend_subscriber().
This is a minor change to avoid some 2-line calls in our
code.  (We're about to introduce a third usage of this.)
2016-10-25 18:15:24 -07:00
Tim Abbott 14dc98d8b9 server_events: Switch to using REST-style URLs.
This eliminates our use of /json/get_events; we'll remove that
endpoint in a future commit.
2016-10-25 18:02:16 -07:00
Brock Whittaker fd9a3f4609 admin: Remove values from emoji form input on success.
This removes the values after successfully creating a new realm emoji.
2016-10-25 17:01:03 -07:00
Tim Abbott 7ebfa25f5a message_edit: Make .save() automatically call .end() if no changes.
Previously, all of the callers of message_edit.save() would check if
it returned true, and if so, call message_edit.end().  This resulted
in various bugs in the past, so we switch to the much cleaner model of
just calling .end() inside .save().
2016-10-25 16:34:57 -07:00
Tim Abbott 05a2e57b14 message_edit: Make enter save when editing topics.
Fixes #1272.
2016-10-25 16:34:57 -07:00
Tim Abbott ff575aed99 message_edit: Fix error handling if user has re-narrowed. 2016-10-25 16:34:57 -07:00
Tim Abbott 985b4072c0 message_edit: Show a success message briefly. 2016-10-25 16:34:56 -07:00
Rishi Gupta d14f276322 topic_edit_form: Rename message_edit_topic to inline_topic_edit.
message_edit_form.handlebars already has a message_edit_topic that
refers to the topic edit section of message editing, and this made
things very confusing.
2016-10-25 16:33:20 -07:00
Rishi Gupta 82a0fe0eca actions popover: Change "Topic Edit" to "View Source / Topic Edit".
Also edit the icon to show "View Source" as the primary feature.
2016-10-25 15:12:32 -07:00
Rishi Gupta 7c227d8bb2 message_edit: Set focus to cancel button in topic-edit-only case.
Because the user was most likely intending to use the "View Source"
functionality, this makes exiting more convenient.
2016-10-25 15:11:39 -07:00
Brock Whittaker 82b5ef34be lightbox: Close lightbox if use clicks anywhere on the background. 2016-10-25 14:51:55 -07:00
Brock Whittaker 2ce601ebd1 Fix Multiple Lightbox Issues.
This fixes the following issues:
1. Photos are no longer resized larger than their native resolution.
2. Photos with transparency now have a checkerboard behind them to
signal an alpha of less than one.
2016-10-25 14:51:35 -07:00
Brock Whittaker bb23d6ed60 lightbox: Fix focus state when exiting lightbox.
Previously, exiting the lightbox and then hitting enter reopened the
lightbox with a null image.

Fixes #1982.
2016-10-25 14:48:34 -07:00
Tim Abbott 0f7c8c6d34 subs: Rerender subscriber counts from peer changes correctly.
This makes subscriber count management completely nice and real-time.
2016-10-25 14:40:24 -07:00
Steve Howell de727245aa subs: Add subscriber counts to the /#subscriptions page.
This borrows some work from krtkmj in #525.

Fixes #483.
2016-10-25 14:40:00 -07:00
Steve Howell 029682ec41 Fix stream_data.remove_subscriber().
We get events to delete subscribers for streams we are not
necessarily subscribed to, and it is now important to
process those events to produce the correct UI for showing
the number of subscribers to streams.
2016-10-25 14:29:27 -07:00
Tomasz Kolek 4790316b57 Add user setting option to always send push notifications.
Add option in user's settings for getting mobile push notifications
even if a Zulip browser is online.  Default is False.

Fixes: #1596.
2016-10-25 10:52:29 -07:00
Rishi Gupta b6da450b96 admin.js: Use RealmAlias instead of Realm to show the restricted domains.
Passes the allowed domains for a realm to the frontend, via
page_params.domains. Groundwork for allowing users to add and
remove domains via the admin setting page, rather than via the
realm_alias.py management command.
2016-10-25 10:07:20 -07:00
Tim Abbott 28cefc4996 hashchange: Fix buggy arguments to hashchanged causing scrolltop bug.
Because jQuery passes the actual hashchange event to an onhashchange
handler, the `if reload` checks in the `hashchanged` function were
always returning true, resulting in the wrong logic being used for
computing where to send the user in the event that they edited the
hash in the browser to change their narrow.
2016-10-23 20:07:12 -07:00
Rishi Gupta 49b23ea84a frontend: Allow users to see the source of messages they can't edit.
Previously we showed an "Edit" item in the actions popover menu when a user
could edit the content or topic of a message, and nothing otherwise. We now
show "Edit", "Edit Topic", or "View Source" in the popover menu for every
message, depending on the editability of the message, and present an
appropriate version of message_edit_form when the menu item is clicked.

Finishes #1604 and #1761.
2016-10-22 18:53:59 -07:00
Rishi Gupta 879f2a1e2e message editing: Refactor editability computation to use editability_types.
We compute the editability of messages in several places around the
frontend; standardize the definitions and store in
message_edit.get_editability. This commit should not change app behavior.
2016-10-22 18:52:49 -07:00
Rishi Gupta c2c389e949 message_edit.js: Refactor edit_message.
Cleanup and re-organize edit_message in preparation for the view source
changes. There are no behavior or logic changes in this commit.
2016-10-22 18:52:49 -07:00
Tim Abbott bd416c0425 message_edit: Cleanup unnecessary 2-layer nesting. 2016-10-22 18:52:49 -07:00
Tim Abbott 5b3caa4d18 message_edit: Fix tooltip with multiple messages being edited.
This fixes an issue where if there were multiple messages being
edited, all of them would have the same tooltip content.
2016-10-22 18:52:49 -07:00
Tim Abbott 5b656db303 message_edit: Clean up tooltip creation code.
This contains no functional changes.
2016-10-22 18:52:49 -07:00
Tim Abbott 0ccf8b162e message_edit: Move topic-editing-only warning.
This makes no functional change, because
`page_params.realm_message_content_edit_limit_seconds === 0` means
can_edit_content is always true.
2016-10-22 18:52:49 -07:00
Tim Abbott d5c3ad8eb5 message_edit: Only initialize composebox_typeahead if needed. 2016-10-22 18:52:49 -07:00
Tim Abbott 76d49300b3 message_edit: Move original_topic variable to a better spot. 2016-10-22 18:52:49 -07:00
Tim Abbott 0acfcbe247 message_edit: Update currently_editing_messages in clearer place. 2016-10-22 18:52:49 -07:00
Tim Abbott d2501396cf message_edit: Reindent form definition. 2016-10-22 18:52:45 -07:00
Tim Abbott 2b58fa0a19 message_edit: Move some setup code closer to where it's used.
This has no functional changes.
2016-10-22 18:40:44 -07:00
Rishi Gupta ebc8bfa6ca javascript: Change all message.is_stream to (message.type === "stream").
We need message.is_stream for some handlebars template code, but
message.is_stream should be thought of as a private variable for that
template.
2016-10-22 18:11:08 -07:00
Amy Liu 3ee777a11a Add UI for deactivating your own Zulip account.
Fixes #1009.
2016-10-20 22:29:30 -07:00
sonali0901 1bc7990327 Extract people.filter_people_by_search_terms()
This code used to be in subs.js, but now it's in people.js and has
some unit tests.

I did this w/showell as part of live coding on Zulip.
2016-10-20 21:44:26 -07:00
hackerkid bca1953aa4 Add support for !gravatar syntax in echo.js. 2016-10-20 14:40:45 -07:00
hackerkid 95b5ac1d5d Add support for !avatar syntax in echo.js. 2016-10-20 14:40:33 -07:00
Brock Whittaker e463577f30 Fix language alert to display language name.
If you chose the same language as was already selected, the alert would
say “is now the default language!” where it omits the language name.

This is the fix so that the language name appears all the time.
2016-10-19 15:17:16 -07:00
Steve Howell 4073ae09a1 streams: Use page_params.neversubbed_info client-side. 2016-10-18 17:33:58 -07:00
Brock Whittaker 10f7146ddd Change Lightbox to Support YouTube Videos.
The lightbox will now distinguish between whether or not something is a
photo and a YouTube video by the class name of the message inline
preview. It embeds the YouTube video in the lightbox as an iFrame
rather than previewing the video screenshot.
2016-10-18 14:45:47 -07:00
Steve Howell 7fd74c45d7 Clean up startup code for streams.
The startup code in subs.js used to intermingle data
stuff and UI stuff in a loop inside a called function,
which made the code hard to reason about.

Now there is a clear separation of concerns, with these methods
being called in succession:

    stream_data.initialize_from_page_params();
    stream_list.create_initial_sidebar_rows();

The first method was mostly extracted from subs.js, but I simplified
some things, like not needing to make a copy of the hashes
we were passed in, plus I now garbage collect email_dict.  Also,
the code path that initialize_from_page_params() mostly replaces
used to call create_sub(), which fired a trigger, but now it
just does data stuff.

Once the data structure is built up, it's a very simple matter
to build the initial sidebar rows, and that's what the second
method does.
2016-10-17 19:58:23 -07:00
Steve Howell d26942e72d Extract stream_list.create_sidebar_row().
This replaces add_stream_to_sidebar(), which was kind of a misleading
name, and it also adds a couple lines of code that were always
called right after calling add_stream_to_sidebar().
2016-10-17 19:58:23 -07:00
Steve Howell 869a124d7d Extract stream_data.get_streams_for_settings_page().
This function will make it easier to unit test upcoming
changes related to stream counts.

This was mostly moving code, but one change is that we
don't call create_subs() in subs.js any more (which would
have been kind of circular dependency), since the only thing
that it did besides calling a more appropriate function
in stream_data.js was to generate a trigger that was
subsequently ignored and possibly a UI trap, as we don't
want to be messing with the stream sidebar when we go into
the stream settings page.

We now simply call exports.create_sub_from_server_data() for
newly encountered unsubscribed streams (which don't belong in
the sidebar anyway.)
2016-10-17 19:58:23 -07:00
Steve Howell 965c6047db Move add_admin_options() to stream_data.js.
This function used to live in subs.js.  It's mostly a code move,
but I simplified the logic to determine whether it's subscribed
not to do a lookup into the same data structure that the sub
already came from.

I also added some tests.
2016-10-17 19:58:23 -07:00
Steve Howell cf08f04dbc Move receives_*_notifications() to stream_data.js.
This moves these functions from subs.js to stream_data.js:

    receives_desktop_notifications
    receives_audible_notifications

This makes notifications.js no longer dependent on the
bloated subs.js.
2016-10-17 19:58:23 -07:00
Steve Howell e25b67af26 Remove subs.sub_pinned_or_unpinned(). 2016-10-17 19:58:23 -07:00
Steve Howell 5dd1c2d55f Remove subs.stream_id(). 2016-10-17 19:58:23 -07:00
reyha 537c9755bf search: Fix searching for URLs.
Previously, URLs were being incorrectly treated as unknown search
operators (since they had exactly one ":" in them, just like foo:bar
for an invalid choice of foo).

Fixes #1743.
2016-10-16 15:25:46 -07:00
Tim Abbott 8f71d3702b filter: Add missing canonicalization to operator_to_prefix.
This makes it possible to reuse this function for validating whether a
given search operator is valid.
2016-10-16 14:06:55 -07:00
trueskawka aa7fd9a07c stream_creation: Add a clear error message for duplicate streams.
User is now unable to create a stream with duplicate or empty name
through the create stream modal. An appropriate error message appears
on attempt.
2016-10-16 12:59:41 -07:00
trueskawka 9c8f4d9a1e stream_filtering: Filter streams on subscriptions page.
Filter behaves similarly to filter in left sidebar, see PR #684. Added
stream input field to the stream creation modal along with other settings,
for clarity.

Fixes #455, #563.
2016-10-16 12:59:41 -07:00
Steve Howell a85f9a951a subscriptions: Remove spurious error handling.
Remove error handling in stream_data.add_subscriber() that no
longer makes sense in a world where we track streams that we
are not yet subscribed to.
2016-10-15 21:36:38 -07:00
Steve Howell 6a6f45f525 streams: Handle stream/create event. 2016-10-15 21:36:38 -07:00
Steve Howell dca5a3354e Extract stream_data.create_sub_from_server_data(). 2016-10-15 21:36:38 -07:00
Brock Whittaker 33c6960980 New Emoji Popover Dragging Mechanism.
This is a new mechanism to replicate the behavior of Emoji Box
drag-to-resize without the adverse effects of the last iteration — such
as not being able to drag to select text in the compose box.
2016-10-14 21:29:03 -07:00
Tim Abbott 0b7b15b361 subs: Reorganize encoding code a bit. 2016-10-14 12:34:01 -07:00
Tim Abbott eb5ef03ec0 subs: Encode stream names before changing stream names. 2016-10-14 12:34:00 -07:00
Mohsen Ibrahim 74baee93fa subs: Encode stream names before updating stream descriptions.
The API uses this endpoint /json/streams/<stream_name> to update
stream information such as description, since the stream_name is
part of the URI it should be encoded to escape unsafe characters.

Fixes #1986.
2016-10-14 12:33:55 -07:00
Umair Khan f1007de0f4 Handle invite remaining translation in JS.
Since we use JavaScript to insert this text, sever side tags will not
be able to handle this translation correctly.
2016-10-13 15:07:37 -07:00
Tim Abbott dd61f136a5 filter: Add is: to operator_to_prefix logic. 2016-10-11 21:01:01 -07:00
Tim Abbott d2be9241f2 feature_flags: Eliminate always true negated_search feature. 2016-10-11 20:50:47 -07:00
Kartik Maji 6d57e2a646 stream_data: Remove user from subscriber list on unsubscribe.
This fixes a bug where the .subscribers property of a subscription
object in stream_data wasn't being properly updated to remove the
current user when the current user unsubscribed from the stream.

Fixes #1667.
2016-10-11 18:19:03 -07:00
Kartik Maji b38b186aef timerender: Export render_now.
This makes it possible to use this logic for the message edit history
feature.
2016-10-11 16:48:05 -07:00
Umair Khan 36c6a5d758 Add support for changing user's name by admin.
Fixes: #1553
2016-10-11 16:36:48 -07:00
Rishi Gupta d75731f988 Realm creation flow: Remove invite page.
Previously, we sent users to an "invite your friends" page after they
created an organization. This commit removes that step in the flow and sends
users directly to the home page. We also remove the now-unused
initial_invite_page.html template, initial_invite.js (which pre-filled the
invite emails with characters from literature), and the /invite URL route.
2016-10-11 15:54:05 -07:00
Ilona Brand 4bf908c2d6 Add emoji map to the compose box.
- Expand a box full of emojis into the
compose window for users to graphically select emojis.

- Append an emoji to the end of the message when a user
clicks the emoji in the emoji box.

- Trap the escape key to always close the emoji box
before closing anything else if the box is open.

- Fixes: #147.
2016-10-10 16:12:25 -07:00
Umair Khan da86429378 Create emoji name to css class mapping.
`glue` ingores the + sign in the name of the emoji and creates the css
class without it. This causes the emoji pallete to miss '+1'
emoji. This commit creates a translation map from emoji name to css
class that we can use for the emoji popover.
2016-10-10 16:09:23 -07:00
Kouhei Sutou d7bef86d26 settings: Add missing translation tag.
User list side name must be translatable.
2016-10-09 23:12:41 -07:00
Kouhei Sutou 638d9ee262 markdown: Make subscribe notification translator friendly.
Some languages such as Japanese use different word order with
English. If the stream name must be the last word, translating to these
languages is difficult.
2016-10-09 11:19:19 -07:00
Rishi Gupta ff4d059595 Message editing: add explanation when past message edit deadline.
Adds "Topic editing only" along with the tooltip explanation to lower right
of message editing box when it's past the message content editing deadline.
2016-10-05 22:42:56 -07:00
Tim Abbott 498317d533 Fix renaming streams on web to use new API.
In 142dce2cd4, we replaced the API for
renaming a stream, but failed to actually update the javascript to use
the new API.
2016-10-04 21:48:38 -07:00
Brock Whittaker 339249602f Remove Blur on lightbox background.
This removes the blur feature as the background of the info settings
container is now #FFF.
2016-09-30 16:42:26 -07:00
Brock Whittaker 70af5b49e0 On stream click, blur so key events unbind from sidebar.
Unblur the link that was clicked so that when a user presses up/down
buttons it will automatically go back over to the individual messages
rather than tabbing up and down the sidebar.

Fixes: #1875.
2016-09-29 16:01:29 -07:00
Brock Whittaker 64238f9426 hotkeys: Fix additional downloads of images.
This fixed additional downloads of a downloaded image by following the
keypress pattern of “Download” -> Esc -> Enter -> Enter -> … where
each enter downloads the image again.

It is necessary to blur the focus on the link when closing the overlay
to prevent this.
2016-09-29 14:08:10 -07:00
Brock Whittaker f097581497 hotkeys: Fix escape key unnarrow/close lightbox interaction.
There is an issue where the unnarrow on escape was firing before the
overlay would escape. This shouldn’t happen because then when you try
to close out the overlay you also lose your spot on the page.

By changing the order, all is restored with the world.
2016-09-29 14:08:10 -07:00
Tim Abbott 66c63abfb9 hotkey: Prevent escape in lightbox from also unnarrowing. 2016-09-28 20:05:51 -07:00
Tim Abbott cfaba35b9a hotkey: Fix tab_up_down detection of arrow keys.
The new code in 65ab368ff0 incorrectly
used the closest list as a bool, and thus broken using the normal
arrow key hotkeys.
2016-09-28 00:25:32 -07:00
Brock Whittaker 87afe61860 Add overlay lightbox for displaying inline image previews.
This adds an event listener (by way of delegation) to the
.message_inline_image elements that pops up the overlay and hides it
when the overlay exit is clicked.

Fixes #654.
2016-09-27 17:50:51 -07:00
Brock Whittaker 65ab368ff0 Add arrow tab sections to home page.
This lets you use up and down arrows in certain sections on the site to
navigate lists. It also prevents potentially unwanted actions caused by
using up/down arrows in those sections.

Fixes: #1696.
2016-09-27 16:57:31 -07:00
Sahil Dua 058587da77 Remove extra new lines at the ends of Zulip authoried files.
Fixes #1627.

[tweaked by tabbott to avoid patching third-party modules, for now]
2016-09-26 21:05:24 -07:00
hackerkid 9a2e24a458 Use spinner as message preview loader. 2016-09-26 21:00:28 -07:00
Brock Whittaker c833265fae Add notification for muting with unmute option.
This adds a support a notification at the top of the screen that
alerts a user they’ve muted a stream and gives them the option to
unmute if it was an accident.

The notification disappears automatically after 4s, but if a user
moves their mouse over the notification, the timer resets to 2s after
the user moves their mouse off the notification, to make it easy for
users to read the full message and decide what to do.
2016-09-26 20:55:53 -07:00
Brock Whittaker 3a4fff837f Identify if an emoji URL is invalid and signal an error.
Previously, no error would display in the UI if the link to the emoji
image was invalid. This would happen for instance if you put in
“invalid” for the Emoji URL. No alerts would pop up but it would refuse
to add the emoji.

This catches the error and displays a notification that looks like
“Failed: Enter a valid URL.”

Fixes #1116.
2016-09-26 20:52:45 -07:00
hackerkid dc355fcf1e Use backend markdown processor in message preview.
[tweaked by tabbott to add comment and fetch the authoritative
rendering from the backend unconditionally]

Fixes #1834.
2016-09-25 22:17:40 -07:00
hackerkid 0412e1e20b Add support for markdown preview in compose area.
This doesn't currently use the backend markdown processor, so the
previews are not completely faithful.

Fixes #217.
2016-09-21 22:33:35 -07:00
Brock Whittaker f87c78d3f1 Add preview button to subscriptions page.
This adds a preview button to the subscriptions page to allow a user
to check out the stream without having to subscribe.

The button’s default state is hidden but on subscription row hover it
shows itself.

The preview button updates its text from "Narrow" to "Preview" and
back when a user subscribes and unsubscribes from a stream.

Fixes: #1519.
2016-09-19 22:13:47 -07:00
Tim Abbott 47045179fc Fix traceback rendering narrows to non-subscribed streams.
This fixes a bug where Zulip would throw a TypeError if the user were
to try to narrow to a stream they had never been subscribed to.  With
the new "preview" feature on the subscriptions page, this will now
happen much more often.
2016-09-19 22:10:52 -07:00
Brock Whittaker 706f422c3a Massively refactor settings page templates and styling.
This restructures the styling for the Zulip settings and
administration pages to minimize use of Bootstrap and use a consistent
styling library for similar elements.

While it is basically a wash in terms of the page's visuals, it will
make our life a lot easier for future work on improving the settings
pages section of the site.
2016-09-19 21:55:06 -07:00
Tim Abbott 9ed5ccd332 alert_words: Use the ID to reference create_alert_word_button. 2016-09-19 14:23:11 -07:00
sunnypalace 3b76a489c9 Remove humbug-user-uploads and related code.
Fixes: #1672.
2016-09-19 10:52:05 -07:00
Tim Abbott 9f41fc0882 zulip.js: Remove unused javascript variables. 2016-09-12 22:40:11 -07:00
umkay 82d03d603a Update Pygments to latest upstream version.
In HTML, the line break immediately following a start tag is ignored
(see: https://www.w3.org/TR/html4/appendix/notes.html#h-B.3.1). An
extra span tag has been introduced in the upstream Pygments
HtmlFormatter in order to preserve the first new line. The Bugdown
Tests as well as our fenced_code.js frontend markdown processor have
been updated to reflect this new behavior.
2016-09-12 21:58:25 -07:00
Rishi Gupta bba2465f89 Change links to /api to be relative or with {{ realm_uri }}. 2016-09-08 17:05:34 -07:00
Umair Khan bc2069aec2 Suppress @-all mentions for muted streams.
Fixes: #1151
2016-08-31 19:34:53 -07:00
Steve Howell 51f35f2ff7 subject/topic: Rename empty_subject_placeholder. 2016-08-26 20:26:24 -07:00
Steve Howell a929c6a8ba subject/topic: Rename process_message_for_recent_subjects(). 2016-08-26 20:26:24 -07:00
Steve Howell 0c8c1bb4ae subject/topic: Rename remove_expanded_subjects(). 2016-08-26 20:26:24 -07:00
Steve Howell 8216a42d85 subject/topic: Rename same_stream_and_subject(). 2016-08-26 20:26:24 -07:00
Steve Howell 93095eca85 subject/topic: Rename rebuild_recent_subjects(). 2016-08-26 20:26:24 -07:00
Steve Howell e53b0f564f subject/topic: Rename unread_subjects to unread_topics. 2016-08-26 20:26:24 -07:00
Brock Whittaker 64079b382f Channel popup unsubscribe button.
From the popups that appear when clicking the down-arrow in the left
column's streams, you can now unsubscribe from that particular
channel. This runs on the same function that unsubscribes you from
streams in the "Subscriptions" tab.

Fixes: #1554.

[tweaked by tabbott to fix some errors]
2016-08-26 20:22:11 -07:00
Brock Whittaker 5de33c94be Add padding to checkboxes and fix HTML.
The ‘for’ attribute is not valid HTML in the case of this because the
emails are invalid character sets and the input has no ID with the
email.

This changes it to a data-name which is still searchable but doesn’t
interfere with typical input behavior.

The checkboxes no longer float-left, fixing an issue with the
subscribe buttons leaning right in narrow windows.

Fixes: #1491.
2016-08-26 15:03:45 -07:00
Brock Whittaker e52d618f1b Switching from $.parseJSON to JSON.parse.
There are no modern browsers that do not have built in JSON parsing
abilities. We do not need $.parseJSON as it now just serves as a call
to JSON.parse.
2016-08-25 14:22:48 -07:00
Brock Whittaker 636d2df868 Convert misuses of attr to properly use prop.
Attr now returns “checked” instead of true and “” instead of false in
higher versions. This fixes those issues.

The attr(“data-*”) have also been covered to data() as well.
2016-08-25 14:22:28 -07:00
Brock Whittaker c16ab8d173 Set ajaxError to document, not body.
Body is deprecated and it should be bound to document instead.
2016-08-25 14:13:48 -07:00
Brock Whittaker d02414ee88 Switch from deprecated $.browser to userAgent test.
$.browser is not supported in higher versions of jQuery. The solution
is to instead use vanilla JavaScript to test the navigator.userAgent
property for the browser.

Fixes: #1033.
2016-08-25 14:12:58 -07:00
Steve Howell ba9e7e290d frontend: Extract dispatch_normal_event().
Extract dispatch_normal_event() from the inner
function dispatch_event() in get_events_success()
in server_events.js.  Also, alphabetize the cases in
the switch statement.  This starts to address #1541,
but see the discussion on the ticket for how we can
continue to clean up our event dispatching.
2016-08-22 20:18:02 -07:00
Tomasz Kolek b1b864341c Fix @all spam warning when typing @all in backticks.
When user'd like to send a message with @all in backticks
they see spam warning in spite of the fact that nobody
would be alerted.

Fixes: #1505.
2016-08-18 16:10:09 -07:00
Tomasz Kolek 5c82e53b9a Move checking all/everyone message to util.js module.
Create is_all_or_everyone_mentioned function in util.js.
2016-08-18 16:10:09 -07:00
Brock Whittaker d8f108a5cf Removing unnecessary comment.
This removes a comment that is dated and no longer relevant.
2016-08-18 15:32:30 -07:00
Brock Whittaker 6936d49202 Live update new avatars across users.
This sends an event when a new avatar is uploaded that refreshes the
avatar for all browser clients without the need to reload the browser.

Fixes: #1359.
2016-08-18 15:32:29 -07:00
Tim Abbott 28eae24882 Add some links to new pointer docs. 2016-08-16 16:19:14 -07:00
Brock Whittaker f7dac2b2e3 Show hex input field on color picker.
This enables the input field in the color pickers that allows users to
specify the hex of the color they would like to apply.

Fixes: #1364.
2016-08-16 11:31:52 -07:00
Rishi Gupta 902a7fbfe9 Change relative paths to absolute paths when we don't want the subdomain.
Changes relative path to an absolute path (that doesn't contain the
subdomain) for various links to
/create_realm, /api, /apps, /integrations, /hello, /terms, and the logged
out / (the Zulip in the upper left corner of portico)

I typically left links internal to the relevant pages (e.g. a link from
integrations.html to a subpage of integrations/) as relative links, and
changed external links from within the app to the absolute path (e.g. the
link to integrations from the gear menu).
2016-08-13 16:27:36 -07:00
Umair Khan 8bf4d9288d Create a nice default language modal.
Fixes: #1396.
2016-08-10 16:22:36 -07:00
Umair Khan 99c430f707 Make English the fallback language in i18next.
Fixes: #1580
2016-08-10 16:06:57 -07:00
Tim Abbott 7736925d5b compose: Fix sending PMs to Zephyr users. 2016-08-10 15:36:00 -07:00
Steve Howell ccb1d54e55 Export server_events._get_events_success for testing. 2016-08-09 18:49:13 -07:00
ukhan dced137f6f Fix function formatting in admin.js 2016-08-09 17:52:25 -07:00
Rag Sagar 2fef36f15a Add realm-level default language setting.
Adds a new field default language in the zerver_realm model.
This realm level default language will be used as default language
for newly created users. Realm level default language can be
changed from the administration page.

Fixes #1372.
2016-08-09 17:38:29 -07:00
Tim Abbott 9441154316 debug: Fix actual traceback being hidden in blueslip.
When in debug mode, previously an explicit `blueslip.error()` call
would not display the original stack trace of the error, making
debugging difficult.

This isn't perfect, in that it seems to display some tracebacks
multiple times, but at least the trace is available.
2016-08-09 11:59:49 -07:00
Tim Abbott 469df75ab7 Fix admin.update_default_streams_table errors if tab not open.
It turns out that our logic for updating the default streams table
crashed in the case where the administration tab was not open.

Fixes: #1540.
2016-08-09 11:59:32 -07:00
Brock Whittaker e34b9be950 Append color picker to #subscriptions_table instead of document.body.
Adding the container attribute to the color picker options parameter
modifies the behavior of the spectrum function to allow the color
picker to be attached to the #subscriptions_table element rather than
the default document.body element.

This allows for the color picker to scroll with the subscriptions page,
fixing the bug where the color picker would not scroll up/down the page.

Fixes #1293.
2016-08-09 09:07:55 -07:00
Tomasz Kolek 192f0f93e2 Change post-invite success message in case when user invites only one user.
Fixes: #1412.
2016-08-05 14:48:10 -07:00
Tim Abbott 2867c019cb Don't show special empty narrow messages for complex narrows.
Previously we showed an empty narrow error message determined entirely
by the first operator, even though there could have been multiple
operators.
2016-07-31 19:38:19 -07:00
Kartik Maji cea079279e Improve error message when narrowed to nonexistant or silent users.
Fixes #1418.
2016-07-31 19:38:17 -07:00
Tim Abbott 375551aaa6 Clean up most hardcoding of mit.edu domain checks.
This moves all this code to be gated on a few virtual realm settings.
2016-07-26 20:30:12 -07:00
Tim Abbott c17676b00c Cleanup MIT hardcoding for disabling presence. 2016-07-26 20:30:12 -07:00
Eklavya Sharma 5ce80eb4ba Update types of images accepted as avatars.
* Reject SVG in frontend because backend doesn't accept it.
* Add JPEG format in backend tests for avatar upload.
2016-07-26 16:36:47 +05:30
Umair Khan dce48d58b6 Cache translations.
Fixes: #1158
2016-07-21 10:23:31 -07:00
acrefoot c671ae22d1 Error better when handlebars template is missing (#1338)
Currently if you try to use a non-existent handlebars
template, you get this error:

Uncaught TypeError: Handlebars.templates[name] is not a function

This change makes it a little more clear what the issue is
and what the fix would be.
2016-07-20 15:56:27 -07:00
Tim Abbott fb386da552 settings: Extract settings.SAVE_FRONTEND_STACKTRACES. 2016-07-19 15:28:41 -07:00
Tim Abbott 0aaa55fb8f settings: Extract settings.SHARE_THE_LOVE. 2016-07-19 15:28:41 -07:00
Rishi Gupta d529a94e4d Add realm setting to time-limit editing of message content.
This is controlled through the admin tab and a new field in the Realms table.
Notes:
* The admin tab setting takes a value in minutes, whereas the backend stores it
  in seconds.
* This setting is unused when allow_message_editing is false.
* There is some generosity in how the limit is enforced. For instance, if the
  user sees the hovering edit button, we ensure they have at least 5 seconds to
  click it, and if the user gets to the message edit form, we ensure they have
  at least 10 seconds to make the edit, by relaxing the limit.
* This commit also includes a countdown timer in the message edit form.

Resolves #903.
2016-07-15 13:55:49 -07:00
Preston Hansen 87e485c89f Add error message when user attempts to submit empty alert word.
Resolves #1194.
2016-07-13 21:07:20 -07:00
Jeff Fowler 6102110a1b timerender: Include year in message interstitials.
For longer running servers, searching the backlog can become ambiguous
since the date stamps that demarcate the messages only include the month
and day. This commit changes the behavior to include the year for
messages which are more than a year old.
2016-07-12 18:26:42 -07:00
Rishi Gupta 235162e000 admin.js: Rename overloaded variable.
We were using data for both the request and response data in
$(".administration").on("submit", "form.admin-realm-form".
Left the request data as data to be consistent with the rest of the
file, renamed the response data to response_data.
2016-07-12 17:41:48 -07:00
Rishi Gupta 43c2f35776 Add realm setting to disable message editing.
This is controlled through the admin tab and a new field in the Realms
table.  This mirrors the behavior of the old hardcoded setting
feature_flags.disable_message_editing.  Partially resolves #903.
2016-07-10 11:57:24 -07:00
Tim Abbott cb18ef07a7 Rename hashchange.zulip event to avoid jquery 1.8 interaction. 2016-07-08 11:09:09 -07:00
Umair Khan 53662ccd11 Cache email address hint content.
This substantially improves the performance of loading the
/#subscriptions page with 1000+ streams in the realm.
2016-07-07 11:39:52 -07:00
Kartik Maji e5a3339725 Add search box for filtering users to add when creating new streams.
Fixes: #779.
2016-07-06 16:01:33 -07:00
Umair Khan 4c178bc00f Improve the alert messages for display settings. 2016-07-04 11:56:02 -07:00
Umair Khan 035fceb814 Add dynamically loaded language dropdown. 2016-07-04 11:56:02 -07:00
Kartik Maji f8bb7503e6 Add ability to pin streams to top of the streams sidebar list.
Based on work by Lauren Long, with some tweaks by tabbott.
2016-06-30 22:26:09 -07:00
Alex Wilson 2f47945981 Separate unicode emojis from named emojis. 2016-06-30 15:48:02 -07:00
Alex Wilson b040839c76 Add unicode emoji to frontend markdown parser.
Fixes 2nd half of #1011.
2016-06-30 15:48:02 -07:00
Vishnu Ks e4b72c3a65 Move respond_to_message to compose.js. 2016-06-29 13:04:02 -07:00
Umair Khan 3115e13caf Remove extra call to i18n.t. 2016-06-27 14:17:47 -07:00
Preston Hansen 57dec15c6c Update alert word UI to match the style of bots.
Resolves #1075.
2016-06-24 16:43:19 -07:00
Tomasz Kolek e6861636c8 Fix editing messages by adding or removing leading /me.
Previously, this did not correctly rerender the message to be (or not
to be) rendered as a /me style message.

Fixes: #835.
2016-06-24 11:18:29 -07:00
Michael Cordover a51ec44005 Search streams from left sidebar (resolves #565).
Assigns hotkey 'w' to search streams.
Only show search box when active. Activate with hotkey or by clicking
STREAMS.
Filter matches at the beginning of words in stream name.
Behaviour is otherwise almost identical to user search.
Casper tests.
2016-06-23 17:21:57 -07:00
Vishnu Ks 574a304b12 Mention invite emails are printed in console in dev.
This is part 2 of #1046.
2016-06-23 17:07:11 -07:00
Umair Khan 939ebbbc98 Mark report_error arguments translatable. 2016-06-23 16:23:01 -07:00
Umair Khan 4da1a3ecd6 Mark report_success arguments translatable. 2016-06-23 16:23:01 -07:00
krtkmj 734ab8d5e3 Correctly narrow to stream using search box from subscription page.
Fixes #1012.
2016-06-23 15:20:57 -07:00
Taranjeet 3ca76b63c9 Remove use of $(document).data('events') to enable jQuery 1.8 upgrade.
jQuery renamed this (not supported) API in jQuery 1.8.

Fixes #1034.
2016-06-23 14:06:47 -07:00
James Porter 25a13cb09b Defer loading zxcvbn in main webapp until necessary.
We only use zxcvbn in the main webapp for checking the user's password
in the change password form.  Since zxcvbn is a very large javascript
library (~700KB), loading it asynchronously only when a user is trying
to change their password results in a significant performance
improvement for loading the Zulip webapp on a slow network.

Fixes #263.
2016-06-22 17:06:37 -07:00
Vishnu Ks 055c7eed04 Tweak the CSS of skip-tutorial button. 2016-06-21 14:23:17 -07:00
Umair Khan c61a3dfbcc Ensure translations are loaded.
Since i18next loads translations asynchronously we need to make sure
that they are loaded before we call the JS code which depends on them.

Fixes #982
2016-06-20 11:31:28 -07:00
Tim Abbott 7f06fec9d5 Fix spelling of _streams_deferred. 2016-06-14 16:36:54 -07:00
Tim Abbott c7f0e66f7e Replace deprecated jQuery deferred.isResolved(). 2016-06-14 16:36:54 -07:00
Tim Abbott 02e6d267f1 [third] Replace jquery-caret with newer implementation.
Apparently, there are like 5 independently developed jquery-caret
plugins, none of which are great.  The previous one we were using was
last modified in 2010.  This new one comes from
https://github.com/acdvorak/jquery.caret and at least doesn't use
deprecated jQuery syntax and has a repository on GitHub.

This plugin is way larger than it needs to be for what it does, but we
can deal with that later.
2016-06-14 16:36:51 -07:00
Michael Cordover 53e23743ca Refactor hotkey logic.
Place all hotkey names into a set of three objects in hotkeys.js:

 * hotkeys_shift_insensitive
   These are keys where the behaviour is the same whether they are
   pressed with shift or not.

 * hotkeys_no_modifiers
   These are keys where the event should only be fired when shift
   is not being pressed.

 * hotkeys_shift
   These are keys where the event should only be fired when the key
   is pressed simultaneously with shift.

Each object is a dictionary of key value pairs, with the key being
the keyscan code (e.which) for the key. This is normally the ASCII
key code. The value is an object with two properties, name (which
is the event name) and message_view_only, a boolean. Hotkeys with
message_view_only set to true will not be fired when the home tab
is obscured.
2016-06-13 15:43:49 -07:00