Commit Graph

1683 Commits

Author SHA1 Message Date
Keegan McAllister cb7b2eec80 Prevent an animation glitch on showing the compose box
See added comment for details.

(imported from commit 0248500be07584729d03e2543100a320e0410eee)
2012-11-29 19:09:47 -05:00
Keegan McAllister 8cbb6ab95f Equalize the widths of the two columns in the formatting help table
(imported from commit f0a1c7216cfbee777eac4827209ab93c32056515)
2012-11-29 19:09:47 -05:00
Keegan McAllister 3d3e88ad2d Tweak code block examples
(imported from commit 4790e217320ad2dae0b85216321b11755b0ba88c)
2012-11-29 19:09:47 -05:00
Keegan McAllister 27a5d81134 Make the heading of a striped table more distinct
e.g. in formatting help

(imported from commit 0a4123c412689fb2f90985028bd7237fa6cdfb19)
2012-11-29 19:09:47 -05:00
Keegan McAllister 2aaeb6e44b Move the "Formatting help" link next to the send button
The tabindex on this link doesn't actually do anything, because of the Safari
tab workaround.  I added it anyway in case we remove that workaround later.

(imported from commit 11f31f2561907300b350c11732be88589d736f94)
2012-11-29 19:09:23 -05:00
Keegan McAllister f8d83af2f0 Move the send button into a <div>
So we can float other things along with it.

(imported from commit a01e554bdb3ab3187557244400954194149fb172)
2012-11-29 19:09:23 -05:00
Keegan McAllister c25d1ea8e7 Guard against incorrect use of compose.set_mode
(imported from commit 294441f2b9107ce2488866764c3d30c35133a14a)
2012-11-29 16:51:32 -05:00
Keegan McAllister 1047bf49b4 Replace compose.toggle_mode with compose.set_mode
This fixes a bug where you could click on the already-selected mode button, and
it would switch modes without changing which button is selected.

(imported from commit 263ee0b52ba844c52a3a60968bb1bbff73482412)
2012-11-29 16:51:32 -05:00
Keegan McAllister d55ccd32af Remove state machine code from hotkey.js
With the removal of process_compose_hotkey, the state machine now has only one
state.  Everything else is based on things like "is a text box focused right
now", which is probably a better approach.

(imported from commit 0e39c03956d28e30d2bdbf3b285410ad0cacca3e)
2012-11-29 16:51:32 -05:00
Keegan McAllister 093c65fed2 Remove Tab hotkey to switch compose mode
Resolves #461.

(imported from commit 1ee64f0d6ca05064041e6619e8dbf1dc516c2c13)
2012-11-29 16:51:32 -05:00
Jeff Arnold 4c4e153ace When load_old_messages restarts itself, we need to repass all arguments
Fixes a bug introduced by e30e02c2

(imported from commit ca07eab76295ab1557f6866cff19debaec26e8c2)
2012-11-29 16:08:57 -05:00
Jeff Arnold 4a648e9e71 In the UI, call time travel "Narrow to messages around this time"
(imported from commit 4763f67c50bcf540959d9288c86ef854a4e66a1e)
2012-11-29 15:50:43 -05:00
Jeff Arnold 6670cf7b55 The load old messages "button" is now gone.
load_old_messages cares whether it is acting on behalf of a narrow
(for_narrow) not whether it is acting on behalf of a button push.

(imported from commit 16c00e015478f94f0631e211a92a7066a38135a8)
2012-11-29 14:18:38 -05:00
Jeff Arnold 50de4db2de Show the loading spinner when automatically loading more messages
(imported from commit 8025dde8696378bbb40b23a14204bfb489eb6798)
2012-11-29 14:18:38 -05:00
Waseem Daher fcc2fd5cdc Add ability to show/hide a "load more messages" spinner.
(imported from commit 611e53b2574ef50c9ab0a47fc2ebedd931a49dfd)
2012-11-29 14:18:38 -05:00
Jeff Arnold b52dbe1ca9 Auto-invoke "Load older messages" when at the top of the page
Resolves Trac #445

(imported from commit d7d96fe82e9e1cbef32e0dde284ce217e83aff55)
2012-11-29 14:18:38 -05:00
Zev Benjamin ec0fd19249 Always send back the server generation number when the client requests it
During long-polling mode, we were not passing the server generation
number back to the client even when they requested it.  This was
causing the web client to initiate reloads every time it got a
non-immediate return from a long-polling request.

(imported from commit 66c16bf5a1c18bdd975b09d672ebdb4db8d4755d)
2012-11-29 13:45:31 -05:00
Tim Abbott aba2192ec2 Restore the time-travel functionality with Waseem's UI.
This restores the time-travel functionality and fixes Waseem's laundry
list of problems with its original UI.

(imported from commit e30e02c25af994435adb815d26284b3669c945a4)
2012-11-28 22:26:31 -05:00
Tim Abbott 44235e8e7e Fix last_message_id computation catching the dummy row hack.
This was causing glitching where if you narrow so that zfilt has only
one message, and add messages on top (e.g. via get_old_messages), and
then add messages on bottom (e.g. by receiving one), we end up with
the bookend row missing.  One can make this happen with narrowing,
but, this situation happens every time with time travelling.

