Commit Graph

432 Commits

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