Commit Graph

3880 Commits

Author SHA1 Message Date
Kevin Mehall 79af591b41 Show an item for @all in the autocomplete list.
Trac #1509

(imported from commit 4bc5f088a354dea4ffaf98ac2d988d9d05b19d51)
2013-07-15 13:26:45 -04:00
Kevin Mehall 191c6b6412 Refactor emoji/mention autocomplete:
* Do the string processing to extract the current token once
   when autocomplete is started in `source` rather than repeating
   it once per potential completion in `match`.
 * Store a property for whether we're completing emoji or mention
   instead of performing different tests on each step.

This reduces the lag on emoji autocomplete.

(imported from commit 7aa3f762eaf4286608809a09a3cddbbe3dfcabf9)
2013-07-15 13:26:45 -04:00
Kevin Mehall 9d8765ac24 Don't compile an unused copy of the find_mentions regex.
(imported from commit 67e4cd89a5ed038e0e5a7459d5f88aa8d04b21d7)
2013-07-15 13:26:44 -04:00
Kevin Mehall ce131a7d69 Make the @-mention regex not match in the middle of the word.
Fixes issues with e.g. foo@hamlet.com (where hamlet is a user)

The \b was ineffective because @ made it always on a word boundary.
Instead, use the negative lookbehind trick from the URL regex.

(imported from commit fdca9bd686e4f8747e67b412cba1fa7c5c9391aa)
2013-07-15 13:26:44 -04:00
Scott Feeney 8fb286ae9a On Humbughq realm, match just "#1324" as Trac link
(imported from commit 1dd243586e1a6fadff1be09a6b727a46d655e635)
2013-07-15 13:15:56 -04:00
Scott Feeney b76b06591b Match patterns that don't start on a word boundary
This allows us to e.g. match "#1329" in "Bug #1329", even though the
place between a space and a # is not a word boundary.

Also this commit factors out some repeated code used for both in-message
and subject filters.

(imported from commit 5f7d80a58e76e51ea07fed050c88c5251faaaacd)
2013-07-15 13:15:56 -04:00
acrefoot 114eeab026 Revised message actions and message info popovers
Since f8fbf70c8502 had troubles in FF and people did not like the
message-info-on-hover, this commit hopefully will work better. Tables
are likely the culprit with using dropdowns in FF, so when we stop having
the messagelist be at table, we can switch back to dropdowns which are relatively
positioned rather than absolutely on the page.

(imported from commit c49a5cd45f3439d089146771e2aa0cee6431125a)
2013-07-15 11:29:59 -04:00
Zev Benjamin 347b222c79 Make the loading more messages indicator absolutely positioned
It now appears on top of message contents.

(imported from commit ac72a38f2a3062f7107db8125e11de78e40d927e)
2013-07-15 11:13:53 -04:00
Zev Benjamin c13c7f9661 Add support for absolutely positioned loading indicators
(imported from commit 749b1e866610c686c27cd0a5a492a04dc4d00bf6)
2013-07-15 11:13:53 -04:00
Zev Benjamin 3f7d01428c Only try to destroy a loading indicator once
This didn't /seem/ to be hurting anything before, but we really
shouldn't be doing it more than once.

(imported from commit 8d4ad7f8376227db723259ec9293262233b0a69a)
2013-07-15 11:13:53 -04:00
Zev Benjamin be0c29252e Make make_loading_indicator take its optional text via an options argument
(imported from commit 935f9049c00183f52bad80d54520f81efceb3e49)
2013-07-15 11:13:53 -04:00
Jessica McKellar b372c516cc Update the minimum message size, which is used in visible message calculations.
(imported from commit 196036b34596657c5a81250a05e1d650c41324b8)
2013-07-15 10:53:04 -04:00
Jessica McKellar 1acca8edfa Rewrite within_viewport much more cheaply using getBoundingClientRect.
(imported from commit b7a4434d426a258f89a276f472e71b04c1997df7)
2013-07-15 10:53:04 -04:00
Jessica McKellar 3ddf0187b9 Remove the narrow/unarrow opacity animation.
It increases the time to narrow without really helping indicate that
you are narrowed.