(imported from commit 71d85980d8aa9431a17b33e9e5111fd3f76cecf3)
2012-11-28 22:26:31 -05:00
Tim Abbott bc2ace726c Fix bad Django test suite interaction with get_client default.
authenticated_api_view and authenticated_json_view call
update_user_activity with a client generated using
@has_request_variables with a default of e.g. get_client("website").
Because that get_client call only happens once on importing the
module, if those client objects didn't exist previously in the
fixtures, then the first test will generate objects with ids 2 and 3,
and then the second test will dump the database, restore from the
fixtures, and then eventually generate client objects with ids 4 and
5.  But since the default values were only computed at module load,
we'll still end calling add_user_activity with client objects with ids
2 and 3, which don't exist in the newly restored database.

Fix this madness by just making sure those two client objects exist in
the database.

(imported from commit d940e129d077a560d9a0f96ec3daa2e16ce21c8b)
2012-11-28 17:41:39 -05:00
Tim Abbott 16b1f63800 decorators: Use @has_request_variables to extract client.
(imported from commit 8407a556fcc1922d69e593edee3897957742f3fb)
2012-11-28 17:41:39 -05:00
Tim Abbott 4024306613 Convert server_generation to an int when parsed.
(imported from commit 5a6f7454c62b98569a474881e8d2e5965336324e)
2012-11-28 17:41:39 -05:00
Tim Abbott 8a3c4f7d89 get_updates: Only return server_generation is the client sent it.
(imported from commit 185bbc8c422d62f45dfb8f4cb8464adc7f1e4078)
2012-11-28 17:41:39 -05:00
Tim Abbott a44c3ff247 get_updates: Eliminate the reload_pending parameter.
(imported from commit c7b57c4ef7fc4d6f0028f174f33ff7ff063d4b9d)
2012-11-28 17:41:38 -05:00
Tim Abbott 55181621bc Send a nonblocking get_updates request on wake-from-sleep.
(imported from commit 91c53f4294a609b1942c6753e9fba4fc4cb2f20f)
2012-11-28 17:41:38 -05:00
Tim Abbott d23a83ee81 get_updates: Replace "failures" with the new dont_block option.
(imported from commit 2b4ecb35c4f14b6c408323662ef6f39c6485c62d)
2012-11-28 17:41:38 -05:00
Tim Abbott a1d8e9d30f get_updates: Replace the "mirror" argument with checking "client".
(imported from commit bd84c2c7a456de8ea7ec35eaf76b5bf8647ca61a)
2012-11-28 17:41:38 -05:00
Tim Abbott a6841c7f12 decorators: Pass the parsed client to view functions as request._client.
(imported from commit e297cfc9c2c1c4d07f083a28ab3d85d32a8bc85b)
2012-11-28 17:41:38 -05:00
Tim Abbott d908b7299c get_updates: Fix client_reload_pending parameter.
(imported from commit f14ea8a6e35d9aac3ac568785d9dd0962c773937)
2012-11-28 17:41:38 -05:00
Tim Abbott 87eabc5159 api_get_messages: Use POST() for apply_markdown.
(imported from commit 4e0e57d6b93cd9410cf946069ea987c26e0f4f5d)
2012-11-28 17:41:38 -05:00
Keegan McAllister 0f1be6a9f6 rows: Consistently return an empty jQuery object in some corner cases
(imported from commit 4a83c8a3671fe13c8ff7c55fa2e22221bd68b21e)
2012-11-28 17:15:25 -05:00
Keegan McAllister 83216a5965 Ensure initial state satisfies selected_message == rows.get(selected_message_id)
If the message doesn't exist, rows.get returns an empty jQuery object, not
'undefined'.

(imported from commit 40620f3e4853a662cb93939bf7f0695f81298777)
2012-11-28 17:15:25 -05:00
Zev Benjamin f568ff20c2 Remove format_delayed_updates_response
(imported from commit d1aa1a1f36fc5ec36f1658aec489db84ae469f7c)
2012-11-28 16:36:43 -05:00
Zev Benjamin 3cc353fc7e Only add a pointer update callback if the client is interested in pointer updates
Previously, if the client was not interested in pointer updates, they
would still return early from get_updates() when the pointer was
updated.

(imported from commit ef9d8b5678b7e72f799840148577651ee10d47ad)
2012-11-28 16:36:43 -05:00
Zev Benjamin 99cf78e1aa Send pointer updates to everyone
Realistically, if there is a pointer update, no other client is going
to have the same pointer.  If they do, the client can ignore the
update.

(imported from commit ca2db60ed7a7c5e4b50a9fa8d350985460922a50)
2012-11-28 16:36:43 -05:00
Zev Benjamin faf426baa7 Only send pointer updates when user has been idle for a short period
This is so we only send a single pointer update when the user scrolls
through a bunch of messages at once.

