Commit Graph

542 Commits

Author SHA1 Message Date
Tim Abbott 149ca79a2b node: Fix test failure due to recent capitalization change. 2017-03-08 12:41:21 -08:00
Umair Khan 935cacfc86 capitalization: Fix View Source. 2017-03-08 12:33:37 -08:00
Steve Howell a246d2dcb3 refactor: Eliminate presence_info params.
It's easier to reason about the activity.js code if we just
make it clear that presence_info is a global singleton.  Going
forward, functions that use that data will explicitly refer to
exports.presence_info.

This change makes some tests slightly more awkward to set up, but
with the actual code you now don't have to question whether there
are multiple copies of presence_info to maintain.

The diff for compare_function is a bit confusing to read, but it's
basically just de-dented since we don't need to parameterize the
compare function any more.
2017-03-08 11:32:23 -08:00
Brock Whittaker 4d5aa3ddc9 Restyle and refactor .message_controls for better UX.
This refactors the .message_controls to stop relying on absolute
positioning and strange CSS, and throws them inline.

This also restyles so they hang to the right of the time which is now
always present.

Fixes: #3761.
2017-03-06 22:24:21 -08:00
Steve Howell f8819256b0 Use stream_id in update_subscription_properties(). 2017-03-05 15:44:43 -08:00
Steve Howell 95cdc744d9 refactor: Simplify code for renaming streams. 2017-03-05 11:55:09 -08:00
Steve Howell c5757ac8fe refactor: Change params for subs.mark_subscribed().
We pass in sub instead of stream_name, to support callers that
already do lookups by stream id.

And then we make the second optional argument be subscribers, since
that is all we were using from the old `attrs` argument.
2017-03-05 11:55:09 -08:00
Steve Howell 67e558f905 refactor: Pass in a full sub to sub_or_unsub(). 2017-03-05 11:55:09 -08:00
Steve Howell c38bbea6b9 Add tests for subs.sub_or_unsub(). 2017-03-05 11:55:09 -08:00
Steve Howell 8c61bb69cc casper: Fix flakiness with uploading realm icon. 2017-03-05 11:42:43 -08:00
Rafid Aslam 33129059f4 deps: Upgrade and move `handlebars` from `static/third` to `npm`.
- Remove `handlebars.runtime.js` from static/third and fetch it from npm
- Upgrade `handlebars` to 3.0.3.

I change the test since there is a patch about line, written in
handlebars'
v2.0.0-beta.1 release note:
"Lines containing only block statements and whitespace are now removed."

Fixes part of #1709.
2017-03-04 21:49:02 -08:00
hackerkid 2f073d9999 Remove sender name from message info action lines. 2017-03-04 16:25:29 -08:00
Steve Howell b8caf45262 Improve error checking for peer_add/peer_remove events.
If we get invalid events related to stream subscribers, we now
exit earlier to prevent ugly tracebacks.  We may eventually
want to upgrade some of these warnings to errors, once we fix some
of our live-update bugs.  In particular, we don't yet live-update
users when streams go from private to public, so if you add/remove
subscribers to a newly-public stream that a user still thinks is
private, they will not be able to handle the event through no
fault of the codepath that happens during the add/remove.
2017-03-03 16:03:50 -08:00
Sourav Badami 4616ee7762 Enable display of emoji as their alt codes in reactions.
This currently only supports this in emoji reactions, not in actual
emoji in message bodies, but it's a great start for people who want a
text-only view.

Tweaked to update the text by tabbott.

Fixes #3169.
2017-03-03 15:19:34 -08:00
Tim Abbott 9b11993fa7 settings: Fix need to reload when changing time format.
I noticed while reviewing #3807 that we still haven't fixed this;
because timestamps are primarily displayed in the message view, fixing
this is trivial.
2017-03-01 22:43:19 -08:00
Tim Abbott f037979fe0 zjsunit: Don't run tests on editor backup files. 2017-03-01 22:43:19 -08:00
Steve Howell ef9a28fa29 Simplify inserting users into right sidebar.
The test that is removed here was more confusing than useful.
2017-02-28 16:40:10 -08:00
Steve Howell c78e20450c Change activity.set_user_statuses to be set_user_status().
We only get one presence update at a time, so now the
activity.js function reflects that.
2017-02-28 16:26:01 -08:00
Steve Howell 339c9ad43b Remove unused my_fullname HTML class. 2017-02-28 16:26:01 -08:00
Harshit Bansal bbcd927375 bot_data.js: Replace `remove()` with `deactivate()`.
On receiving a `remove` event of type `realm_bot`, instead
of deleting the bot from `bots` dict, set it's `is_active`
flag to false.
2017-02-26 23:56:51 -08:00
Harshit Bansal 1948cb6a89 Add UI for changing the bot owners.
Add neccesary UI in #administration and #settings for
changing the bot owner. The bot owner select control
is rendered dynamically in order to avoid performance
issues in case of large number of users.