(imported from commit deacd4480cd07502905cd9f157eb34bc9391f377)
2013-07-15 10:53:03 -04:00
Jessica McKellar a1cea767fe Reduce repeated height calculations in get_new_heights.
(imported from commit bc5422519d048d6be6bc53e16bd1597d704c1ff5)
2013-07-15 10:53:03 -04:00
Jessica McKellar ea582d4e12 Use getBoundingClientRect() to more cheaply see if a messages could be condensed.
(imported from commit 34d45fbc95a3597d27d167c9c02e73f9325edbee)
2013-07-15 10:53:03 -04:00
Tim Abbott 5fc6fb5896 Include a link button after the subject when it matches a realm filter.
This way if you refer to "trac #253" in the subject, it's super
convenient to get from your recipient bar to the ticket.

A note on performance: this part of rendering for 1000 messages takes
about 3.5ms for messages with 1 match; this is small compared to the
overall time for to_dict_uncached for that many message objects, so I
think this is OK for now.

(imported from commit 5bdc2b8415d7599d59eb554739f545c485b78d5a)
2013-07-15 10:41:13 -04:00
Leo Franchi dfeb40db61 Fix typo to fetch user email from user_profile object
(imported from commit 3d6294e85dc56dae00e624e00d8add158ef6aabf)
2013-07-14 18:46:40 -04:00
Leo Franchi 92fc542872 Show a on-hover cog for going directly to stream settings page
(imported from commit 9ba04d88daacd475d9b85ce7c8bd925840290535)
2013-07-12 18:34:13 -04:00
Leo Franchi 550aea8c64 Show a light STREAMS title in the streams list
(imported from commit 675ebca52ba10b8075bb788adf70d293b4d58fde)
2013-07-12 18:34:13 -04:00
Scott Feeney 91831d5ba7 Refactor compose code to clarify API
Renamed show, hide and clear to show_box, hide_box, and clear_box,
to make it a little more obvious what each one does and make them
greppable.

Also, hide and clear weren't being used by any other modules, so
these functions are no longer exported.

This resolves Trac ticket #1503.

(imported from commit 904d596ef5b8dc2154dc01ed7c9c99a54dc9b31e)
2013-07-12 18:26:13 -04:00
Scott Feeney a7963a24f8 Remove compose.set_mode in favor of compose.start
From Trac ticket #1503:

All of the calls to compose.set_mode() should be calling compose.start()
instead. Nearly all are impossible to trigger while already composing,
and by calling compose.set_mode() they just do the stuff in set_mode()
twice. The only case where this would change behavior, that I can see,
is if you press C, Shift-Tab to unfocus the compose box without
dismissing it and then press c (or vice versa). I think it's okay if we
clear the input fields in that unlikely case.

(imported from commit ba7f181ec9d1df90a443b0a754462a3a201dcabb)
2013-07-12 18:26:13 -04:00
Leo Franchi 017bd6b8b1 Don't limit ourselves to webkit for audible notifications
Previously we were checking for webkit before checking for
$('<audio>') support, but that cuts out non-webkit browsers that support
the basics of the HTML5 audio api.

Now we actually run the feature test in order to enable it, and only
check for webkit when enabling webkit-specific desktop notifications

(imported from commit 851eed86af167d0530f7e1793e2ca1f9b4cdd71d)
2013-07-12 17:28:50 -04:00
Kevin Mehall 218a7dc1bd Send message on Ctrl/Cmd-Enter.
Trac #1445

(imported from commit d9d623ea260c1eaffdcdc49773152e8cf18d3f1c)
2013-07-12 16:17:22 -04:00
acrefoot 00684e1632 Sort our emoji list lexically as opposed to the order of emoji-cheat-sheet
For completions, since we have no representation of categories, users
might expect lexical ordering.

(imported from commit d2e27dd4d8452df6ac48d44551802d7e65519115)
2013-07-12 14:33:39 -04:00
Leo Franchi e5b855d883 Add a bulk invite page for the first user in a realm
(imported from commit cf85c9d475209da4591e2f06f142008fb19ac9d5)
2013-07-12 13:07:02 -04:00
Leo Franchi bd837936ce Refactor json_invite_users into do_invite_users
(imported from commit 053274a1fcfbb93fba27d136b246b65b3491f549)
2013-07-12 13:07:02 -04:00
Scott Feeney ffa8541818 Remove vestigial parts of old minify code
(imported from commit 692e292528a1697687f1b3024c58371b2cf9b5c9)
2013-07-12 11:59:11 -04:00
Scott Feeney 0f734fad2b Don't generate minified_assets.json
The new minification process no longer needs it.