(imported from commit 20d239d7179e5f57ada99968361a0f9b7b18c591)
2012-11-28 16:36:43 -05:00
Zev Benjamin 48790187ca select_message_id: Remove no longer applicable update_server option
(imported from commit 03076f1d514017b70ec5bd2b34b1a575d0c56f6e)
2012-11-28 16:36:43 -05:00
Zev Benjamin 249b7a527f Switch to high-watermark pointer model
(imported from commit c05d074a404e823eaa0808b6938a3c80e457175b)
2012-11-28 16:36:41 -05:00
Zev Benjamin fbe41c95d5 Re-enable pointer sync
(imported from commit 9f765bbc32e6a3fd91e83aa4016c8e8f8c47bfc1)
2012-11-28 16:36:24 -05:00
Zev Benjamin 71a2cc6611 jquery.idle.js: fix keepTracking option
(imported from commit 327a1c128a88e2e7fcfe7654c6c2c0c67dac0f27)
2012-11-28 16:35:56 -05:00
Keegan McAllister 9e5c86b783 Remove unimplemented test case
"Fixes" #274.

(imported from commit 2c2a64a70ecf11c2119fbb695cba05011cf78f8a)
2012-11-28 15:28:14 -05:00
Keegan McAllister 07ff10e308 Fix / prune tests of get_updates
The assertion-checking callbacks were never called before.  Now they will at
least get called when the view invokes handler.finish() before returning, i.e.
the return_messages_immediately case.

I fixed up the assertion-checking callback for one of the test cases.  For the
other two it wasn't clear what to do -- one has been known-broken for a long
time -- so I just removed them.

"Fixes" #277 in as much as that test case is gone now.

(imported from commit 82d1db26f36f82f24aa5b7ff9e5aa65ce24c9a8f)
2012-11-28 15:28:14 -05:00
Keegan McAllister b5dccbfa87 Return a special value to initiate longpolling
Fixes #261.

(imported from commit dd0312c3574c9ca924ab76edcb2fb6c03085be32)
2012-11-28 15:28:14 -05:00
Keegan McAllister 30933a9639 Explain a bit more how longpolling works
(imported from commit 26c4792f097d748edc725b4528c4d5904efd03c7)
2012-11-28 15:28:14 -05:00
Keegan McAllister ca1b1b2974 Remove some unused @asynchronous-related code
(imported from commit aa332263777f26a29539ba55bec8853df59bbc07)
2012-11-28 15:28:14 -05:00
Keegan McAllister 1081a96062 Assert that internal notify views are invoked via Tornado
An extra check against issue #239.

(imported from commit b6f19892e4d3b45df1c13352d6561fb9e30d86fd)
2012-11-28 15:28:14 -05:00
Keegan McAllister cb7e726d77 Create and use @internal_notify_view
Resolves #288.

(imported from commit 982bf5651a34fa66cd81c882ed0351829eaadf86)
2012-11-28 15:28:14 -05:00
Luke Faraone 1dbd806b6a Implement a favicon as a link rel.
This has the benefit of not getting cached forever by browsers.

(imported from commit c7c7877dfbb9d479e997d122827017036c5337f5)
2012-11-28 15:12:37 -05:00
Zev Benjamin 81fe519b24 github hooks: Display different actions for pull requests sanely
(imported from commit c6d43ccff2d72f61a1cc4d8d320db56edd074832)
2012-11-28 14:49:21 -05:00
Jessica McKellar 4832a6a1fe [schema] Add a management script to create default streams for a domain.
Run this script on an existing realm to create or change default
streams, which new users will get upon account creation.

(imported from commit 8938dcbd3520d97d25b4c6ca783d35c9aef52df0)
2012-11-28 14:07:16 -05:00
Zev Benjamin fb0b4b23c3 Preliminary GitHub integration for pull requests and pushes
(imported from commit 5f91cfd39552294e2c1f1412044d5c8e738d68e3)
2012-11-27 13:55:57 -05:00
Zev Benjamin 0a2b8c3f55 @has_request_variables: allow caller to override the POST variable with a kwarg
(imported from commit 643bce62712b144da369aeabe37c12584b1a5761)
2012-11-27 13:55:57 -05:00
Zev Benjamin a117bd4cdc Use @has_request_variables a little more
(imported from commit ea6422ea3cdbce134bb40181b7889bf5c6442eb7)
2012-11-27 13:55:57 -05:00
Keegan McAllister d1aa92c983 Style inline code inside a link to look more like a normal link
Fixes #448.