Fixes: #2719.
2017-02-26 21:39:22 -08:00
K.Kanakhin 132534b3bb realm-icon: Add realm icon frontend tests. 2017-02-26 19:55:02 -08:00
Harshit Bansal 40d137d621 bugdown: Change rendered emoji image to `unicode/<codepoint>.png.`
Use `name_to_codepoint.json` file (and the similar structure in
emoji_codes.js) to map emoji names directly to codepoints and change
the rendered emoji image to `unicode/<codepoint.png>` rather than
`<emoji_name>.png`.

Fixes: #3539.
2017-02-26 18:30:15 -08:00
Steve Howell eed41bfd0a Compare recipients using to_user_ids to fix live updates.
If you send a group PM from the home view, and then one of the
recipients changes their email, and then you send a group PM
to the same recipients, we need to make sure we don't create
a spurious recipient bar.  This fix makes this happen by
changing util.same_recipient() to look at user ids instead of
emails.
2017-02-26 16:18:02 -08:00
Steve Howell 4ae81d9063 Populate message.to_user_ids in message_store.js. 2017-02-26 16:18:02 -08:00
Steve Howell df2abf0529 Populate message.to_user_ids in compose.js. 2017-02-26 16:18:02 -08:00
Steve Howell 6c39b4775c node test: Add tests for compose.js. 2017-02-26 16:18:02 -08:00
Steve Howell 4d0d18ba14 Use stream_id in recipient comparisons.
Using stream_id in recipient comparisons fixes a
bug in this scenario: go to home view, send message
to stream, wait for admin to rename stream, send
another message to the stream.  Before this change,
the stream name would live-update but you'd get a
spurious recipient bar due to the prior message still
having the old stream name in places internally.

There were other ways to fix the live-update glitch,
but it's just generally cleaner to do stream id
comparisons.

Part of this change is to add stream_id to
compose_fade.set_focused_recipient().
2017-02-26 16:18:02 -08:00
Steve Howell c02cf5dd5c Extract compose_fade.should_fade_message(). 2017-02-26 16:18:02 -08:00
Steve Howell a38bafe6ef Add compose_fade unit tests. 2017-02-26 16:18:02 -08:00
Steve Howell b3dfa79482 Remove obsolete util.same_major_recipient(). 2017-02-26 16:18:02 -08:00
Steve Howell 98a627cba8 Add message.type guard to add_subject_links(). 2017-02-26 16:18:02 -08:00
Tim Abbott 5a204d7c84 subs: Fix capitalization in stream privacy modal. 2017-02-25 18:36:48 -08:00
Harshit Bansal f20993787c subscriptions: Add a modal for changing stream privacy.
Change the remaining "Admin settings" with a button, namely
changing a stream's privacy, to instead be a "[Change]" link
opening a confirmation modal.

Fixes: #3493.
2017-02-25 18:23:15 -08:00
Sampriti Panda 1929cc5190 Implement persistent drafts functionality
* Created a drafts modal to display/restore/delete drafts
* Created a Draft model to support storing draft data in localstorage
* Removed existing restore-draft functionality
* Added casper and node tests for drafts functionality

Fixes #1717.
2017-02-23 02:58:23 -08:00
Tim Abbott b05145d9d7 casper: Fix flaky 13-user-deactivation casper test.
This block of code:

casper.click('a[href^="#"]');

actually tried to click basically every link on the page, producing
highly undefined behavior.
2017-02-21 15:02:11 -08:00
Steve Howell 2aa7d20a51 refactor: Split build_user_sidebar() from update_users().
Activity.update_users() is still used to handle partial
updates of users in the buddy list, but now all the places
that want to re-build the whole widget go through
build_user_sidebar().
2017-02-20 15:53:14 -08:00
Steve Howell 2566a89f81 refactor: Extract activity.set_presence_info(). 2017-02-20 15:02:56 -08:00
chao1995 b3119b0d67 left-sidebar: Sort pinned streams by lowercase stream name.
The pinned streams were sorted in alphabetic order (i.e. Verona appears
before devel). The reason is that after we plucked pinned streams out from
stream_data.subscribed_streams(), we didn't sort them again, so they
remained in the alphabetic order used in stream_data.

However, we did sort unpinned streams explicitly by using custom compare
function in stream_list.js (by default sort by lowercase stream name,
but when there are more than 40 subscribed streams, sort active streams
first). That's why this issue only relates to pinned streams.