(imported from commit cd192120f74f58b10165807903b3318ae0a2c2b6)
2013-07-12 11:59:11 -04:00
Scott Feeney 2c33320746 Reuse minified JS from previous deploys
This is a big change affecting lots of areas:

* Pipeline no longer deals with JS (though it still minifies CSS)
* A new script, tools/minify-js (called from update-prod-static),
  minifies JavaScripts
* A command-line argument --prev-deploy, if passed to minify-js or
  update-prod-static, is used to copy minified JS from a previous
  deploy (i.e., a previous git checkout), if the source files have
  not changed
* update-deployment passes --prev-deploy
* Scripts are now included with the minified_js template tag, rather
  than Pipeline's compressed_js

Also, as a side benefit of this commit, our Handlebars templates will
no longer be copied into prod-static/ and accessible in production.

Unminification is probably broken, but, per Zev and Trac ticket #1377,
it wasn't working perfectly before this change either.

(Based on code review, this commit has been revised to:
 * Warn if git returns an error in minify-js
 * Add missing output redirects in update-prod-static
 * Use DEPLOY_ROOT instead of manually constructing that directory
 * Use old style formatting)

(imported from commit e67722ea252756db8519d5c0bd6a421d59374185)
2013-07-12 11:59:04 -04:00
Kevin Mehall 7f7843020d Show server errors in the message edit form.
Refactor common code from compose into a util function.

Trac #1455, #1448

(imported from commit 6fb691ac952b833655584b05f6caedaefe41c1a0)
2013-07-12 11:35:09 -04:00
Kevin Mehall 77aeee118b Check that message subject and content are nonempty on edit.
Fixes: Trac #1455, #1448
See also: Trac #213

(imported from commit 0d839da13ac22e1648b0d2a7cf09d1c1218b98ae)
2013-07-12 11:35:09 -04:00
Scott Feeney 86151bb5ef Blueslip: on staging, save stacktrace for easy c&p
(imported from commit 5c6b3ddd789100b011aeef863495ae8cb5cdaac8)
2013-07-12 11:33:17 -04:00
Scott Feeney ccec989036 Set page_params.staging on anything that isn't a prod deploy
Until now, page_params.staging has been dependent on whether DEBUG =
True. On your local server, page_params.staging is true unless you set
DEBUG to False to test minification, in which case, it's false. This
situation still counts as staging IMHO, and the new behavior will be
more useful for testing as well as consistent.

Quick reference chart:

Is page_params.staging true...  without this commit?    with this commit?
                                --------------------    -----------------
On a local server, DEBUG=True          Yes                    Yes
On a local server, DEBUG=False          No                    Yes
On staging                             Yes                    Yes
On production                           No                     No

(imported from commit 6ea960e7945844dde0fbedbe901062508312b051)
2013-07-12 11:33:16 -04:00
Leo Franchi eb0f8bda09 Ensure the last_reminder datatetime is tz-aware
I don't fully understand the need for this, but I have seen some
tracebacks on app that complain:

File "/home/humbug/humbug-deployments/2013-07-11-19-28-10/zephyr/lib/actions.py", line 1289, in handle_missedmessage_emails
    timestamp - user_profile.last_reminder < waitperiod):
TypeError: can't subtract offset-naive and offset-aware datetimes

Since timestamp in this case comes from timestamp_to_datetime
that explicitly sets the tzinfo, we know it's tz-aware. The only
other possibility is that user_profile.last_reminder is **not**
tz-aware, though I am not sure why that would be the case.

(imported from commit 67e33f4510e91fa9de504f0c610515581312c98b)
2013-07-12 09:57:09 -04:00
Allen Rabinovich c534d7cde7 A better chevron for message actions dropdown
(imported from commit 4ef172175db927f5385aceb2b369349adc47201a)
2013-07-12 06:13:20 -07:00
Kevin Mehall c2b862e238 Bugfix for 7167ed0: fade class is `message_reply_fade_narrowed` when narrowed.
It would show the recipient bar unfaded over a faded message when
narrowed to a stream.