(imported from commit 02f538a9d3fb43539640e77b2e194ac2de611c18)
2012-11-27 13:41:00 -05:00
Jeff Arnold ed1eff9bfa Dismiss all notifications when the tab regains focus
(imported from commit 53c807d7a02aabe62a832a129505d690e98e39cc)
2012-11-27 13:39:46 -05:00
Jeff Arnold 2f882b505a Show "how many messages have arrived while away" in the document title
(imported from commit 6e2a18be9953694048d107a56a03a67f8bc2bd5a)
2012-11-27 13:39:46 -05:00
Waseem Daher 60789abd7f Consistently use 'exports' rather than 'typeahead_helper'.
(imported from commit 6106f0ed2708f710a9e3f589560fda58999caa71)
2012-11-27 13:29:26 -05:00
Waseem Daher 2321059240 Don't highlight, e.g. 'Narrow to', in the searchbox typeahead.
(imported from commit f16f1417da708ad2060ba603fe14ea113559d100)
2012-11-27 13:28:21 -05:00
Waseem Daher e0f3c43432 Deduplicate code a little.
(imported from commit 52c32776641256fc145ce1ff7a60ca8fb92ea784)
2012-11-27 13:28:21 -05:00
Waseem Daher 8c0445bff5 Sort searchbox typeahead in a more intelligent way.
Ensure that every result has one of:
* find what you typed in
* search for what you typed in
* Narrow to a stream related to what you typed
* Narrow to a person related to what you type

(imported from commit 2178f17932f951a48f53d982ef660942562b55dc)
2012-11-27 13:28:21 -05:00
Waseem Daher ab8496b9ba Sort streams and subjects in a better way.
Modify the Bootstrap default sorter to sort by:
1. Starts-with, in a case-sensitive way
2. Starts-with, in a case-insensitive way
3. Matches anywhere, case-sensitive
4. Matches anywhere, case-insensitive

(This fixes the Keegan-reported issue of "Testing!" taking precedence
over "test" when he types in "tes")

(imported from commit b2a0127956fe7a8bf1cbf30752a6ddc2c49b7198)
2012-11-27 13:28:21 -05:00
Waseem Daher 830f9df3f2 Keep typeahead initialization together.
(imported from commit d4035e97a223dc05d5f2d85f0577724fc5067577)
2012-11-27 13:28:21 -05:00
Waseem Daher 660c7437ba Move code from composebox_typeahead to typeahead_helper.
(But don't actually make it work yet -- that's for the next commit.
This makes the diff a bit easier to review, since it's really just
code moving from composebox_typeahead to typeahead_helper, and the
appropriate changes in zephyr.js, rather than code moving AND
changing)

(imported from commit 5cb2e836eeb8807f4eb98424558702d44a0e2b70)
2012-11-27 13:28:21 -05:00
Tim Abbott efc5530909 update_user_activity: Fix get_or_create race.
(imported from commit 38bf62a85154db5df18f1416fa3e29be868fc735)
2012-11-27 12:09:57 -05:00
Luke Faraone d270ff348f Save newly created users in the log so they aren't forgotten by populatedb.
(imported from commit a43aaf73576dcacf85c4ad662cbcf04b3fe2bbd7)
2012-11-27 11:16:38 -05:00
Tim Abbott 688525668e Correctly display the user count in registration process.
(imported from commit 24c8479c0730d1756c4e1bd0b818772914c20bd5)
2012-11-27 10:55:00 -05:00
Jessica McKellar cca39ca5e8 Add default subscriptions upon non-MIT user creation.
We'll probably eventually get fancier with this, suggesting various
default sets depending on the company or making it easy for one person
to create default subs for several people at once.

Until we know what we want, keep it simple.

(imported from commit 14319dd50c67fe33ac6f15288dba4916ce0a89ac)
2012-11-26 21:02:29 -05:00
Zev Benjamin 9de11f4df1 Use jQuery.one() instead of binding and unbinding a handler
(imported from commit 23b87ee500c0739b04e6fa3c89065d4af13ab9b5)
2012-11-26 16:49:11 -05:00
Jeff Arnold 4cb0c6225e Add webkit desktop notifications
Partially addresses Trac #31

(imported from commit f1f04b5c50bf9f33b69c90926fd67015cd2dc219)
2012-11-26 14:43:55 -05:00
Jeff Arnold a6ec875268 [schema] Add enable_desktop_notifications to user profile
(imported from commit f5b543e8446263ce8855561441a6d4c1a8d41f4d)
2012-11-26 14:43:55 -05:00
Keegan McAllister ec6ebd034b Add Nagios bot user
(imported from commit e36ea06908b488e4003463e1afa34181fd299316)
2012-11-26 14:42:55 -05:00
Zev Benjamin d8783cd0c0 Move reload in progress check from compose.show to compose.start
(imported from commit 8b84b24ca50a3bd149d67b868dd94908c0354022)
2012-11-26 14:42:27 -05:00
Zev Benjamin 85e2bf9030 Remove dead code. We keep the message type and client name in JS instead of the DOM now
(imported from commit 79834160c53a5f7d99918d629fde311aa99fe280)
2012-11-26 14:42:27 -05:00
Zev Benjamin 507a730f77 Make compose.show a private function
(imported from commit 32457fd7f045e9eb3febaed3de2dd1a4aebc9422)
2012-11-26 14:42:27 -05:00
Zev Benjamin 40b31f6f57 Remove dead code
(imported from commit 3893b95cc3c26596d580ea07286955c2ab19cddd)
2012-11-26 14:42:27 -05:00
Zev Benjamin e35ec6e022 Stop using Bootstrap tabs for compose
(imported from commit 39dfbf9c427aaf3a85507e26ffeb1257da3dc435)
2012-11-26 14:42:27 -05:00
Zev Benjamin 886bda2a45 Use accessors in compose.start
(imported from commit 82cc5dd5892b06a8490fcd40033212f28dca32b3)
2012-11-26 14:42:27 -05:00
Zev Benjamin 8367cec454 Fix indentation
(imported from commit 4735fd730eb74cff8d494fc3d440111733af505f)
2012-11-26 14:42:27 -05:00
Waseem Daher 6d2b2f897a Implement safari composebox workaround in a less fragile way.
If Javascript breaks or stops working, the previous hack means that
Tab-Enter stops working on Firefox and Chrome (since the tab key now
needs to select two divs before it gets to the Send button.)