Changes were made to sort pinned streams by lowercase stream name, always,
whether they are active or not (different from unpinned streams).

Tests were added to ensure this overall sort order is correct, i.e.

1. pinned streams are always sorted by lowercase stream name.
2. pinned streams are always before unpinned streams.
3. unpinned streams are sorted by lowercase stream name, if there are more
   than 40 subscribed streams, sort active streams at the top, among active
   and inactive streams, still sorted by lowercase stream name.

Fixes #3701
2017-02-20 10:46:05 -08:00
vaibhav 35c1272525 Include stream description matches in filter results.
User search for streams will now return results where the stream
description (but not the stream name) include the string in the
user query.

The filtering process first obtains the streams whose names match the
user search query, then sorts and displays them. From the remaining
streams, it obtains streams whose description matches the query and
displays them in sorted order after the name match results. Other
streams are not displayed.

Fixes: #2674.
2017-02-20 06:56:59 -08:00
Kartik Maji 1a697b6e02 Add frontend to show message edit history.
Fixes #268.

Modified significantly by tabbott to:
* improve code cleanliness / repetition
* add missing translation tags
* move code into message_edit.js
* correspond with the new backend.
* not display the option for messages only topic-edited
2017-02-19 17:41:06 -08:00
Steve Howell 465a765cb0 Add stream_data.delete_sub().
(There was a method with the same name before, but it wasn't
being used.  The new version will accept stream_id instead
of name, and we will use it as part of deactivating streams.)
2017-02-17 15:49:43 -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
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 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
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
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
Tim Abbott 4060a97656 messages: Strip trailing whitespace in message contents.
I dug into why we never did this before, and it turns out we did, but
using `$.trim()` (which removes leading whitespace as well!).  When
removing the `$.trim()` usage.

Fixes #3294.
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 d233f617dd muting: Refactor to move side effects into UI layer. 2017-02-11 08:36:39 -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 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 d88c339cc4 casper: Use waitUntilVisible in toggle message editing tests. 2017-02-09 23:35:11 -08:00
Tim Abbott ed4f2452f2 casper: Use waitUntilVisible in realm creation tests. 2017-02-09 23:35:11 -08:00
Tim Abbott 89c515f8a5 casper: Use waitUntilVisible in narrow tests. 2017-02-09 23:35:11 -08:00
Tim Abbott 5b56fffc3c casper: Use waitUntilVisible in mention tests. 2017-02-09 23:35:11 -08:00
Tim Abbott 8ef3e7cde8 casper: Use waitUntilVisible in editing tests. 2017-02-09 23:35:11 -08:00
Tim Abbott 54883cafcc casper: Use waitUntilVisible in subscriptions tests. 2017-02-09 23:35:11 -08:00
Tim Abbott 2e290d3802 casper: Use waitUntilVisible in navigation tests. 2017-02-09 23:35:11 -08:00
Tim Abbott 532cfab846 casper: Use waitUntilVisible in settings tests. 2017-02-09 23:35:11 -08:00
Tim Abbott 1aac52d685 casper: Use waitUntilVisible in user deactivation tests. 2017-02-09 23:35:10 -08:00
Brock Whittaker 29dbb9e0b4 casper: Use waitUntilVisible and waitWhileVisible in admin tests.
This fixes a potential class of flakiness in the tests where they
interact with parts of the admin UI that aren't actually visible at
the moment via selectors, which probably doesn't test what we intend
to test properly.
2017-02-09 23:35:10 -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
Tim Abbott 708c034d93 casper: Extract 13-user-deactivation.js from 10-admin.js.
For some reason, this section of tests basically totally breaks
whatever test runs after it.  To minimize the impact of that problem,
we move it to a separate file.
2017-02-09 23:32:37 -08:00
Tim Abbott d69c40eb75 casper: Clean up some admin casper tests.
This adds missing casper.then(), some waits for relevant selectors,
and tightens some of the selectors to be more precise.
2017-02-09 23:32:26 -08:00
Tim Abbott 699257c3bf casper: Extract extended editing tests out of 10-admin.js.
The casper test file 10-admin.js had gotten to be super huge, so a
split is a good idea regardless, but this should also make quaranteen
for tests broken by the settings redesign more manageable.
2017-02-09 00:53:24 -08:00
Tim Abbott 4857f3c2d2 casper: Use casper.then consistently in realm filters tests. 2017-02-09 00:34:56 -08:00
Tim Abbott 26ae2a69a9 casper: Clean up default stream tests a bit more.
This users casper.then in a more reasonable way, and also moves the
stream_name definition to the section where it's used.
2017-02-09 00:34:04 -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
Steve Howell e6bcc01c33 email -> id: Make browser's filter for "sender" more robust. 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
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
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 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
sinwar eab355b0cd tools: Create more consistent checks for venv.
This helps make the Zulip development environment somewhat more robust
to new contributors, since it will give them a nice warning if they
try running any of our development tools outside the Zulip virtualenv.