(imported from commit 576e7bd7bdf1fbb3f241f1ba8cd1548c4546257d)
2013-07-11 17:51:38 -04:00
Scott Feeney 4313f2ff1e Set initial user presences in O(n), not O(n²) time
Previous code iteratively called set_user_status() once for each user;
which in turn was rerendering the user sidebar, also once for each user.

I changed the API a bit by replacing activity.set_user_status() with
activity.set_user_statuses(), plural, that takes an object and updates
all the user statuses in one go before rendering.

(imported from commit 1111c9029264f892f25e76d2e5e5ff996dcbc7ca)
2013-07-11 16:48:29 -04:00
Scott Feeney 8fcf208815 Use one template for all user presence rows
This will hopefully fix some lagginess when logging in on the Hacker
School realm, especially on Firefox, as the user presence rows are
populated (previously requiring hundreds of template renders).

(imported from commit 67e2d7f91ad62d8d7a2e212ee7c7121bd73f010b)
2013-07-11 16:48:23 -04:00
Waseem Daher b2fa0d4b9f Don't have huge left-and-right margins in less-wide windows.
Having a margin of 20px on both sides is rather overkill, especially
when the screen isn't super-wide. (And when it is super-wide, we can
control the width with max-width anyway.)

This actually doesn't really free up that much space -- the main
constraint actually seems to be the width of the column itself -- but
psychologically I feel like it feels a bit better.

(imported from commit 6122f0bd3042ee2faf154921c946c0bd65c956ef)
2013-07-11 15:47:08 -04:00
Leo Franchi 3525b88fa1 Add messages to all our message lists before calculating unread
(imported from commit e216246a045a3ed2de43076e89eb99648c8bac56)
2013-07-11 15:06:32 -04:00
Kevin Mehall 862f07c9d8 Update fade when returning to home view.
Fix a minor bug where if you return to the home view with a recipient
filled out, it would be unfaded.

(imported from commit d81d974dcb054c63d8a5dd5afec7b072c99d4e3f)
2013-07-11 15:00:10 -04:00
Kevin Mehall 5062a148df Don't fade when subject box is empty.
Otherwise it fades all messages.

Trac #1468

(imported from commit 393514f9f3b2b7f46945878d93e8c12e4685afeb)
2013-07-11 15:00:10 -04:00
Kevin Mehall 219a72b3a0 bugdown linkify: Improve handling of email addresses.
* Allow email addresses surrounded by <>
  * Reject things that look like email addresses that have a path after them

This requires adding a new branch to the regex specifically for email addresses.

  * Fix comment whitespace

(imported from commit 0383cd4067ae9ee31f3802e6777a200ba1cbccd6)
2013-07-11 15:00:10 -04:00
Kevin Mehall 67f908e08c bugdown linkify: Fix links that have symbols directly before them.
Be more restrictive on what characters can be part of a URL and what
characters can precede a URL to prevent linkifying other strings that
come just before a valid URL. Allow : and , before a URL.

(imported from commit f072980b39ff652edf20de0585f256f072d04e88)
2013-07-11 15:00:10 -04:00
Tim Abbott eaf3dbd902 Fix scroll position when unnarrowing after a reload when narrowed.
(imported from commit cc2f9f3f202d8331ee6cd7b9a73611d1f1f193d3)
2013-07-11 14:59:45 -04:00
Jessica McKellar dd57e0490d subs: Rearrange some of the color logic to make the linter happy.
(imported from commit dd4b8b446dae4fc12d817165f67deb423cf06166)
2013-07-11 14:42:45 -04:00
Jessica McKellar 0ad6d7ead1 Display the correct stream color in the color picker when (re-)subscribing.
(imported from commit 56d96799f3a049a0c64cef3bab7f82c9d6420cca)
2013-07-11 14:42:45 -04:00
Kevin Mehall 8df4857524 Revert to old mark as unread on view behavior.
Effectively reverts 185e865 and b67e52d.

(imported from commit e9b95f1fd9e2ab7926f15910044e9e9879ea085f)
2013-07-11 14:01:26 -04:00
Kevin Mehall 674152dae1 Show the recipient bar when the compose box is open, as long as
it's on a message that isn't faded.

Trac #1464

(imported from commit 7167ed0877d3885316b7d38af5f11ec5523d5f7d)
2013-07-11 13:41:49 -04:00