Commit Graph

1883 Commits

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