Fixes #3468.
2017-02-06 21:50:32 -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
Tim Abbott c4ba971247 casper: Fix test failures in 06-settings due to new translations. 2017-02-03 14:32:05 -08:00
Tim Abbott a889346c9f Remove zh_CN old Django name for Chinese. 2017-02-03 14:29:03 -08:00
brockwhittaker 59743a8508 Fix for TravisCI + casper.js race condition.
This changes the markdown preview test to use the
waitForSelectorTextChange method rather than waitWhileVisible
because it was not being generated fast enough in some cases
to show correctly with waitWhileVisible.
2017-01-31 17:53:20 -08:00
Steve Howell 85cee51c68 Extract frontend_tests/node_tests/pm_list.js.
This code used to live in node_tests/stream_list.js.
2017-01-30 11:49:19 -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 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
sinwar 21083278b5 Fix banners for unknown streams.
Fixes #3443
2017-01-28 13:11:31 -08:00
Brock Whittaker 22b74a9e01 Fix node test for emojis.
This fixes the node test for emojis that broke when the type for
displaying the emojis in the popover changed to an object from a string.
2017-01-27 16:42:00 -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
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 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
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 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 38f5f3a76e tests: Move logging into test_server.py for Casper. 2017-01-25 16:33:19 -08:00
Steve Howell 929e8a48d7 Add test_message_flags() to echo node tests. 2017-01-23 16:52:12 -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
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 2af0302ed0 refactor: Use people.my_current_email() in search_suggestion.js. 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 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 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 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 10a8c3d2ae deps: Move `xdate` from `static/third` to `npm`
- Remove `xdate` from `static/third` and fetch it from `npm`.
- Bump up the `PROVISION_VERSION` to 4.3.

Part of #1709.
2017-01-19 17:07:55 -08:00
Rafid Aslam 84e802422e deps: Upgrade and move `underscore.js` from `static/third` to `npm`
- Remove `underscore.js` from `static/third` and fetch it from `npm`.
- Upgrade `underscore.js` to 1.8.3.
- Bump up the `PROVISION_VERSION` to 4.2.

Part of #1709
2017-01-19 17:07:45 -08:00
Rafid Aslam 911fcd3831 deps: Upgrade and move `codepointat` from `static/third` to `npm`
- Remove `codepointat` from `static/third` and fetch it from `npm`.
- Upgrade `codepointat` to 0.2.0.
- Bump up the `PROVISION_VERSION` to 4.1.

Part of #1709.
2017-01-19 17:07:32 -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
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
Steve Howell c6b2d531ef Extract tools/lib/test_server.py
This new module abstracts the setting up of a test
server for tests to run, pulling existing code from
casper and paving the way for API tests in the future.
2017-01-16 21:12:39 -08:00
Steve Howell 29ef623ce9 Add option to skip flaky Casper tests. 2017-01-16 21:12:39 -08:00
JefftheBest1 a9c8c826a4 Fix 'message' typo in message_list_view.js. 2017-01-16 21:11:17 -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 9806d429af Add unread.num_unread_for_stream() function. 2017-01-16 20:07:01 -08:00
Tim Abbott 450ce61e6c Fix internationalization in streams page buttons/labels. 2017-01-16 18:00:10 -08:00
Tim Abbott e1e7788e67 Fix capitalization in 'Deactivated users'. 2017-01-16 18:00:10 -08:00
Tim Abbott 56bc421a6f Rename 'Filter Streams' to 'Filter streams'. 2017-01-16 18:00:10 -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
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
Tim Abbott 7ca2d21d97 casper: Clean up some line-wrapping.
This feels a bit more readable than the original version; noticed it
while playing with the comma-dangle linter.
2017-01-11 15:23:42 -08:00
Tommy Ip e863d4d35e frontend test: De-duplicate test.
Merged two tests since they both use the same test data. The file name
of `presence_list_performance.js` also causes confusion as it is no longer
use for performance testing.
2017-01-11 14:12:41 -08:00
Steve Howell b45cd5538e Add node tests for password checks. 2017-01-10 04:55:41 -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 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
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
Rafid Aslam e1ac6fbece Add --force to `tools/run-dev.py` when run `run-casper` with --force
Add `--force` option to `tools/run-dev.py` when run
`frontend_tests/run-casper` with `--force` option.
2017-01-03 11:42:53 -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