By putting the one div *after* the Send button, we ensure that this
keeps working gracefully on Firefox and Chrome (and presumably IE), at
the expense of Safari in this specific case.

(imported from commit 9c9a613b1b1718ff8f0b9ef7497ebb13db0ddc64)
2012-11-26 12:15:14 -05:00
Zev Benjamin da2c079503 Use Django's built-in @require_POST decorator
Theirs returns an actual 405

(imported from commit 31be790b0f53d7b63d7d3cd85972b16add3d8c74)
2012-11-26 11:52:50 -05:00
Tim Abbott fac24df233 Show a user-visible error message when mirroring is not working.
The main problem with this code is that the error message doesn't go
away until you reload.  To fix this, we need to add a noblock option
on get_updates.

(imported from commit dc45af397bcf06a218bda5dd224ebd5fdf3462db)
2012-11-26 11:49:29 -05:00
Tim Abbott eefa5b2d7b API: Add support for nonblocking get_updates requests.
(imported from commit bf2ab19a83765c177fbb93abc1a61dccf5b4b2b7)
2012-11-26 11:49:29 -05:00
Keegan McAllister 384a50822d Avoid unnecessary rows.get in pointer management
(imported from commit ef1d8a885b264be797616a2bab3f23e2702949c5)
2012-11-25 15:21:55 -05:00
Keegan McAllister a70fb98038 Reduce code duplication in keep_pointer_in_view
Fixes #269.

(imported from commit 5d382c0e1493a0798fc9bd1f5a8f37e15f2ea5ef)
2012-11-24 02:03:17 -05:00
Keegan McAllister b21bdc91cb Fix email addresses generated by populate_db --extra-users
(imported from commit bdb93e51966ca8c0e20d67cccbe50e80e2592127)
2012-11-23 19:19:46 -05:00
Zev Benjamin f1e644ece8 Fix "multiple popovers can appear" issue.
The reproducer for the issue here is:
- Scroll to the top of your feed
- Click on a stream name
- Open a popover
- Click on a subject name
- Note that your old popover doesn't go away, and that you can open
  a new one.

The problem was that when we narrow, we call jQuery.empty() on the
zfilt table. That not only removes nodes but also clears event
handlers and jquery data. Thus, even though we have a reference to
the old popover element in the ui module, the element has forgotten
it had a popover. When we call .popover("destroy") it actually
creates a new popover, but never shows it.

(imported from commit 9721d60c78549bd2362833590b304952f2bdef2d)
2012-11-21 18:02:33 -05:00
Jessica McKellar 3b4df3bbad Refactor replace_floating_recipient_bar to reduce code duplication.
(imported from commit 9f044a370e4b57c12eaca667e7d0ccdf9f546628)
2012-11-21 16:44:04 -05:00
Jessica McKellar 89582bff8a Fix floating recipient bar being unnarrowable.
When we switched to delegated event handling, the bound handler for
all of our events was #main_div, but the floating recipient bar lives
outside of #main_div. Additionally, the bar needs to inherit the zid
from the target recipient bar since it is used for the narrow.

(imported from commit 7c18e16f2e98436888a8edb81fbbdd4d17abfe2a)
2012-11-21 16:44:03 -05:00
Luke Faraone dad00fa29f Add script to create new realms.
(imported from commit 764d41f28b1af10860ea4d03a6aa983f40d3ffd7)
2012-11-21 16:42:15 -05:00
Luke Faraone 724dce78e4 Always allow registration if attempting to register for a non-MIT realm.
(imported from commit 00489ab74c376a4ffb23ad661699ef31c6c06818)
2012-11-21 16:42:15 -05:00
Zev Benjamin f77b138bc4 Fix left border appearing on messages in Firefox
The problem seems to be caused by a bug in Firefox.  We work around
the issue by adding empty table rows to the top of the table and
removing them when the user is idle.

This resolves trac #413

(imported from commit 2b15a4a2241bd7e813800a42608d650e0d4fa4f0)
2012-11-21 12:18:04 -05:00
Waseem Daher 807113fa70 Temporarily remove user-visible "time travel" UI.
I'd like to think about how to polish aspects of this a bit more,
but would like us to be able to deploy master at some point today.

This is basically the philosophical equivalent of reverting the
user-visible UI changes introduced in
b7b6794ad635ec63269a2043cd48b02749fbffda

