Commit Graph

3926 Commits

Author SHA1 Message Date
Waseem Daher 51f9ace595 Revert "Chevron icon on each message now causes a dropdown menu; hover on message for info"
This reverts commit f8fbf70c8502370a78159e24f3cf9589fb9d384f, since
we're waiting on some Firefox and no-hover fixes.

(imported from commit 6b13f5bb9d907303ab311afd7da584bc06538c91)
2013-07-03 17:44:35 -04:00
Steve Howell ccd759cc3f Remove dead code related to showing bots.
(The dead code made sense in the very early phases of sketching out
the feature, but it's no longer executed.)

(imported from commit 464145f227ddb25f0554bbbade0b0e3e0e399bc3)
2013-07-03 17:28:10 -04:00
Steve Howell 949d6bfc8c Clean up HTML construction for bot avatars.
(imported from commit ef9122ac739163d97b3142c7e300ce595eefa6f7)
2013-07-03 17:28:10 -04:00
Kevin Mehall 5999df005e Wrap option lists onto multiple lines where previous commits made them long
(imported from commit 856bd9f0082ef1a6e8d537316330c40266f2f25c)
2013-07-03 17:10:15 -04:00
Kevin Mehall 56bd11fa7f Don't mark messages read when the pointer lands on them when narrowing.
This is slightly inconsistent, but keeps the unread count from decreasing
when narrowing and un-narrowing.

(imported from commit 185e8653c31a312c166e784b335ae7ae7e9b78e9)
2013-07-03 17:10:15 -04:00
Kevin Mehall 0f6bdafea3 Mark all messages in view as read when you hit the bottom.
Trac #1428

(imported from commit f40d890091528969ae4e4db80adb019cbce60fef)
2013-07-03 17:10:15 -04:00
Kevin Mehall e6b2acefe2 Move message_is_visible to viewport.js
(imported from commit 9f05f8f2f00badb67325994825a904bde6958d73)
2013-07-03 17:10:15 -04:00
Kevin Mehall 22c1a66da8 Don't mark messages as read by visibility.
Trac #1428

(imported from commit b67e52d7434220e397ca20ffa49915de6633519c)
2013-07-03 17:10:15 -04:00
Kevin Mehall 318d66ed9e Apply CSS class .unread to unread message rows.
Trac #1428

(imported from commit e19d75ecd6164b9643411b4740a10527952acc0c)
2013-07-03 17:10:15 -04:00
Luke Faraone 490020b441 Serve custom fonts to OS X desktop clients
Previously we added code which prevented us from serving custom fonts to
Humbug Desktop user agents due to concerns QtWebKit bugs with
@font-face.

On OS X, we use the system WebKit so we don't have this bug. In fact,
the aformentioned change caused us to have no custom fonts at all on Mac
systems!

Here we fix this by resuming the serving of such fonts to Macs.

(imported from commit b222e9dd721914d17aed8341244cfb5c71149a12)
2013-07-03 16:37:56 -04:00
Steve Howell 009d7b8174 Shrink avatars to 35px in the Your bots table.
I tried 30px at first, but I think a slightly bigger avatar helps
fill out the table a bit.  It should be easier to tweek these in
CSS now, although Allen agrees with me that the tabular display
may be short lived when we add edit/delete features.

(imported from commit b4d69cddf63fa122374e20731a5755e7dec86304)
2013-07-03 11:49:04 -04:00
acrefoot b6bd54b350 If your event_log is empty, finish (don't fail) with more helpful message
(imported from commit b08e8fc32438fba16fbe1c3f01afc99a1b62d583)
2013-07-03 11:15:09 -04:00
Steve Howell 71dec63ad1 Fix regression with JS tests only working the first time.
The JS tests would fail on the second run due to memcache having
dirty data.  This change sets a new KEY_PREFIX whenever you launch
a server in test mode.

(imported from commit 4d41e6b79ab3bb7cb4c96b37050f0b1c9abc6b5e)
2013-07-03 10:43:24 -04:00
Jessica McKellar 078defaf15 Regardless of how you get to it, run the tutorial un-narrowed, in the Home view.
(imported from commit 9e57d098b9a4064388c12969fd77663c96597986)
2013-07-02 18:26:18 -04:00
Jessica McKellar 4567bcea1a Add fake message timestamp info needed for new date separators.
(imported from commit 20a29af1f140385f37fc1dff4e278304a2c16c4a)
2013-07-02 18:26:18 -04:00
Jessica McKellar 58780f0637 Disable hotkeys during the tutorial.
We don't want you accidentally arrowing around.

(imported from commit 6a1d18c40833007439c5c54849598438f04b13b1)
2013-07-02 18:26:18 -04:00
Jessica McKellar 04001fdc64 models: remove outdated tutorial comment.
(imported from commit 11ad15b7beb84555fae7edda92a48d5032c99994)
2013-07-02 18:26:18 -04:00
Jessica McKellar 5db6d16b4a subs: remove unused tutorial functions.
(imported from commit 666bcae369f64848c778eccf3fc97ae39986c353)
2013-07-02 18:26:17 -04:00
Jessica McKellar 46afe3be69 views: remove now-unused tutorial message sending capabilities.
(imported from commit 65d14bf469f64b47cf682f4fb36946c6d841eebd)
2013-07-02 18:26:17 -04:00
Jessica McKellar dbbc555a52 Remove now-unused do_finish_tutorial.
(imported from commit 6511d086376d1e81218cd31268f39e2145cb4d48)
2013-07-02 18:26:17 -04:00
Jessica McKellar 14e27e7583 Add the new tutorial steps.
(imported from commit 9269acbcf58332002b1d45c0134ccb2db980f05c)
2013-07-02 18:26:17 -04:00
Jessica McKellar fcf3b262d0 Add some screen divs to be used to box spotlighted content in the tutorial.
(imported from commit 2fcb357b9d812287fcb7070e16d91f5da19ffb96)
2013-07-02 18:26:17 -04:00
Jessica McKellar 5688ee5e57 Provide a function to set the get_updates timeout to 0 for the tutorial.
(imported from commit c904360ffe6fe3cacc9de37d523501a0d45f7176)
2013-07-02 18:26:17 -04:00
Jessica McKellar 672a2ef9ac get_updates: factor out success work into a function.
It has ballooned to screenfuls of code, and this refactor will help
with the tutorial.

(imported from commit 05d18558911ee7ce58b0de43eedf164b495d47ae)
2013-07-02 18:26:17 -04:00
Jessica McKellar 8d73f2d80f Load fake tutorial messages on tutorial start.
(imported from commit aa58f134d86662f090db52f9fdfd815e69f42235)
2013-07-02 18:26:16 -04:00
Jessica McKellar e2fe16af84 subs: export the ability to check and set stream colors.
We'll need this to temporarily set stream colors for the fake tutorial
messages.

(imported from commit 3a2943ccf061cf414d95dc89f3221f9986da9c64)
2013-07-02 18:26:16 -04:00
Jessica McKellar 9a40276865 views: don't defer subscribing a new users to their streams until after the tutorial.
We did this as a hack to prevent traffic while you were in the
tutorial. In the revised tutorial, we want you to see your actual
streams while you go through it, and we'll instead store the events
client-side for processing after you finish.

(imported from commit 75af93d0661c9d14b2c85624aef3f71a78053980)
2013-07-02 18:26:16 -04:00
Jessica McKellar c7d289e328 Rip out old tutorial.
(imported from commit a8f2b246f23500e93a56e028e22aa1196c017d8e)
2013-07-02 18:26:16 -04:00
Jessica McKellar bc3837f440 compose: remove tutorial check on sent messages.
We did this to check if you sent a message that would progress the
tutorial. Since the tutorial is getting overhauled we don't need this
anymore.

(imported from commit 25ee55ab034fff42a220ddd7b222b3f7459af3a1)
2013-07-02 18:26:16 -04:00
Kevin Mehall dce1f7f729 Parse @-mentions in bugdown and style them.
* This makes bugdown.convert take a `message` parameter. Properties
    for parsed mentions are added to the message object by the `Pattern`
    for use in do_send_messages.

  * Refactor repeated markdown rendering code into `Message` model methods.

(imported from commit 4f0ed5570104c0210f984b6de21e9048e2b53fa0)
2013-07-02 18:20:26 -04:00
Steve Howell 7604534050 Use get_user_profile_by_email() in tests.
We use get_user_profile_by_email() in all our tests now, as it
gives us code coverage on the function itself, and it should be
faster for tests that call it multiple times.

(imported from commit 51ebffb193980fd6f81b0ef5574d96cd92e87364)
2013-07-02 16:50:11 -04:00
Steve Howell 9e64750083 Use memcache in the test suite.
This uses a new configuration that enables memcache, but we have
to be careful to bounce KEY_PREFIX on every new test, since data
gets rolled back in the databases between tests, but not in
memcached.  We had to break up one test to work around UserProfile
objects actually being cached.

(imported from commit f201cf9cd9e0e4c61d3c384fa8d2bbd5134161e8)
2013-07-02 16:50:10 -04:00
Steve Howell 741929008b Add profiled decorator and a tool to show profiler results.
The goal here is to make it easier to do ad hoc profiling on
our codebase, particularly by running tests.

(imported from commit 71da06feb3a369dec8dc4d8391f7f40e4c2d02ff)
2013-07-02 16:47:34 -04:00
Allen Rabinovich cff0096f3b Make date boundary separators all uppercase, lighter, and letterpressed
(imported from commit 01ffbda9b4dc478732dba091e3cefced9fb1cb7c)
2013-07-02 13:08:44 -07:00
Allen Rabinovich c5e70f08f7 Make the pointer highlight lighter on private messages
(imported from commit 51f95f010336ffcfcbfae19f27efd074ec8d8be5)
2013-07-02 13:08:44 -07:00
Allen Rabinovich 090cb8b436 Switch the private message recipient bar back to a dark background
(imported from commit b172e35bf1f33eda5dc8b352d017a96530bf27b7)
2013-07-02 13:08:44 -07:00
Allen Rabinovich 332116f8fb Change the recipient bar background to a darker gray with less gradient
(imported from commit 7586453625da76623771cff9fe147d22c9f8709d)
2013-07-02 13:08:44 -07:00
Leo Franchi 779ab0e3ca Get apply_markdown value from REQ if it exists
(imported from commit c93b0a96564535c0a0162e827a67379fdf166de9)
2013-07-02 15:04:42 -04:00
Steve Howell 86e89b66e7 Make GetProfileTest tests pass deteministically.
(Make sure users have at least one message in their stream.)

(imported from commit a6654447ae9a9626f5b3d5e01ffaa00dde17c79b)
2013-07-02 13:17:35 -04:00
Leo Franchi 93765b0568 Keep variable in list comprehension from shadowing
(imported from commit 2d2bbc029d7c13b5e6f125bd5f79ba3d73d3c677)
2013-07-02 12:10:23 -04:00
Leo Franchi a2294c05d5 Send the proper Content-Type header on our Tornado responses
(imported from commit 574d2421541449fae0f91509dc3bc018e49bd24d)
2013-07-02 11:46:10 -04:00
Tim Abbott f473cb5fbe Use bulk operations in notify_subscription_{added_removed}.
After fixing the high numbers of database queries earlier in this
branch, I found that sending 500 RabbitMQ messages for a bulk change
in subscriptions was consuming more than half the time for these (and
then we'd end up with 500 events in a queue).  To handle this, we
create a "user X subscribed to these N streams" event, rather than
sending one event for each individual subscription.

(imported from commit 44a34a9fab9b67e9f0da6fee53335d8c5030392b)
2013-07-02 10:50:29 -04:00
Tim Abbott 74fd508b2f Remove subscriptions using bulk queries.
This improves the performance of unsubscribing to N streams by more
than a factor of 10 for large N.

(imported from commit a529e6d3ac4452f49c2294908d275280019bbd05)
2013-07-02 10:50:29 -04:00
Tim Abbott 7f3fded612 Add default stream subscriptions using bulk queries.
(imported from commit f6d7415269cc74836c1c331741665b01cb1090cd)
2013-07-02 10:50:29 -04:00
Tim Abbott 703dec0344 Use bulk queries to get the recipients for narrowing to MIT streams.
Otherwise we could in theory make dozens or hundreds of
memcached/database queries to handle a narrow.

(imported from commit 232f38d8c005b9aef6f12f2f9a4d68a19134d038)
2013-07-02 10:50:29 -04:00
Jeff Arnold 45116a0b61 For mit.edu, include unclasses and .d classes in narrowed views
(imported from commit e21aab715c949d4348c447e6e135281b47e06b98)
2013-07-02 10:50:29 -04:00
Tim Abbott dc54a24766 Add util.escape_regexp.
(imported from commit 3ba7caa0d444a64b228bcb5f5c658c8363ddfbf5)
2013-07-02 10:50:29 -04:00
Tim Abbott a4cf528fad Use a bulk query to fetch the streams in list_to_streams.
This substantially improves the performance of all the functions using
this helper.

(imported from commit 9c247e82f392475c8ddf46b4b498ef293911e9f5)
2013-07-02 10:50:29 -04:00
Tim Abbott a66bb508bb Use bulk queries for adding many subscriptions to a single user.
Previously we only used bulk queries when adding many users to a
single stream, resulting in very slow performance when subscribing
users to large numbers of streams (as happens when setting up a new
MIT realm user).

(imported from commit 849fa7b2a1a146c0a9adc1c727c20c9fbfb7b425)
2013-07-02 10:50:28 -04:00
Tim Abbott 738793a962 bulk_add_subscriptions: Remove incorrect comment.
This comment was only ever accurate for prototype versions of
bulk_add_subscriptions prior to it being committed to master.

(imported from commit 89b9dc49423c45553cb6c810d97eea4583ff0f69)
2013-07-02 10:50:28 -04:00
Tim Abbott c6916faca2 Genericize the bulk cache fetching logic.
(imported from commit 52664ce0ad800efff6b583e80c27701638ff6205)
2013-07-02 10:50:28 -04:00
Steve Howell e5a661c47f Remove AuthedTestCase.message_stream.
The two remaining callers just call get_user_messages directly.

(imported from commit 438252687faab7c25e8c7e7f2222974d30d8453d)
2013-07-02 10:50:02 -04:00
Steve Howell 1899584e87 Use most_recent_message() in a couple more places in the tests.
(imported from commit aecaa664db7b9486a38ec9ed375cad7220cdc98e)
2013-07-02 10:50:02 -04:00
Steve Howell 0a42d01003 Speed up and tidy up test_new_message() in UnreadCountsTest.
(imported from commit dee4c591de25b70077d6e765c10a9358a5978120)
2013-07-02 10:50:02 -04:00
Steve Howell a6ceb7dd11 Use Message.objects.count() to speed up tests.
(imported from commit dff1921b00a52929368d8a352f2ce8c05f63ec1f)
2013-07-02 10:50:02 -04:00
Steve Howell a989d5181f Speed up tests with message_stream_count().
The message_stream_count() function uses Django's count() method,
which is more efficient than doing len() on array of full objects.

(imported from commit 9c20a89a2cd02d9d39341132330d03a7f6c8be25)
2013-07-02 10:50:02 -04:00
Steve Howell 504cea7d0c Remove filter_by_subscriptions(). (dead code)
(imported from commit e6a9ef597f2dc281851b0669b64646ee10313480)
2013-07-02 10:50:02 -04:00
Steve Howell d94f91fd43 Simplify do_send_messages() from prior commit.
This change removes an "if True:" that was
introduced to make the prior commit a bit more readable.
It also combines two loops, since the second loop is no
longer conditional.

(imported from commit df58f1e5de72d5669f6468fbff54fb62cd22cedb)
2013-07-02 10:50:02 -04:00
Steve Howell a4db7de330 Actually test callbacks in GetUpdatesTest.
The tests in GetUpdatesTest had some callback logic that has
been dead code for at least three months.  We now fully exercise
the callback codepath and make sure that the callbacks do happen.

(imported from commit f5d8fbab28ecc34dc81d3d0c29058b66c10f378f)
2013-07-02 10:50:02 -04:00
Steve Howell 3f047ec703 Speed up message_stream in tests.py
(imported from commit 042a763cda33e38e370ed7a185e0b8cdd61a806b)
2013-07-02 10:50:01 -04:00
Steve Howell d3e3c21273 Mark more tests as slow.
(imported from commit 3c109d671e790c8025a4924238c921e71b57f67c)
2013-07-02 10:50:01 -04:00
Steve Howell e815433fa0 Cache api key lookups in our back end tests.
(imported from commit 09973c5355aa02c2bdda4a7cecd8721792bb3c3c)
2013-07-02 10:50:01 -04:00
Kevin Mehall 4b6b8cb3f9 Rename timerender.render_time to render_date.
It only renders the date part now.

(imported from commit 6cbfb4175a8ed1b69b99a6f16ee9eaa2cb36e0de)
2013-07-02 10:13:57 -04:00
Kevin Mehall 6b07c2cf27 Don't re-use "Last edited:" strings.
These contain timerender spans with unique IDs. If this string is cached
and re-used in a narrowed view, there are elements with duplicate IDs,
and only one of them is updated at midnight.

(imported from commit 29469fb5f0d8a9b7fe7988849d2936c49d4a038d)
2013-07-02 10:13:57 -04:00
Kevin Mehall 2857d0b4e1 Show time again in "Last edited" message.
As of f69d01b and e4a9f80, timerender only deals with the date part.
Since the time does not change when the friendly dates are updated,
just append the time outside of the span.timerender.

(imported from commit 18ec93550782c6fa8447ebc608f95da79d28dc8d)
2013-07-02 10:13:56 -04:00
Luke Faraone cf81c46c77 Omit fonts.css on QtWebKit clients
QTBUG-3467 prevents non-normal-face @font-face fonts from being used when
defined as such in CSS. To work around this, the desktop applications now
ship the Humbug font themselves, and this commit causes the server to no
longer send the problematic CSS rules to those clients.

We have some duplication insofar as we now have two minified CSS files, but
this is better than conditionally applying the CSS at page runtime.

(imported from commit 9a887f9fb8002d44171d366d1249ebbf21cc9c77)
2013-07-01 14:37:58 -04:00
Kevin Mehall 0f839522a7 Increase shown subjects to 8 (+ any unread), per discussion on
corporate > singlehop.

(imported from commit e4c28670e33ca0ea6ecb59d1ce94efb28e86e23a)
2013-07-01 13:35:00 -04:00
Kevin Mehall 371b3827d2 Show unread subjects in stream sidebar.
Trac #1403.

This shows the 5 most recent subjects, as well as any others with unread messages. This
requires tracking all subjects and filtering at display time, rather than filtering when
building the subject list.

(imported from commit 8bda7d50e6785a6e70abea4b3af4d03a16d076d3)
2013-07-01 13:35:00 -04:00
Steve Howell 1e246ba32d Use our own buttons and text field for uploading bot avatars.
(The file-input widgets that come with browsers are ugly and
nonstandard across browsers, so it is a common technique to
have your own button that controls the file upload, and it
delegates to a hidden copy of the browser file-input widget.
We also allow you to clear the file.)

(imported from commit b55ef655e75746330dc3cc396cb908670e5019cc)
2013-07-01 11:27:37 -04:00
Steve Howell 50c4990452 Right-align "Create Bot" button to its form.
(imported from commit 88449f52da11134d7c13bbb81b9346e1232ebd42)
2013-07-01 11:27:37 -04:00
Steve Howell 4af6345cf7 Align labels and fields in Add-new-bot form.
(imported from commit 238144dea105937776e0bd643d4a696492856b2f)
2013-07-01 11:27:36 -04:00
Steve Howell b06f34b55b Use portrait alignment for adding-bots form.
The add-bots form used to have a landscape alignment, as it was
integrated into the same HTML table that showed your existing bots.
This became unwieldy once we allowed users to upload avatars.

(imported from commit 246a35be77ce1679d595271e6911dc339a6813ab)
2013-07-01 11:27:36 -04:00
Steve Howell 0da7ead83d Add FormData shim for IE (used in bot avatar uploads).
(imported from commit 41cd090768c1299db3ca0d154ee5495802302a9f)
2013-07-01 11:27:36 -04:00
Steve Howell 43864edb14 Validate file types for bot avatar image uploads.
(imported from commit e250faa727c33267ff57b5956def766ff9d43c29)
2013-07-01 11:27:36 -04:00
Steve Howell bb4aafb7b0 Allow drag&drop for setting bot avatar image.
(imported from commit e480c1a5efdd08621e80ef3e8653beb5a9f095d8)
2013-07-01 11:27:36 -04:00
Steve Howell 2d888dbb23 Allow user to upload an image for their bot's avatar (front end).
(imported from commit e1de0df38fc06fabab8a715ba7bbee71d8bde7b9)
2013-07-01 11:27:36 -04:00
Jessica McKellar 88f26e013a When you have unread PMs, flash that you do in the favicon.
(imported from commit 064c1596c6413ba805d2a4b98b48926ee3f6f015)
2013-07-01 10:20:21 -04:00
Waseem Daher d9aca91662 When you change your name, properly update it in the presence list.
This fixes Trac #1163.

(imported from commit 065f33484004635104d59d3a004cc25c12fa1d2b)
2013-06-30 14:23:02 -04:00
Tim Abbott a237963c90 Fix buggy calculations of which messages get a footer.
(imported from commit 14c942e8297b2385690bb3e679cca729afd9c52b)
2013-06-28 17:54:43 -04:00
acrefoot b62d7acbc7 W3C Notifications to allow Desktop Notifications in FF too.
Caveats:

- Since Chrome has trouble using W3C Notification when it's not
  initiated by a user gesture, we try to use webkitNotification first.
- FF doesn't allow iconUrl to be of a different origin, so it won't display
  our gravatars

(imported from commit c4f99ce6927a0d203d9f220d50b06737779bd7f8)
2013-06-28 17:30:57 -04:00
Kevin Mehall 541004e4b3 Remove the date separator at the top when we scroll up and load more messages from the same day.
(imported from commit 31e4c45c77d06d4b3fd2433c858fd37bb9d907a4)
2013-06-28 17:19:05 -04:00
Kevin Mehall 41aa72ba2c Refactor/simplify timerender update code given that now all dates
that need update will update at the next midnight.

(imported from commit e4a9f801ab8ac9a3661fb66cb2c5eed7f92b6d8a)
2013-06-28 17:19:05 -04:00
Kevin Mehall 51489a4852 Collapse sender when it's the same as previous, even when far apart in time.
Trac #1393.

(imported from commit 443f39fd34eb4d6c76e73d058fb55cc0058a2e8c)
2013-06-28 17:19:05 -04:00
Kevin Mehall a9bd7377a2 Show date in a bar separating messages rather than on each message.
Trac #1393.

(imported from commit f69d01bd8149f4549694db1ff517a2d0929ffc6a)
2013-06-28 17:19:05 -04:00
Tim Abbott 4b13dc40e1 Only print errors for too-slow tests.
(imported from commit eab8ef0fc4bb5d2b135267e1d15d8bdce2626d77)
2013-06-28 15:57:29 -04:00
Tim Abbott b24093ff18 Fix dozens of unnecessary memcached queries when importing views.py.
Previously, every function which had the @json_* decorators on it
would independently call get_client when views.py was imported; we
resolve this using a small bit of in-memory caching, which is safe
since Client objects are immutable.

This also more generally cleans up the code path to be more common
between the API and JSON views.

(imported from commit 674ea327fc4cb5fa982a75e388f0b604bae66567)
2013-06-28 15:57:29 -04:00
Tim Abbott ce410799b2 Fix buggy logging of database query time.
Previously some database queries that happened prior to the request
could be counted as part of the request's in-database processing time,
resulting in confusing output where get_events spent more time doing
database queries than the total time spent processing the request.

(imported from commit 509247462d276d6020a2970f62edb33a1d633087)
2013-06-28 15:57:28 -04:00
Scott Feeney f06bc771a9 Fix #1429, smushed search bar text in Opera
(imported from commit 82a27dcc035958cda6959b1c69152e940d3993dd)
2013-06-28 13:30:51 -04:00
acrefoot bea702dd17 Chevron icon on each message now causes a dropdown menu; hover on message for info
As does the hotkey "i". It's somewhat less appropriate because it's all actions,
but it's where our "info" menu used to be, and we can workshop a better one. "a"
feels weird to me, but maybe it's just me.

You can also hover on the .message_content to see a popover with extra message details

This is for Trac #1334.

(imported from commit f8fbf70c8502370a78159e24f3cf9589fb9d384f)
2013-06-28 12:24:03 -04:00
Allen Rabinovich 013478b9b7 Align username at top of avatar and center messages vertically.
(imported from commit 38dbe1888aad1be88608f0a72d7fea8b84dd3e25)
2013-06-28 10:52:05 -04:00
Allen Rabinovich fa28f7ff5c Change a number of CSS properties to address various bugs.
This mostly applies to the previous two commits. In principle,
this could be teased out and merged into them, but the hassle
here doesn't totally seem to be worth it.

(imported from commit ee2469ca3762c50c6db49b93eec02b32589eafe3)
2013-06-28 10:52:05 -04:00
Allen Rabinovich 963a933679 Add a different pointer style with an icon in the colorbar.
(imported from commit 31e1a309b58800db90a9acdd19faba643df6f6e8)
2013-06-28 10:52:05 -04:00
Allen Rabinovich f22a13df83 Modify message list template to switch to a cleaner appearance.
* Switch to a 2-column layout by removing the old unused message tools
    column and the pointer columns.
  * Change column spans to 2 instead of 4.
  * Change recipient bar to have a colorblock on the left.
  * Add a special "last_message" class to messages that appear last
    in a message block.

(imported from commit 55036587445c699d5c55d52b0236daf402a80cff)
2013-06-28 10:52:05 -04:00
Allen Rabinovich d9f5b98aea Put recipient bar color in the message's left column.
Previously, we'd highlighted the top of the block. The theory here is
that it will make things less visually cluttered/noisy, which should
improve readability.

(imported from commit f94ec6b8e55aef9c2413718aea23b1124f5308e7)
2013-06-28 10:52:05 -04:00
Allen Rabinovich 445b07397f Make message template know if it is the last one in a block.
This allows us to do some nice styling on the final message in a group
(in this commit series, this leads to some gently rounded corners.)

(imported from commit 86e7e8586dd4ee3cd8d4ce3be43fd2abab3f1d16)
2013-06-28 10:52:05 -04:00
Allen Rabinovich db18829552 Update FontAwesome to the latest version
(imported from commit b37f743197572f9982b84c038d46169e7c9bbf2d)
2013-06-28 10:50:40 -04:00
Scott Feeney 40aa6bc667 Add chevrons to items on the stream page
(See Trac ticket #1383)

(imported from commit 15e8db20da8f6293150bd89f3616f09444e10568)
2013-06-27 21:35:58 -04:00
Steve Howell 0f3b6cd863 Show a user's bots in the order they were created.
Showing a user's bots in alphabetical order leads to a mildly
confusing experience when we append a new bot to the end of the
table, but then you hit refresh, and the new bot goes to a different
position.  Since any given user is unlikely to have zillions of
bots, I don't think we need alphabetical order to help them find
old bots.

(imported from commit 4f19dbd7a016e7d867e88248190849dcd52c6d71)
2013-06-27 17:10:05 -04:00
Scott Feeney b6d7079ec9 Remove old migrations
(imported from commit 0fdaeb68d9fe3a40220c8eb07d80ca1ae2f0cba6)
2013-06-27 16:22:47 -04:00
Scott Feeney 83cd963c49 Remove unused imports
(imported from commit 9e3050c72a2d1137b9096c6cfa1c3945341b9a56)
2013-06-27 16:22:39 -04:00
Zev Benjamin 6144f18101 Enable metrics for all production realms
(imported from commit 7ee3728ff37c244d90efd76ee69555691cf5ba97)
2013-06-27 15:57:55 -04:00
Steve Howell 2bacaf2213 Fix % formatting style in miscellaneous places.
(imported from commit 917196024c981f879355c728da9b4590e964eeef)
2013-06-27 14:41:17 -04:00
Steve Howell ef1e4c85ae Fix % formatting style in tests.py.
(imported from commit 3d39f201bf5431f36632dfdbdf231e4e405a71d6)
2013-06-27 14:41:17 -04:00
Waseem Daher 287fc22b91 Show full notification title in our fake notifications.
(imported from commit 7472ba8e6aad87f398552b80c6b9c19af5df9d38)
2013-06-27 14:22:31 -04:00
Waseem Daher 5a51417a3d Make in-app notifications a little wider.
(and remove the colon after the sender name to make them more
consistent with our desktop notifications.)

(imported from commit f2f9e1ecf7766c717fe7afb0559c4771081c255b)
2013-06-27 14:22:31 -04:00
Zev Benjamin 6f874995ff [schema] Use custom stopwords file for full text search
This stop words file is just the default Postgres english stop file
with all the rest of the letters of the alphabet added.  Adding the
extra letters ensures that, e.g., "bed" doesn't get transformed into
"bed | b".

(imported from commit 0be3ef9a43eb524ed4f081d5081a786cf602c487)
2013-06-27 14:18:53 -04:00
Tim Abbott 08ba672c34 process_user_activity: Fix incorrect format string for unknown event type.
(imported from commit 6ca2d1126b61c8f881d5e52478eeef974005757f)
2013-06-27 12:56:08 -04:00
Steve Howell e904dbc19c Correctly set read flag for messages sent by yourself.
Compare two user objects by id to prevent false negatives
when the objects are fetched thru different paths.

(imported from commit a41f30d27e2b8021600d89f32d6526f48677fd95)
2013-06-27 09:17:47 -04:00
Waseem Daher 343023d2de Add "Invite coworkers" link at the bottom of the buddylist.
(imported from commit b4a3dc298df6c6870425b95ea40c7dbf80b66b95)
2013-06-25 21:35:44 -04:00
Waseem Daher 69ba982e9b Eliminate weird whitespace at the bottom of the "create stream" form.
This also has the property of fixing this for all forms-that-contain-modals
since the selector is more generic.

(imported from commit 18fd26dd94fe4f6f3fe9a01884b867a9d37993d0)
2013-06-25 17:03:04 -04:00
Tim Abbott 1ec0ee0fd6 [manual] API add_subscriptions: Change arguments to support options.
Since in the future we might want requests to add subscriptions to
include things like colors, in_home_view, etc., we're changing the
data format for the add_subscriptions API call to pass each stream as
a dictionary, giving a convenient place to put any added options.

The manual step required here is updating the API version in AFS
available for use with the zephyr_mirror.py system.

(imported from commit 364960cca582a0658f0d334668822045c001b92c)
2013-06-25 16:34:45 -04:00
Tim Abbott 238f4a6362 API: Fix broken list_subscriptions call in REST API.
Previously, it always failed because we had hooked up the API endpoint
to a function that doesn't exist.

(imported from commit b5269f6d8e385facae4362742fe69a422f6315b7)
2013-06-25 16:34:45 -04:00
Tim Abbott 0b9e9bca64 gather_subscriptions: Fix some whitespace.
(imported from commit a36c21c1acf2c2fad4aebb78ab1ac07ab67ff285)
2013-06-25 16:34:44 -04:00
Tim Abbott 9924faaabd [manual] API get_public_streams: Return streams in a dictionary.
This way we can return properties of the streams other than just their
names in future versions of the API without breaking old clients.

The manual step required is to deploy the updated version of
sync-public-streams on zmirror.humbughq.com when we deploy this code
to prod.

(imported from commit 42b86d8daa5729f52c9961dd912c5776a25ab0b4)
2013-06-25 16:34:44 -04:00
Tim Abbott 45c692c1e0 tests: Simplify helper_check_subs_before_and_after_add API.
The previous API was very redundant, which meant that any refactoring
would result in lots of unnecessary changes.

(imported from commit e04f6cbd87c8f65d4eebbe6972d26998faa28a56)
2013-06-25 16:34:44 -04:00
Tim Abbott f618c4d2b3 tests: Switch to using common_subscribe_to_streams.
(imported from commit f172e9e39d211b7f31d95d6aa83528f631808edb)
2013-06-25 16:34:44 -04:00
Tim Abbott 21b3ec3e48 tests: Move common_subscribe_to_streams to AuthedTestCase.
(imported from commit 2451d31444933e2bd0cca61b06fdaa7ace572aac)
2013-06-25 16:34:44 -04:00
Tim Abbott f880b1a072 tests: Clean up arguments to make_random_stream_names.
(imported from commit 442e0059f047b1334f455a9b15071dd43bb59d33)
2013-06-25 16:34:44 -04:00
Tim Abbott ce50812bca API get_members: Return a dictionary of users, not a list of tuples.
I believe this should require no special work on deploy, since some
grepping of logs suggests we are not currently using this API query.

(imported from commit 240086f900c6680cbc90bf6a2f334a9e1f172df6)
2013-06-25 16:34:43 -04:00
Kevin Mehall a06860ca68 Don't perform an additional SELECT just to get a count for statsd.
len() uses the QuerySet as an iterator, which performs a SELECT for all
of those rows.

(imported from commit d362fef375c5270bedade2a7b50aea7b1a559d1e)
2013-06-25 15:25:25 -04:00
Kevin Mehall 953e195be1 Refactor update_message_flags to do the query in the django process.
Trac #1398.

(imported from commit c001747d8e6d78a12fe535c36a81c12592976840)
2013-06-25 15:25:25 -04:00
Tim Abbott c4dc0afbf3 Clean up unnecessary UserMessage.flags_dict().
(imported from commit ece196da6c98db3bcc7079e8d44b557b3aac0edb)
2013-06-25 14:06:09 -04:00
Tim Abbott d6e04ce2d6 Fix @-mentions.
Trying to check whether a Django model object is inside a set of other
Django models is not correct in general, e.g.:

UserProfile.objects.only("id").get(id=17) in set([UserProfile.objects.get(id=17)])

returns False.

This bug appears twice in the function, once when computing which
users were mentioned and again when pushing the flags through to
Tornado.

(imported from commit b09ed550258f9df2611e1b0a60f87c48a51830f8)
2013-06-25 14:05:20 -04:00
Tim Abbott d537bf568c tests: Add a backend test for @-mentions.
(imported from commit da4e241c445d080b58e131d95d7d9fe89ecf31f0)
2013-06-25 13:46:53 -04:00
Tim Abbott f7363af887 Don't send desktop notifications for messages you sent to a stream.
Previously, we were only checking whether the message was sent by you
for PMs, not for streams that you marked as notifiable.

(imported from commit 668e102e885aa347cceff376c1873c1c62aff997)
2013-06-25 13:46:48 -04:00
Jeff Arnold c8e34c2bfa Make the first subject autocomplete option be what the user typed
(imported from commit af9f5cfce09a071eb461f93c8c47128897162de2)
2013-06-25 10:28:14 -04:00
Steve Howell 8363f9bfc6 Add mode to run only fast tests.
(imported from commit acb569a54551bdd31aad53eb47191771ae670493)
2013-06-25 08:46:02 -04:00
Steve Howell 660ee6571d Disable embedly everywhere.
(Before it had been disabled only on prod/staging, but we are
removing it everywhere, motivated by making tests run faster.
In particular, the call to embedly_client.is_supported() was
expensive, as it went over the Internet.)

(imported from commit ea12bf6e7ae84ce7e8023a0d314ecc4c07cbc0a8)
2013-06-25 08:46:02 -04:00
Steve Howell 67058cc26f Enable back door for clearing user's rate-limit history.
(This is helpful to make the tests run faster.)

(imported from commit 48c1beaed8cca76976bd6f54224c33460b55ceac)
2013-06-25 08:46:02 -04:00
Scott Feeney 9ca7d58cac Create minified_assets.json in the deployment root
This file is a dict mapping filenames like "min/api.js" to
"min/api.HEX_HASH_HERE.js". This will be useful later for figuring out
which hashed version of a generated file belongs to a specific deploy,
for reuse in future deploys with the same source files.

(imported from commit d03c408b37a4e2d494abd4b1577a70b5ff5c2e34)
2013-06-24 15:55:04 -04:00
Scott Feeney 6b8bc74b4e Replace SITE_ROOT with DEPLOY_ROOT
Whereas `SITE_ROOT` referred to the directory where settings.py is
located, *all* actual uses of `SITE_ROOT` were joining it with `..` to
get the root of the git checkout, a much more useful value.

`DEPLOY_ROOT` now represents the root of the git checkout.

(imported from commit 351437f9a5801e5c7c08a3a97619e863144e5cc8)
2013-06-24 15:55:03 -04:00
Tim Abbott 04f1b1da66 Don't flush the UserPresence cache for a realm unless status changed.
Previously we had an issue that every other update_active_status
request for a particular realm would result in doing the expensive
query to compute the list of active users in that realm.  It turned
out this was because on every update_active_status request, we'd queue
an event that would have the effect of clearing the cache, even if
nobody's tatus changed.  This fixes that issue, by only clearing the
cache for a realm if someone's status actually changed (or the 60s
timeout expires).

(imported from commit d5b829fe255a31c8cecb58458738f1e72a2cf6de)
2013-06-24 14:34:51 -04:00
Tim Abbott c87d182102 Avoid saving user_presence twice when creating a new object.
(imported from commit 72af41b4e0b85f9a8605f5040c321c80e16e8a97)
2013-06-24 14:34:51 -04:00
Tim Abbott 8f0fbfb562 Fix message_is_notifiable to not include messages sent by user.
(imported from commit 196696da1350bba176985acce4abe36d5cedd24f)
2013-06-24 13:56:45 -04:00
Kevin Mehall da26a6a4fd Merge http_link and autolink regexes, as they share many workarounds.
(imported from commit 62615af5bf6d48620ec3f9e2523fecbc1ff01441)
2013-06-24 13:41:01 -04:00
Kevin Mehall c5c47fc921 Simplify and comment AutoLink regex.
Override python-markdown to compile with re.VERBOSE.

(imported from commit 77a797c79fb3f6c11948f431715c8bb624dc8bc7)
2013-06-24 13:41:01 -04:00
Tim Abbott d2d1613153 send_message: Don't fetch unnecessary data on recipients' UserProfiles.
(imported from commit 4e4b5bdb510610cf7198bfb01fc465fe15bd834d)
2013-06-24 11:42:17 -04:00
Tim Abbott edc4f51b00 do_update_message: Check max message and subject lengths.
(imported from commit 48e8b21c7ca122afc40fcd1482d26185f50cadab)
2013-06-24 11:42:17 -04:00
Tim Abbott 8b4d406083 get_old_messages: Use a raw database query for empty narrows.
This improves the performance of the get_old_messages queries when
loading the home page by about a factor of 2.5x.

(imported from commit 581840a6ed7b391c9d9fde67f368fce816e567e2)
2013-06-24 10:17:10 -04:00
Tim Abbott a8d86d5fb2 get_old_messages: Refactor handling of UserMessage flags.
This is in preparation for having a case in which we query the
database directly to get the message flags, without going through a
UserMessage object.

(imported from commit d5218974680b0c4b028a84f3aae1c8242ceb08ce)
2013-06-24 10:17:10 -04:00
Tim Abbott e5e0544816 get_old_messages: Clean up code duplication in database queries.
(imported from commit c35aa71fc848c77f9c5c8edd8cc8acaa9481df74)
2013-06-24 10:17:10 -04:00
Tim Abbott 0cc9960ff5 compress message dictionaries in memcached using zlib.
This decreases the average size of the message dicts in memcached by
about half, without any significant change in the overall performance
of the query.  Since these message dicts are a significant fraction of
what we put in memcached, this seems like a worthwhile optimization.

(imported from commit 3896328074aa4344b8ac7c7ba7685f0a167ec7ad)
2013-06-24 10:17:10 -04:00
Tim Abbott 631a9048f7 Send message dicts to memcached as JSON dumps.
memcached stores objects sent to it using pickling, which is very
slow.  We work around this by sending memcached strings (i.e. JSON
dumps); pickling doesn't slow things down too much if all it is
getting is a string.

(imported from commit 0f0e534182eccb76c5731198e05a9324a1cef316)
2013-06-24 10:17:10 -04:00
Tim Abbott 222ef672b5 [manual] Use ujson instead of simplejson.
This saves something like 15ms on our 1000 message get_old_messages
queries, and will save even more when we start sending JSON dumps into
our memcached system.

We need to install python-ujson on servers and dev instances before
pushing this to prod.

(imported from commit 373690b7c056d00d2299a7588a33f025104bfbca)
2013-06-24 10:17:10 -04:00
Tim Abbott 678dd502ef Add command-line tool to profile get_old_messages requests.
(imported from commit bd7fc27b0c6fc1ae4f82bb74763736f9163b90bf)
2013-06-24 10:17:09 -04:00
Zev Benjamin 90f4b1f227 Preserve the hash when reloading
Previously, if you were narrowed when we reloaded you, you'd be
kicked out to the home view.

(imported from commit c00f1b92c9a4f559998463e141a402b69873fd56)
2013-06-21 16:24:12 -04:00
Kevin Mehall 4f5b4fdb67 Bugdown: Elipsis followed by TLD should not be linkified. Trac #1388.
(imported from commit 3929e4bc68872e5f5ed58f35dd1b4eb53a2e5990)
2013-06-21 15:33:17 -04:00
acrefoot a37b08db58 In-Browser Notifications
Some browsers don't support desktop notifications. Some people haven't allowed permissions
for humbug to have desktop notifications. This is a poor man's attempt at desktop notifications.

We are adding the bootstrap-notify package (http://nijikokun.github.io/bootstrap-notify/)

Resolves Trac #1336.

(imported from commit 6a54f7d1875e765dabd32d94ada8ebe4474a3d71)
2013-06-21 11:44:25 -04:00
Jessica McKellar 05bbfb42a9 Make bankrupting more resilient against regular pointer updates being in flight.
(imported from commit 90e1dc16e7d3295b6ed3f5993fe82ac4fcd2d7cc)
2013-06-21 11:00:44 -04:00
Jessica McKellar 24b41351a6 Clean up the message we display while bankrupting you.
(imported from commit 007c97eded421a021cd6aefb7f38fe8f4946b26c)
2013-06-21 11:00:44 -04:00
Jessica McKellar e0b109c6ae Remove the bankruptcy button on the Settings page.
(imported from commit 3f67422df3e96b0902b315c8d055c607e07bc533)
2013-06-21 11:00:43 -04:00
Jessica McKellar 30ab99d765 Offer to bankrupt a user if they are way behind.
(imported from commit 5483bb548a55e6cbf788b71a8885b3c990b94b77)
2013-06-21 11:00:43 -04:00
Zev Benjamin 06bff38655 [schema] Remove old Postgres full text index
We haven't been using this for months and not removing it before was
just an oversight.

(imported from commit d95c1911765a04a0c8713cc6c0dd346c123c97a3)
2013-06-21 10:58:40 -04:00
Tim Abbott 5eca964f0e onboarding: Only update onboarding checklist state if it changed.
I noticed in our server logs that some users were sending
update_onboarding_steps requests to the server every time they sent a
message -- because they hadn't finished the onboarding process.

(imported from commit 8e1751a3344149f386022d96e7893e687d6631e8)
2013-06-21 10:42:32 -04:00
Waseem Daher e5dbf4240e Hide the popover title area if it is empty.
This makes our popovers-as-menus look a bit better.

(imported from commit 53b8be0a4f16fc7a7884b3fcb276a9ab85fe6f24)
2013-06-20 18:42:06 -04:00
Tim Abbott 6cc45b89b1 Revert "Hide pointer until a hotkey is used"
This reverts commit fec64815c879f9704847795cc163e2b517b4190d.

We've decided this experiment didn't work out.

(imported from commit 04f38e15c8ef19fbaa022a06bbcca3b0c67ec5ad)
2013-06-20 18:02:18 -04:00
Tim Abbott c87e12ad41 Revert "Tweak hotkey behavior when pointer isn't shown."
This reverts commit 74fb298c711e61ae98c210d0ed11c875ce6ba591.

We've decided this experiment didn't work out.

(imported from commit 8acd3a030b692f9397155a20a9f89e63ed6a6cf7)
2013-06-20 18:02:18 -04:00
Tim Abbott e55eb53297 Use get_user_profile_by_* functions to get UserProfiles.
We had a few bugs where we were using a raw Django database query to
get a UserProfile object.  This might seem OK, but going through
memcached is more efficient, and also guarantees that we get back the
.select_related() version of the object, so that if we later access
related fields like user_profile.realm.domain, we don't end up doing a
second database query as well.

Fixing these should in practice save a substantial number of database
queries on handling update_status_list requests, which happen very
often and access user_profile.realm.domain.

(imported from commit 0a2027da1b5bbc7a4f6c6927aca498530d7a4977)
2013-06-20 17:57:06 -04:00
Steve Howell 2ee31f46cb Enforce timely tests more aggressively.
(imported from commit b14e484bd72f0fa19b246efeec64815633217a2f)
2013-06-20 16:52:16 -04:00
Steve Howell 92539daa99 Enforce timely test completion.
(imported from commit f2e3ff32b7372cc916cc60ba04abcb90c39197e2)
2013-06-20 16:52:16 -04:00
Steve Howell fac3b756b7 Add decorator to annotate slow Python tests.
(imported from commit adab5330e7f14f38da6755648ae7741fde48d852)
2013-06-20 16:52:16 -04:00
Leo Franchi 468bbf216d Add a new window.bridge call for unread pms
(imported from commit 098c31dbd69c4c020e4c093095e4c78723db0bb1)
2013-06-20 16:23:30 -04:00
Steve Howell ca144b5297 Eliminate MyResult class by calling test method directly.
Instead of calling test(result), we emulate the behavior of
calling SimpleTestCase.__call__, minus the results protocol.

(imported from commit e12e3d5caa8726c050a2a7cfa583ca4d571d6cbb)
2013-06-20 13:42:32 -04:00
Steve Howell 1e48388728 removed obsolete comment
(imported from commit e04378869834189c26579727fb7727e63e2e1b5d)
2013-06-20 13:13:39 -04:00
Steve Howell 0e40dc9fc6 Print "Running <test>" from within run_test(), not MyResult.
(imported from commit c8e150c5bd56eabd60c167c207655efc2059d6af)
2013-06-20 13:13:39 -04:00
Steve Howell 618ec40ef7 Import time module at top of tests.py
(imported from commit daf6d20f0c452a51b0485c7dca01d1e541661fd5)
2013-06-20 13:13:39 -04:00
Steve Howell cdc095c3b3 Extract run_test() method in back end tests.
(imported from commit 264bf689b282fccf8b4e423060fe0c4d2708b934)
2013-06-20 13:13:39 -04:00
Allen Rabinovich e0c05ea7a9 Prevent buttons from stacking in a narrow window by removing their text labels
(imported from commit ab1526e12d7fea0dd791ae02f419ab65d7430e30)
2013-06-20 09:24:40 -07:00
Zev Benjamin 0e330e7d7e Add mixpanel badge to the front page
Displaying the badge gets us a bunch of free mixpanel data points/month.

We only display the badge on the login page (which `/` redirects to)
and not on other portico pages.

(imported from commit 75871173a10ae888fdb7c92fe8e20586ce60c6bf)
2013-06-20 12:21:42 -04:00
Zev Benjamin d8f1413bc4 Rework bottom navbar styling
This just makes the markup on each list item more consistent.

(imported from commit d12f6ef503b6da10c39aaaadcf2c6d359e9d0d47)
2013-06-20 12:21:42 -04:00
Zev Benjamin 8921621621 Make our portico bottom copyright and navigation stick to the bottom of the page
We use the technique described here:
http://ryanfait.com/resources/footer-stick-to-bottom-of-page/

(imported from commit 108f3c9cc4ce9dbf483ff76d6f9a6a014077da56)
2013-06-20 12:21:42 -04:00
Allen Rabinovich 8ea3dc285d Fix for an overlapping scrollbar in streams list
(imported from commit f07114e06745b9dd7e8b31eec61d21a1914c22c6)
2013-06-20 08:43:32 -07:00
Tim Abbott 47255e9cd8 Fix buggy key computation in cache_with_key.
The refactoring to use the cache_get() method incorrectly didn't
remove the addition of KEY_PREFIX inside cache_with_key.  The result
was that the KEY_PREFIX was being added twice, once by cache_with_key
and again inside cache_get.

This had the impact of causing pointer saves to not take effect,
because our attempts to update the memcached cache when we save the
UserProfile object were using the correct cache key, but the actual
code reading values out of the caceh wasn't.

(imported from commit dcea000833f00622bdc0249488de3b186a7417b2)
2013-06-20 10:57:32 -04:00
Steve Howell c5631eb489 Make test_emoji about 500ms faster.
The test_emoji test makes sure that we build the correct image
tag for all of our emojis.  It's the same underlying algorithm
for all 800+ images, so we now test it in O(1) times instead
of O(N) time.  Randomly sampling the emojis makes the tests
slightly non-determinisitic in a theoretical sense, but not in
a practical sense.

(imported from commit c78b50072953f2c081fca0272b9ecf762a4802db)
2013-06-20 10:24:40 -04:00
Steve Howell 07afbabb79 Double speed of Python tests by removing fixtures code.
(We don't need the fixtures code once we override Django's
run_suite() method not to clobber our test database, since
all our tests use the same data anyway, and since Django
runs all the tests in a transaction and rolls back their
changes.)

(imported from commit d9daf09be3967de2de30934173b882d3d6b9ea27)
2013-06-20 09:41:34 -04:00
Steve Howell 3c79f6fa53 Make RateLimitTests less brittle to speedy tests
(imported from commit 1b81356d90bdb19b0550363aebb2f1426d386d10)
2013-06-20 09:41:25 -04:00
Steve Howell 712dce8a97 Do not have Django wipe out our test database during Python tests.
In tools/test-backend, we build the test database before calling
"manage.py test, so there is no reason for Django to wipe it
clean.

(imported from commit 7b09e9cc1a9259900ec1cc4f9ebbcacab1efb265)
2013-06-20 09:41:25 -04:00
Steve Howell ad03644371 Add help message for method-missing scenario in tests.
(We now have a full replacement for TestResult, but we don't
support the full API of TestResult.  If folks were to add new
tests that caused TestCase to call our class with an unsupported
method, this diff will provide hopefully a more clear error
message.)

(imported from commit 92033b12a1a901bd649ecb03e08779aa76bfef7a)
2013-06-20 09:38:53 -04:00
Steve Howell f2f9fb7c3b Simplify run_suite for Python tests so we can debug tests more easily.
We use a simplified version of run_suite in our subclass of
DjangoTestSuiteRunner so that we can have more control over failing
fast and indicating progress.  This change also speeds up the tests
by taking roughly 200 lines unittest/Django code out of the picture.
(We basically reinvent a simpler TextTestRunner and TextTestResult.)

(imported from commit 5216b6b582b071bd7c9e923c9886c3bc61faf581)
2013-06-20 09:37:00 -04:00
Steve Howell 25c9f5bace Subsume Django method into our codebase for code review clarity.
(This commit will probably be squashed, but it makes the subsequent
diffs more clear with respect to how we remove functionality from
run_tests.)

(imported from commit 9d0edcd5282a0f90ebd38e0ac229ef874dc00504)
2013-06-20 09:36:49 -04:00
Steve Howell 00a2b23843 Sort the import statements in tests.py (cosmetic).
(imported from commit d730d73841818f7104522b126e7faf1735c897fd)
2013-06-20 09:36:49 -04:00
Tim Abbott 60b8635593 cache: Add a helper function to get the right cache backend.
(imported from commit 3e80178dbaa0fcc77d1075bb3fad29ace7540a02)
2013-06-19 18:40:58 -04:00
Tim Abbott d2e18094d8 cache: Refactor cache_with_key to use the helper functions.
(imported from commit 24f8af8de17d3376c8ee56da5c2a901c2c314e78)
2013-06-19 18:40:58 -04:00
Tim Abbott 46c40c011a cache: Use KEY_PREFIX in cache_set().
(imported from commit 3dbddc9c513b58f692947f0c30a18ec12250e3a5)
2013-06-19 18:40:58 -04:00
Tim Abbott cb4e965fd2 cache: Remove KEY_PREFIX from keys returned by cache_get_many.
Otherwise code paths that use those keys, like get_old_messages, will
incorrectly use the prefix-included keys.

This bug in our KEY_PREFIX system results in our memcached caching for
get_old_messages always missing.

(imported from commit 506c13e06d6f266596ead0b381c324c256e576c3)
2013-06-19 18:40:58 -04:00
Tim Abbott cc02890b1f tornado: Clean up legacy code for message event format change.
(imported from commit 6feb1a26e86d72febf965c409648339ea4811797)
2013-06-19 18:40:58 -04:00
Scott Feeney f06c0fbdc8 Only focus textbox if streams page opened directly
If you click on "Streams" from the gear menu, we want to focus the
textbox to create a new stream. But if the Streams page is brought up
programmatically (e.g. to jump to a specific stream's settings), this
commit makes it not focus the textbox.

(imported from commit 900bdafb701180eac1d284120a91ea2a84d7177b)
2013-06-19 18:31:06 -04:00
Scott Feeney a7eaddefa5 Fix race condition for sidebar "Stream settings"
The sidebar link now uses a one-time event handler for a custom event,
subs_page_loaded.zephyr. If the streams page is already open, we can't
rely on the event so we expand the stream in question immediately.

(imported from commit 3c22e1791d238a3be4a73edcfb5456e392cee608)
2013-06-19 18:31:05 -04:00
Allen Rabinovich adaf5e502a A dark header with a more compact search field and no message composition buttons in responsive view
Removing dead CSS code, loading a bigger gravatar for Retina displays

(imported from commit 0feb79b46b0c275d4a220a4dec733584e0204023)
2013-06-19 15:23:52 -07:00
Steve Howell b896c587e2 Extracted S3-related code to lib/upload.py
(imported from commit 4f0b0012b89d21b3bd445a2a6f84f3de72190e13)
2013-06-19 18:10:45 -04:00
Steve Howell b055698317 Work around possible jQuery issue in building buddy list.
(imported from commit 17ad22f0bb3b30333cb9675cb710b9b5e2141198)
2013-06-19 16:35:35 -04:00
Zev Benjamin 418c8c2deb viewport.js: Use its own proxy functions internally instead of directly calling $(window) methods
(imported from commit 89e90d30ee41b63f1f8ca7e3d0d92b682a97583d)
2013-06-19 16:35:35 -04:00
Zev Benjamin 338a0fb4ce Reduce code duplication in viewport.js
This also gets rid of an inconsistency in the use of jwindow vs. $(window).

(imported from commit a42e47ef0dd9eaf9aaa4d4e2eedb466d77ec3385)
2013-06-19 16:35:35 -04:00
Steve Howell 2b320f8d57 Allow user to upload an image for their bot's avatar (back end).
(imported from commit 34833b61b935f4eec2b23abbb3532aaa58e13fb6)
2013-06-19 10:21:20 -04:00
Scott Feeney scott@humbughq.com 42d2c40464 Add link to stream settings from sidebar popover
(Trac #1375)

(imported from commit 92fdbc9906f1394f3ae484a91919226224f43631)
2013-06-18 18:03:38 -04:00
Scott Feeney scott@humbughq.com 0119423d27 Make a code comment clearer (subscription settings)
(imported from commit 085cdc43371fbdf9b0e93f7de13bda9264e41c92)
2013-06-18 18:03:38 -04:00
Kevin Mehall 9322e63d32 Refactor typeahead for user names (PM and @reply).
Get data directly from the main user list, rather than maintaining a
separate list just for autocomplete.

Fixes trac #1362 -- Does not depend on historical messages, so
will do the correct autocomplete after a single reload.

(imported from commit 6b35a709dba3384530082e8cfacf0151f9e0eb26)
2013-06-18 17:52:39 -04:00
Kevin Mehall fbed3e23a8 [third] Patch bootstrap-typeahead to handle objects that aren't strings.
Based on https://github.com/twitter/bootstrap/issues/6579. Doesn't
look like upstream is going to fix that or its 6 duplicates any
time soon.

(imported from commit b3e887d929cc42124aeb1f13abd7503f38f92a1f)
2013-06-18 17:52:39 -04:00
Scott Feeney scott@humbughq.com 0fde644417 Fix typos in "No ~/.humbugrc found" error message
(imported from commit b0c8aab4668751d9b1d12792d249645498a95932)
2013-06-18 17:47:03 -04:00
Zev Benjamin dd939ed7fe Disable the collection of metrics when not deployed
We were using up a lot of events in our dev environments.

(imported from commit 8413ecfa835cce0a231bdf437f37ad8cf12a9133)
2013-06-18 17:07:36 -04:00
Zev Benjamin 80702ccaa0 Add metrics variables to the template context via a context processor
Wrapping render_to_response never actually worked correctly.  On the
login page, mixpanel_token would be missing, but we wouldn't get an
error because it is surrounded by double quotes, which meant that it
was still valid Javascript.

(imported from commit 820ee42fab8f679983e5a3a4309a2feaf690f20f)
2013-06-18 17:07:36 -04:00
Zev Benjamin aff42f0c73 Revert "Add a bunch of debugging support for mixpanel"
This reverts commit c5050f66d985eb76e38117b2668594fedfc10702.

(imported from commit ea1c92f73e8fd4ce2816e7af94b5d3a55edc8a7e)
2013-06-18 17:07:36 -04:00
Zev Benjamin 22a6cd3dd7 Send mixpanel events on window resize and page load about the window size
(imported from commit 9c2859513af52510802da4eb94496d54625775f2)
2013-06-18 17:07:36 -04:00
Zev Benjamin c9bf69189a Use mixpanel.register to reduce code repetition
(imported from commit 13ac43ce4a5539ce8accb5315bc28e7ad872435c)
2013-06-18 17:07:36 -04:00
Zev Benjamin 94daecd039 Send only 10% of the events we generate to mixpanel
(imported from commit f5b1b68f81346a90998a8ab6e789151b0e55dba1)
2013-06-18 17:07:36 -04:00
Zev Benjamin 08097d6788 Don't always claim that the application has been updated when reloading
I don't love the default reloading message, but I'm not sure how to
tell the user why we need to reload in several cases.

(imported from commit 5f2eecdb0d83f31bd60673b247e8aac8f08ce20f)
2013-06-18 16:36:02 -04:00
Zev Benjamin eb62a31bb8 Use a different error message for get_events and get_old_messages
(imported from commit 191f46b482d0bf4adf60967cdfebb0d7dbcf82f8)
2013-06-18 16:36:02 -04:00
Leo Franchi 7705400de2 Properly set stream highlight when toggling in home view
(imported from commit 2aa810f5ca0eb8d62bcf87dc93608c56cf4956f3)
2013-06-18 16:05:23 -04:00
Steve Howell a46a371677 DRY up sent-by-me checks with messages.sent_by_me.
This is a pure refactoring.  We set messages.sent_by_me inside
add_message_metadata(), which gets called early in a message's
lifetime.

(imported from commit 2f6270f92ecdf0e4a64401030f86d89a8fb7be2e)
2013-06-18 16:01:09 -04:00
Steve Howell 943a29dc34 Show correct avatar for desktop notifications.
This updates desktop notifications to use avatar_url from the
server (in case users have uploaded their own avatar).  It
also removes the unneeded stamp parameter from the URL, and
it unifies URL handling with message_list.

(imported from commit 6bb43a25c01cc3d26f30fc167780a477d1c5d023)
2013-06-18 16:01:09 -04:00
Kevin Mehall 6106f8008a Refactor variable names in fading code.
(imported from commit 25e2240f30d86f98d50c36302afbfef43fb4a60e)
2013-06-18 10:40:07 -04:00
Kevin Mehall 97754b3641 Optmimize and simplify update_faded_messages().
Trigger a repaint only on the messages that change fade state,
rather than repainting all messages.

(imported from commit d3a225448c004a4b467e51ceb97fda06a7a6f04b)
2013-06-18 10:06:58 -04:00
Kevin Mehall dc6dd71658 When fading tests for matching messages, normalize huddle lists
(imported from commit 805e62c1a57e754c225b743c7d801d8b33da5ed4)
2013-06-18 10:06:58 -04:00
Kevin Mehall b1b4c1a625 Update fade on every change to recipient fields. Trac #1261.
(imported from commit 2b966765bef3e7e4d8cd2ee6ad55a05ba1f23ab2)
2013-06-18 10:06:58 -04:00
Leo Franchi 2795b362a8 Complete subscription list with any missing subscribed streams
(imported from commit c433a921465af7422d481d6aaf7b0d2fc732a8fe)
2013-06-17 15:26:53 -04:00
Tim Abbott c824901e2e Load fewer messages from the server when narrowing.
This should substantially improve narrowing performance, while still
delivering enough messages that one should only need to contact the
server again if the user scrolls up a significant distance.

(imported from commit 2b0af0e5b9d3a449e7f195a87d57d517b47f0b3a)
2013-06-17 13:48:06 -04:00
Steve Howell 438e412772 Hide more things when you "close" the compose box.
This change backs off from the always-open-compose-box paradigm,
so that when a user "closes" the compose box, they can no longer
type text, attach files, etc., and instead, they have buttons
to reopen the compose box.

(This change does not affect the feature that when you're in reply
mode, the compose box stays open.)

(imported from commit 32305d5b35f457a83f126a2265defdd98e885a2b)
2013-06-17 10:21:49 -04:00
Kevin Mehall 334424ae79 bugdown: TLD and parentheses shouldn't make it a link. Trac #1364
(imported from commit d4da7ec080a6a8362b6370ced9ddc10d52443452)
2013-06-17 10:08:13 -04:00
acrefoot 11e44c68ce quickfix whitespace on the composebox
(imported from commit 431a7bc2ac1192416f3c2bc7cbeaeac802a0ec62)
2013-06-14 17:03:41 -04:00
Kevin Mehall 0983840e7b Fix 06-unread regex, as it no longer seems to match the count.
(imported from commit 9815772454d11c5216a162a0e0919a990670e54e)
2013-06-14 14:52:38 -04:00
Kevin Mehall ae6afac3ca Fix race condition in 07-stars.js test.
(imported from commit ad309b2d30f02c93be47319086cd330684042e80)
2013-06-14 14:52:38 -04:00
Kevin Mehall 3f2bdae1e1 Casper tests: avoid races in 03-compose
(imported from commit 42f47073b96e72831e6cf560b6b50f9862d5b4cd)
2013-06-14 14:52:35 -04:00
Kevin Mehall 878094aad3 Add casper tests for the settings page. Trac #1118.
(imported from commit f611d3cb6c1651e96c782bca5f6bbbdc69613516)
2013-06-14 14:50:45 -04:00
Kevin Mehall 7363851561 Add casper tests to check that the subject/stream/recipient fields are populated when replying
(imported from commit 7a0337467c6e7a1ed3118e07d2b4ad904719e093)
2013-06-14 14:50:38 -04:00
Kevin Mehall b06c2f7ccf Tweak hotkey behavior when pointer isn't shown.
Disable the hotkeys that act on the current message, except Enter
immediately shows the cursor without moving it.

(imported from commit 74fb298c711e61ae98c210d0ed11c875ce6ba591)
2013-06-14 13:50:03 -04:00
Kevin Mehall 0cd90cbe4a Add a close button to the compose dialog (since users may not know to use Esc)
(imported from commit 47dca0b2c76449be1d885b74c1cf6b036aa459c7)
2013-06-14 13:47:57 -04:00
Kevin Mehall 6cb7baf598 Hide pointer until a hotkey is used
(imported from commit fec64815c879f9704847795cc163e2b517b4190d)
2013-06-14 13:47:07 -04:00
Kevin Mehall e80d1f4ad0 Another try at fixing tabbing into the compose box, Trac #1245.
Hopefully this time with fewer stack overflows. It sets the flag
that will break the cycle *before* triggering another focus event.

(imported from commit 5e3ed74f1eeab8a18e36525ae7c8f1f1c756eb58)
2013-06-14 13:19:10 -04:00
Zev Benjamin 501a58c8f9 Proxy the console object when the browser doesn't provide it
Some versions of IE (specifically on Windows Media Center PC, it
seems) lack a console object.  For such browsers, we just black hole
any output we would have sent to the console.

(imported from commit 30151c60a68a47990bf8f9be4476b716352befab)
2013-06-14 11:45:57 -04:00
Steve Howell acc338da0e Remove redundant checks that messages were sent by user.
When a user sends a message, it should be considered to be "read"
by that same user, but all that logic is handled on the back end
now, so we can remove some of the front end code related to
saying that a message is unread.

(imported from commit e4263f86c666882db42d7ae3d399196803d700cd)
2013-06-14 11:10:59 -04:00
Leo Franchi 3fd7c44331 Tweak desktop app JS to support Cocoa WebScript
(imported from commit 6b0c3442f92cffedbd210530479a13d4af5ea266)
2013-06-14 10:46:26 -04:00
Tim Abbott 8678148ad1 narrow: Simplify narrow operand processing code.
(imported from commit 9b353c3fab0d5c6532e844c9de45f10a7c6dc068)
2013-06-14 10:45:05 -04:00
Tim Abbott 6f57f62866 Convert tab_bar.js to not make positional assumptions about operators.
(imported from commit 4ae492951ec21b034b64be1296215862b25e44bd)
2013-06-14 10:45:05 -04:00
Tim Abbott 7642b5bf30 narrow: Fix positional assumptions about order of narrow operators.
This cleans up most of our blocks of code that assume in any narrow
that the only operators present are the ones of interest and that they
always appear in the expected order.

(imported from commit 038707aefbe125b0c14f823fa93472fd40302e20)
2013-06-14 10:45:05 -04:00
Steve Howell 83c80e1ba5 Change ? to & in gravatar URL query string.
(imported from commit f12738d1f8dc5b367eee32240ac0a29fb6255d1e)
2013-06-13 17:26:09 -04:00
Steve Howell 4093021f97 Stop polling for gravatar changes after the first update.
This is essentially a bug fix.  It was pretty clear that the
original author intended to stop polling once the gravatar was
updated, but they checked for the updated flag before the callback
completed, instead of inside the success callback, so it wouldn't
stop polling regardless of the update.

(imported from commit 7998c6890a26a008810b8a6d8e7998a53c6e175d)
2013-06-13 17:24:05 -04:00
Tim Abbott deb89a9c9e Fix display of invite-only streams in new design.
(imported from commit 9960acc7a5c9415c137a36b2e0ac8296346e922b)
2013-06-13 13:09:22 -04:00
acrefoot 9e8b997508 Set sidebar_li attribute when updating stream colors
Before, sidebar_li, used in rebuilding the streams list
during a sort, was set to some HTML rendered from a template.
Now it's set to a jquery object that is updated when the DOM is
updated.

This resolves Trac #1310

(imported from commit ba96d9da4deebf2f674f2c093e81b3f0032a3fe4)
2013-06-13 11:31:35 -04:00
Leo Franchi c97ce3a082 Handle unsubscribing from not-in-home-view streams gracefully
This change makes it so we now keep track of full stream information
for both subscribed and unsubscribed streams in our frontend. Previously,
any unsubscribed streams had no associated data.

(imported from commit c445b19abe11c43c710c264fffcf3af5097deb6c)
2013-06-13 10:06:35 -04:00
Leo Franchi 625f8427e6 Return both subscribed and unsubscribed stream information when listing streams
(imported from commit 0aee84712eefd93aebc1041b371e471182eb7e9b)
2013-06-13 10:06:34 -04:00
Leo Franchi 969e0dd827 Clean up subs.have by splitting it into logical pieces
(imported from commit 0fe55aa62ccc95cae5c9aba565b0e4c04692fb46)
2013-06-13 10:06:34 -04:00
Zev Benjamin 614b5396a6 Collect static files directly in the location that will be served
We exclude the original source files for minified files by using a
custom Finder.

(imported from commit a6a25eb6146da53167b71c6d1c44588f75966059)
2013-06-12 17:46:38 -04:00
Zev Benjamin 33fed064e2 Prepend the minified static file header using a custom Storage class
(imported from commit 2b67a6d94de1693bdb8a91f455b92375692f4c41)
2013-06-12 17:46:38 -04:00
Luke Faraone 2d0e803799 Make an audible notification through the desktop bridge if possible.
(imported from commit fefaf528f6cc9da3f124da15c25f41211b394b12)
2013-06-12 17:06:42 -04:00
Allen Rabinovich a222efff66 Fix overflow in stream list and clean up dropdown toggle.
This fixes Trac #1328.

(imported from commit 497147d71c529d0fcfdcb9199c850823b1a4778d)
2013-06-12 16:35:48 -04:00
Waseem Daher 2927b3c3b6 Replace "info" with "chevron down" for message context.
(imported from commit a12d3ce9adfe6b3c019f252f9361a9f6da59ebaf)
2013-06-12 16:35:36 -04:00
Waseem Daher 275d851c56 Draw our left sidebar dropdown arrow in a more reasonable place.
It was previously way way too indented.

(imported from commit c40980451a8851321496c744d379b0d95e19a0f8)
2013-06-12 16:35:36 -04:00
Waseem Daher fda6bfdd4e Make skinny navbar gravatar more consistent with our visual styling.
(imported from commit b9a84dd490bddbdfea85668ad1fcf3c29da2c837)
2013-06-12 16:35:35 -04:00
Waseem Daher 9d62c49c83 Make left sidebar gravatar more consistent with our visual styling.
(imported from commit 0a859184d89fbcfb3ab4e7311f3b86a2f9d89d88)
2013-06-12 16:34:59 -04:00
Allen Rabinovich b7694e5109 Widen the message feed.
(imported from commit 76816ff7b43748d4a16c4b7a5def5ec68262dec3)
2013-06-12 16:34:18 -04:00