Commit Graph

3860 Commits

Author SHA1 Message Date
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
acrefoot eccdb9505b Add missing emoji, normalize {white,black}_square variants
(imported from commit 474db3fb2eeafc7bc59260d8641cfa56a84933d6)
2013-07-11 11:58:29 -04:00
Leo Franchi f0ca927fb2 Only match : preceded by a space for 😧 📝 autocomplete
(imported from commit c2a6a5be733f538b0c7dad61a1c8fdb625fcd03e)
2013-07-11 11:43:39 -04:00
Leo Franchi 8c7156acfa Don't autocomplete emoji until the 2nd letter 💻
(imported from commit 25986e2c3d939b61c4eb71596944748522d2cb54)
2013-07-11 11:41:10 -04:00
Leo Franchi b5273b4c25 Focus the next open textarea when starting a compose
Previously we had fancy logic to determine where to focus, but immediately
clobbered any focus choice we made and forced the stream selection to be in focus.
We also incorrectly determined what to focus in the case of clicking the new PM
button when in a stream narrow.

(imported from commit 01e2cec8eca068ee1d45d3cfb21607b981d5034e)
2013-07-10 17:43:46 -04:00
Leo Franchi 2d4ba0ed4b Set Reply-To to noreply@ explicitly in all required cases
It seems that even though we set the From to be <noreply@humbughq.com>
it's possible that when sending mail via Google it automatically sets
the From: field to be humbug@humbughq.com. Here we set Reply-To to noreply@
in all cases explicitly in order to avoid having replies sent to our
inboxes.

(imported from commit 5fa643be2b78fd632e310836bf1be862d6f1d333)
2013-07-10 17:38:37 -04:00
Steve Howell e736e393aa Show errors when deleting bots.
It's pretty unlikely these will come up in practice.

(imported from commit 6d809a8c98bfa09e69541d7dfd02094c16273c18)
2013-07-10 17:23:20 -04:00
Steve Howell 97994ea7a9 Shorten private operator (private-message -> private).
(imported from commit f938bd56de05cc8fc0da18348d4dec8a18c96bb9)
2013-07-10 16:58:17 -04:00
Steve Howell 43602b589f Shorten mentioned operator (mentioned-message -> mentioned).
(imported from commit 5104f75a7ed19f533ab5bca466d3e017c72bd1b8)
2013-07-10 16:58:16 -04:00
Steve Howell 600964b1de Animate removal of bot from the list.
(imported from commit 4c7e7aa07fa58c924ed78dbdc1d81c6e4bb28756)
2013-07-10 16:19:22 -04:00
Steve Howell c27e1105e5 Allow users to deactivate their bots from the website.
(The back end had been in place already.)

(imported from commit ec4b7b3ea39d71d86b0bdc161740e494ce1e13f7)
2013-07-10 16:19:22 -04:00
Tim Abbott 227995e971 narrow: Don't crash computing then_select_offset for offscreen then_select_id.
Unlike the other cases where we do this sort of offset calculation,
we're working with a message which is not msg_list.selected_id() --
which means that this message might not actually be rendered at all.
Correct for this by just letting then_select_offset stay undefined in
that case.

(imported from commit ebb8a23bf34c52f9495aa88ceca8eb4458d50be1)
2013-07-10 13:21:08 -04:00
Kevin Mehall 54d85c68e2 Avoid the focus border around modals.
(imported from commit 9f0111f9d858ab2f058e2c75c8cb00a3716cdfed)
2013-07-10 12:31:32 -04:00
Kevin Mehall c190be38fe Make modals shrink to keep buttons on the screen.
This works down to about 330px height, and is probably about the
best you can do with current browsers in pure CSS.

See also: http://caniuse.com/#feat=viewport-units

Trac #786, Trac #1416

(imported from commit eeb931bb34aa6414fdf1b61db68c6aede1808a58)
2013-07-10 12:31:32 -04:00
Kevin Mehall 4f68cf939e Don't show the subject typeahead when it's not helpful.
When it's not offering any other suggestions, suggesting what
you've typed is unnecessary and confusing and it should just
hide completely instead.

Trac #1476

(imported from commit ff69bb53c661e0a3a193dbddde6e7a4ff8b10031)
2013-07-10 11:41:12 -04:00
Jessica McKellar 6719854961 Make the tutorial popovers visible even in thin windows.
(imported from commit 0cec5db8b3a881ac1850210bd5ff4563ce2ad699)
2013-07-10 11:20:22 -04:00
Tim Abbott 98f6a20900 Fix selector when picking a custom color.
This seems to have been somehow introduced in the refactoring to move
the popovers into their own file
(36ad3c61e4d7eb05751f9b886d15edceab656d71).

(imported from commit f5f58844a9c2da4b4433489be1772263f3aba350)
2013-07-10 11:09:56 -04:00
Steve Howell 86930191ae Show up to 5 subjects in left sidebar (8 -> 5).
(imported from commit 78888034a2b71617dd6f639b4e7db4beedbb5fa5)
2013-07-09 22:30:28 -04:00
Allen Rabinovich 2176ca0977 Fix unread indicator in FF by moving the pseudoselector to an inner div that supports relative positioning. Position the indicator based on whether the sender avatar and name are included in the message or not.
(imported from commit 305343bceb8656c380afd2100220afc0d0777540)
2013-07-09 15:12:51 -07:00
Tim Abbott b8c40119a2 Don't 500 when users try to make their name super long.
(imported from commit 0c5e8baa421ed8cbff431bc5085ffe78b0a8fc1e)
2013-07-09 17:43:47 -04:00
Tim Abbott ce365829f1 Fix traceback checking for new messages on empty narrows.
(imported from commit da0ba189f23fecdee376066db956e1320bca4deb)
2013-07-09 17:43:46 -04:00