(imported from commit edfaadf26741c47120c3acf6c410d33025c0a260)
2012-11-21 11:30:56 -05:00
Waseem Daher 776a947f75 Properly handle a "top" update in an empty narrow.
Previously, it was impossible to narrow to a completely empty narrow.
Now it is possible, and the code needs to be tweaked in a few ways
not to break in this case.

(imported from commit e4dd4159ad52d003fc11d0b8b6531322c12a3de8)
2012-11-21 10:38:31 -05:00
Keegan McAllister 161af7838f Prevent session expiry as long as the user has reloaded in the past two weeks
Fixes (?) #416.

(imported from commit 9d56fe4125f742e2cdccc41ebd385daacccf461f)
2012-11-20 21:49:11 -05:00
Keegan McAllister ced6921491 Redirect to /accounts/login if an Ajax call fails because we aren't logged in
Fixes #396.

We could display an error message, but jumping right to the login page seems
smoother and conveys the same information.

This will discard any message being composed, but preserving it would have
security consequences that we should consider further before implementing that.
Hopefully, users only get logged out by an explicit action, so they can't
complain too much (but see #217).

(imported from commit aaa23ecf46c73e514117ae1010fc44e133f2ba07)
2012-11-20 21:49:11 -05:00
Keegan McAllister 33d1b77344 Return HTTP 401 Unauthorized from JSON views when not logged in
(imported from commit c1f4989c8d1132e10b2e61e9ef08000823994b35)
2012-11-20 21:49:10 -05:00
Luke Faraone ed691f0b6e Linewrap long line in views.py
(imported from commit 923ce6d87755e4827995d10f62b574d416246147)
2012-11-20 17:40:40 -05:00
Luke Faraone 48806b5548 Fix incorrect Recipient access, use create_stream_if_needed.
This solves 500s that were occurring when subbing to "signups" and related
actions.

(imported from commit 91a59cc23d144133565b2465896e0c5ba868a9bb)
2012-11-20 17:38:00 -05:00
Waseem Daher 12f1a29e07 Specify the stream in a way that includes the realm.
(imported from commit 4de319fe3600f7d434be5198fef214f059f4b668)
2012-11-20 17:18:32 -05:00
Tim Abbott 15c778dacf style: Use space before "(" when defining an anonymous function.
(imported from commit 369e13d918f0da2566587b83f3881c908a152519)
2012-11-20 17:17:39 -05:00
Tim Abbott 14494d6a1f Add "time travel" feature.
(imported from commit b7b6794ad635ec63269a2043cd48b02749fbffda)
2012-11-20 17:17:39 -05:00
Tim Abbott bbf482b6f8 Fix using "load old messages" on the narrowed view after unnarrowing.
Previously, we were adding those narrowed messages to message_dict the
first time, and thus totally skipping those messages each additional
time you tried to "load old messages" on that narrow.

(imported from commit 77eef376e1165b86e3c599608a1b5089a09d51e0)
2012-11-20 17:17:39 -05:00
Tim Abbott 2b7ecfd325 get_old_messages: support adding messages on both top and bottom.
(imported from commit f01ca9f9770d07fb736f07b4c2397efe71ee8d1e)
2012-11-20 17:17:39 -05:00
Tim Abbott da43f250a4 narrow: Fix incorrectly adding messages to message_array.
(imported from commit babc7f40e0817c29e7d55f3ba534cbf3de8e3920)
2012-11-20 17:17:39 -05:00
Luke Faraone b1ba5bf1b2 [manual] Send a message when a new user creates an account.
(imported from commit 2c69be9bfbbe947db41188cbdfc05cf887dc858f)
2012-11-20 16:41:55 -05:00
Keegan McAllister ff040faf97 bugdown: Use Markdown.reset() instead of re-creating the whole parser
(imported from commit 45a65453f2178a6a73392e2bd1e7d6d03de0e0e7)
2012-11-20 15:10:15 -05:00
Keegan McAllister fc60543432 bugdown: Remove trailing punctuation from automatic links
And allow parentheses etc. within a link, if they're not at the end.

Fixes #401.

(imported from commit 5261fce74fe381ceece2e7406776cc5bde19deb9)
2012-11-20 15:10:15 -05:00
Jessica McKellar bdf3473bac Fix bug where sending a PM would display as sent to the wrong person.
In get_display_recipient, the userprofile was selected incorrectly by
user_id instead of the userprofile_id. In production, this hasn't
resulted in a user-visible error because we use MySQL and user ids are
always equal to userprofile ids.

This does happen if you are using SQLite locally and run populate_db,
which adds a bunch of users in parallel in an insufficiently
transactional way.

(imported from commit c25a04b4919e3efdfc6996b03492f7714d9034e8)
2012-11-20 15:08:50 -05:00
Jessica McKellar cb50d4e7ef Have smarter PM autocomplete: sort based on who you Humbug the most.
(imported from commit 8b0223c97bc2cb8a1470ca482831ca615aaf10ec)
2012-11-20 15:08:49 -05:00
Zev Benjamin dbb0241568 add_to_table: bail early if there are no messages to render
This bug affected receiving messages while narrowed.  When none of
the messages recieved matched the narrow predicate, we'd try to
render messages and then create a jQuery object out of a bunch of
newlines (the only thing that results from a render of 0 messages).

(imported from commit 81f5aa46fac06fe0e5a14a8757f245f90b5845cc)
2012-11-20 14:06:36 -05:00
Jeff Arnold 57fbf21a7a Make searches with no initial results still work
(imported from commit 3dde5d661521001373430c1413ac1f80a16a1c2d)
2012-11-20 10:31:28 -05:00
Zev Benjamin 359fb41b64 Manipulate messages before adding them to the DOM
This greatly reduces the number of events generated and prevents the
blue flashing on message arrival.

This also necessitated a change in how we looked up message rows to
add the 'next_is_same_sender' class, which led to a further
optimization where we don't have to do as many jQuery selections by
id.

(imported from commit 0bcd5688b483c560b6f3a29c6d36433da600e8ef)
2012-11-19 23:31:23 -05:00
Zev Benjamin 39aab741c8 When hiding the sender email address, only hide the element that was previously shown
(imported from commit 527f58aff4f2ec65d7ffe693bc20298b4563ff4e)
2012-11-19 23:31:22 -05:00
Zev Benjamin 90e0fc6259 Module pattern for ui.js
(imported from commit 951984ec1006e93a0ffc7e299b52fa02c10eb976)
2012-11-19 23:31:22 -05:00
Zev Benjamin da6cc30134 Add abstraction for manipulating userinfo popovers
(imported from commit 155302f103cfef8475482339596eafc594467532)
2012-11-19 23:22:50 -05:00
Zev Benjamin a5ea766ff6 Use delegated event handlers instead of inline, direct handlers on messages
(imported from commit dd7dc77e8282371a5f3b82e0cfa93f09d53a7a80)
2012-11-19 23:22:50 -05:00
Keegan McAllister 8c20362c18 Prevent the compose box from changing size slightly as the textarea gains / loses focus
(imported from commit cb863675c8c04d936aa62f56d0b4c28c41f04efb)
2012-11-19 17:14:30 -05:00
Jeff Arnold 9ce4c103c0 Implement full history search by creating a narrow for a search term
(imported from commit 3f2df6a6e590458ff774bbd658bbd1d95076a4db)
2012-11-19 17:12:59 -05:00
Keegan McAllister ba40bd390b bugdown: Use our local copy of fenced_code
And wire it up to our local copy of codehilite.  This fixes highlighting in
fenced code blocks, e.g.

~~~~ .js
var x = function () {
    return "hi";
};
~~~~

(imported from commit 0efb0c9b98a3acdf55e18bb1918af7960f3425be)
2012-11-19 13:04:40 -05:00
Keegan McAllister 7d08c405f3 Import GitHub version of Markdown fenced_code extension
(imported from commit 929de2ba09a5c6dabed20c7f1b3ba319ba42b244)
2012-11-19 13:04:40 -05:00
Keegan McAllister 45cb7c1d37 bugdown: Don't guess code highlighting language
Disables highlighting unless a language is specified.

(imported from commit fe5d1a4a8042241336ee7ac01682553f6b35e956)
2012-11-19 13:04:40 -05:00
Waseem Daher 53f5480fc4 Don't recompute search typeahead source every time.
(imported from commit 8e7ffa76ec701519704280caa282eb4639998a42)
2012-11-18 19:41:04 -05:00
Waseem Daher 57d35649f3 Move update_autocomplete into typeahead_helper.
(imported from commit e15446e09869da482dbe554b824ea8bb6f060cf1)
2012-11-18 19:41:04 -05:00
Waseem Daher f9130369f2 Rewrite private_message_typeahead so it has access to the people_list objects.
(imported from commit 3772fb2db9db96947555d30ad923edbde3127b3f)
2012-11-18 19:41:04 -05:00
Waseem Daher 31c4cf96d2 typeahead_helper: Add escaping highlighter.
(imported from commit 71c08479763da792b581ff191c04889f0383ccc9)
2012-11-18 19:41:04 -05:00
Waseem Daher f214c2df75 Lay the groundwork for a "typeahead helper" module.
(imported from commit 0b73238e935fac7c13d7152b262d3e71a714f3ea)
2012-11-18 19:41:03 -05:00
Waseem Daher 2287c553ec If we just narrowed from a search, blur the searchbox so that Esc still works.
(imported from commit e8bfe58b81a12bb6dba34ab5210c249a33b5c700)
2012-11-18 19:39:49 -05:00
Waseem Daher afa7e83414 Make the searchbox typeahead optionally narrow to stream or PMs.
(imported from commit dcef6f4d426a37c010363cc943441bd0361f8f05)
2012-11-18 19:39:44 -05:00
Waseem Daher 95706ce9a2 Create a searchbox typeahead where enter does not submit the form.
(imported from commit 38105e2f31611dda8c9767212f18c1a73640df45)
2012-11-17 23:58:16 -05:00
Waseem Daher ab78076c43 composebox_typeahead.js: Export code that splits name-and-email.
(imported from commit b118a9b0475b71cb4ffd880bcde5868d4e81e73e)
2012-11-17 23:29:35 -05:00
Tim Abbott 6026c80de6 API: Add unsubscribe function.
(imported from commit 6dc55e9030770500770ce3921a4e77499d64f2d6)
2012-11-16 17:06:01 -05:00
Tim Abbott d1239278c7 Rewrite remove_subscriptions to work like add_subscriptions.
In particular:
* Taking a list of streams as arguments.
* Using the _backend model so that we can have an API version.
* Considering "not subscribed" to be a non-fatal error.

And of course the corresponding changes to subs.js.

(imported from commit fdb300c6aa6921c2c6b09c22bd1e64405c368809)
2012-11-16 17:06:01 -05:00
Tim Abbott ff2b5c19de add_subscriptons_backend: Some minor code cleanup.
(imported from commit 14a8352b65859b5a8688a6823404f4a7982403ae)
2012-11-16 17:06:01 -05:00
Tim Abbott f1ccf44c99 add_subscriptions_backend: Check that the argument is a list.
(imported from commit c514dab9fb28dcdaa12b38e7ef028e177f4377fb)
2012-11-16 17:06:01 -05:00
Tim Abbott f5ccde78e3 [manual] Use "subscriptions" for {add,list}_subscriptions consistently.
This change requires a zephyr_mirror deployment when it is pushed to prod.

(imported from commit a31d6efd2db4d4617c7c6b00326be3f07c7263da)
2012-11-16 17:06:01 -05:00
Tim Abbott afc62a8e16 [manual] Uniformize the subscriptions API method names.
This requires a zephyr_mirror deployment when it is pushed to prod.

(imported from commit 6543441fb264b518f8705d7989d068a1d50ce5d6)
2012-11-16 17:06:01 -05:00
Waseem Daher b251d064f9 narrow.js: Add ability to narrow to private messages by name/email.
(imported from commit b3afda6444afa9b44b140882f3d71fb41b3ef10d)
2012-11-16 15:58:49 -05:00
Waseem Daher 77a45cbc0e narrow.js: Add the ability to narrow by stream name.
(imported from commit 033dea1f63cceb30f37eae50ea3a7425a8e94685)
2012-11-16 15:58:37 -05:00
Waseem Daher 162c708bde Add the ability to get more messages by stream name.
(imported from commit 38a2847a9820585a458c651436e3a7ec9256c590)
2012-11-16 15:58:21 -05:00
Keegan McAllister 3494a3ae2a tests/frontend/run: Make waiting for the server less noisy
(imported from commit c62bc23081e76e18de2aeddf45a2e7043deabc2b)
2012-11-16 15:33:38 -05:00
Keegan McAllister 2a619a0054 tests.py: Allow skipping generate-fixtures with --skip-generate
(imported from commit ca3de89fc5cd71e3a60b173275edf7cf74d65cdf)
2012-11-16 15:33:38 -05:00
Keegan McAllister a2750943e3 Use a custom Django test suite runner
This allows us to define new command-line arguments for 'manage.py test'.

(imported from commit 11cf24694a54a3b717256903b7582ddec9a85587)
2012-11-16 15:33:38 -05:00
Keegan McAllister 172386d9dd tests/frontend/run: Complain if the test server dies
One way this can happen is if run-dev.py --test is already running.  In that
case the one we launch will die with "Address already in use", and we should
alert the user that test results may not be accurate.

(imported from commit 078091cace2cff777b444668b03f96dc208f22fc)
2012-11-16 15:33:37 -05:00
Keegan McAllister 5344c9dcc5 frontend/tests.js: Wait more intelligently to receive messages
(imported from commit 4bd6ad72cbde8f0cb8bdd3b20883d1449435bb29)
2012-11-16 15:33:37 -05:00
Keegan McAllister b8f0599c7c tests/frontend/run: Avoid leaking test server on exception
(imported from commit 4c8ab0db991655a6647bd9861cc2fb95b21c1be4)
2012-11-16 15:33:37 -05:00
Keegan McAllister 0e6ce16172 tests/frontend/run: Wait more intelligently for the server
(imported from commit c3e26d7a85bca85921270d7927c0243df6586a2a)
2012-11-16 15:33:37 -05:00
Keegan McAllister 1ea92c0953 Manage file locking using the 'with' statement
This is clearer and more exception-safe.

(imported from commit b67641b05da9dbf8e5a887f398bac81ab5985cf3)
2012-11-16 13:43:44 -05:00
Keegan McAllister af36b437b6 log_event: Use 'with' for files
(imported from commit d49b46ecd8aa74679ade3820004d10cb42940ad3)
2012-11-16 13:43:44 -05:00
Keegan McAllister ccf14b89c2 log_event: Don't flush the log file right before we close it
There's no need.

(imported from commit 8c3b933b7fddfb858ee4dc201b63b6fe921dc8e9)
2012-11-16 13:43:44 -05:00
Keegan McAllister f132cd311b log_event: Close the lock file after we're done with it
(imported from commit 023e50e1aeeafee334f9b55e12ab91aa84a7872a)
2012-11-16 13:43:44 -05:00