Commit Graph

3772 Commits

Author SHA1 Message Date
Zev Benjamin 122996b656 blueslip: don't double-wrap handlers when invoked with the $.on(types-Object, selector, data) syntax
(imported from commit 458ee9248fc82efc6c2307634b2be6d3ce32246d)
2013-03-14 15:07:28 -04:00
Zev Benjamin 22bb67150c blueslip: Do not catch exceptions from callbacks in debug_mode
(imported from commit 6ea79285dfd9f1f7b5d9f5d663a84247757d8af4)
2013-03-14 15:07:28 -04:00
Zev Benjamin dfe69eef0d Funnel exceptions from ajax handlers through blueslip
(imported from commit 5ad08482989d25a0fd0ee02251b74a23f950a0b9)
2013-03-14 15:07:28 -04:00
Leo Franchi 7510f87eac Select first unread when narrowing by clicking on stream in sidebar
(imported from commit 557751f44e3fee61b6a55f8f8328e2f97e6adc04)
2013-03-14 15:01:13 -04:00
Tim Abbott a0d0bdb5cf Fix copy/paste in compose box.
(imported from commit 075a461136e040b7d5d752e9386d9321d76c956e)
2013-03-14 14:55:14 -04:00
Leo Franchi 4a23959b11 Remove pointer_updater param as it is no longer used
(imported from commit 80cc4a6d4c24660087981b1132ca2ed44c86a424)
2013-03-14 13:35:28 -04:00
Leo Franchi 7c7822601f Use request._client to detect a mobile pointer update
(imported from commit d06606ded33bc598e1bdb4b33279ce92b098ed02)
2013-03-14 13:35:28 -04:00
Waseem Daher 9c45b96b21 Make Dropbox inline image preview more robust to sharing links.
Sometimes Dropbox shares with /s/ and sometimes with /sh/,
and I'm not sure which controls it, but we should deal with both.

(imported from commit 2222450f25c418b5fbd60ab2c30477467e34c0d1)
2013-03-13 17:46:43 -04:00
Tim Abbott cd4709c0f1 update_pointer: Only have one request in flight at a time.
Previously, if for some reason pointer updates were not returning from
the server, the client would resend its request every second, rather
than waiting for the previous request to fail before sending a new
one.

(imported from commit d134adc50aabd135c7631913fecab3519aca6640)
2013-03-13 17:41:33 -04:00
Tim Abbott 99d4bc114b Move Zephyr mirroring liveness check to the UserPresence queries.
It's closer to a presence query than an update, and more importantly
this moves this out of Tornado -- previously Tornado was spending at
least 3ms per recipient on messages sent to the MIT realm fetching all
this data to return back to users.  This should save around 100ms per
message sent to a popular stream the MIT realm -- but more
importantly, each such event is 100ms during which Tornado is not
processing other messages.

(imported from commit 134169f0fdcd9f6640fda957edc4a28b07783d8e)
2013-03-13 17:41:29 -04:00
Leo Franchi 0f68411859 Mark messages as read when creating them in populate_db
(imported from commit 6bf0d5bf889e94618c355e56f145b353f7574e60)
2013-03-13 14:14:46 -04:00
Leo Franchi 153983a933 Add a manage.py command to add read flags up to the current pointer
This is required because our migration is going to go in two phases.
When we do the database migration (on pushing to master), we update
all messages at that point. But prod doesn't know about the new
flags field, so any new messages sent on prod will not have the
read bit set.

When we push to prod, we want to re-run the bit of the migration script
that automatically sets read flags on messages older than the users's
pointer.

(imported from commit 961d33e972eac9ada80089bf1b1269c7fb42d56b)
2013-03-13 14:14:45 -04:00
Leo Franchi e82b408be9 Add a shim for mobile clients to update new read flag
(imported from commit e8e269156ea671e590589f48f8494c25380a2dde)
2013-03-13 14:14:45 -04:00
Leo Franchi ff42774551 Refactor unread client handling to use 'read' flags per message
(imported from commit ca48745396e7fbac456e5eb2e7dbe4adc62b3492)
2013-03-13 14:14:45 -04:00
Leo Franchi 93a3f14c43 Add backend support for handling new 'read' message flag
(imported from commit 6194e9332caa2d279cbc304f0d6a69f969aa9a72)
2013-03-13 14:14:45 -04:00
Leo Franchi 6a53d1c35d Add flags to dict in load_old_messages
(imported from commit 7f68ea97a424aa0b01983258dbf6e9a2a07a732a)
2013-03-13 14:14:45 -04:00
Leo Franchi a678ef2af8 Add flags field on UserMessage, created by previous south migration
(imported from commit e839a3871d27cd7082ecbc84946216143d373da0)
2013-03-13 14:14:45 -04:00
Zev Benjamin b9dd227bb5 Move seemless reposition on render code into _maybe_rerender
We also needed this when rerendering on append, so moving it into
_maybe_rerender allows the two places to share the code.

(imported from commit 027d99cae7864747cf1ec94c95e8ece495b5c907)
2013-03-13 14:07:22 -04:00
Leo Franchi 5ce3a41e6d Fix typo in user-visible string
(imported from commit 39131763be700b91be3bbbbb2d16ba1c3c8d7a85)
2013-03-13 13:50:45 -04:00
Leo Franchi 60eeffc82d Fix 0012 migration to work with sqlite
(imported from commit 05ed67e199bdaa1485912748b304cdb890b6115b)
2013-03-13 11:52:06 -04:00
Leo Franchi 794c897bbc Lower thresholds for migration speed
(imported from commit da749dcdeb9396fa71c09e0b6f7275a67b1568f0)
2013-03-13 11:52:04 -04:00
Tim Abbott f7ecfea7c1 Fix query for stream_name in compose module.
(imported from commit 8b8069a9fbf32805a77299e8375256e7a27e7ba1)
2013-03-13 11:22:11 -04:00
Waseem Daher 52b3da6668 Make clicking gravatar or "Humbug" take you home.
Looks like this was broken in 546063f88d58fb988363e5c89a13507deeb20afd.

(imported from commit 077186e60bf7a48742e71bbcb4e705c02f1ddc0a)
2013-03-13 11:16:09 -04:00
Tim Abbott 275af189a3 Cache permanent errors from the Twitter API.
This avoids our repeatedly retrying to fetch a tweet that doesn't
exist from the Twitter API.

(imported from commit b4ca1060d03da21e7e59e5b99e682d2e8457df15)
2013-03-13 11:12:25 -04:00
Tim Abbott 61ee8b1921 Unfade messages after you manually edit the recipient.
It's pretty confusing if this doesn't change.  In some other world we
could update the fade, but since we're currently only fading on reply,
I think it would be weird to update the fade when you're picking a new
recipient.

(imported from commit 8f77419d443d578068b57f847354ac6da7632ee2)
2013-03-13 11:12:25 -04:00
Tim Abbott 1e62ced172 Fix fading when replying to sender.
Previously, we compared the recipients of messages to the message that
you triggered the reply off of -- even if you did a reply-to-sender.
This commit changes the code to instead track what you faded by,
rather than just the message you faded on.

Fixes #1037.

(imported from commit d9e2cb4122501b1bc45e231d4b52c2e7f9284fdd)
2013-03-13 11:12:25 -04:00
Tim Abbott 24a235a091 compose: Move unfade_messages() call inside fade_around.
This makes the API a little cleaner.

(imported from commit c5eb9a4998971cdbe1f8ac3a14fd9759584771bb)
2013-03-13 11:12:25 -04:00
Tim Abbott 6c6a005920 Update recipient on renarrow when compose box is open but empty.
(imported from commit ff50b3b38833e7467ca77714acb1d81c22aeed0c)
2013-03-13 11:12:25 -04:00
Tim Abbott ee8d646d74 compose: Don't clear the compose box when recipient didn't change.
(imported from commit 5188a0f510e499c80d4c188a1ce59af4f2fe3262)
2013-03-13 11:12:23 -04:00
Tim Abbott 10be8d2a12 compose: Fix loss of message fading on renarrow.
Previously, if you renarrowed, all message fading would be cleared
until you close and then reopen the compose box.

Fixes #1024.

(imported from commit 57981ba29ab597c4c84ca6e4e9d04a8284f49117)
2013-03-13 11:10:51 -04:00
Tim Abbott 012f0566a1 compose: Fade all relevant messages on the page, not just neighbors.
(imported from commit 69e11a980b9cbd69753754b9a42248ef0f3d5a21)
2013-03-13 11:10:51 -04:00
Zev Benjamin 05eec2ae19 blueslip: Add some clarifying comments
(imported from commit 8b8ed83593d4dfb8ac3deb2c3442c2614481701a)
2013-03-13 10:55:34 -04:00
Zev Benjamin 09cf339c2b blueslip: Handle exceptions from jQuery event handlers and $(document).ready functions
We treat these exceptions the same way we treat fatal errors: report
the error message to our server and then allow the exception to reach
the top level.

We could also override document.onerror, but don't.  There are a
couple of ramifications of this:
* Exceptions caused by event handlers directly attached to DOM
  elements aren't handled
* Exceptions caused by code at the top level that triggers an error
  (such as parse errors in our Javascript files) aren't handled

The reason we don't override document.onerror is because the
document.onerror handler has a limited interface and doesn't receive
the exception object.  It only gets the message, file, and line
number of the error.  Additionally, exceptions that we allow to
propogate out of blueslip trigger an onerror event when they're never
caught.  In order to avoid handling the error twice (once by blueslip
and once by the onerror handler), we'd have to encode the fact that
the error has already been handled in the error message, which is
pretty ugly.

(imported from commit 7f049ae519dc198a9f7cfd41fd5dd18e584bd061)
2013-03-13 10:55:34 -04:00
Zev Benjamin 5bd4f2ccd7 blueslip: Throw a custom exception type
(imported from commit 4a3612b63bb4481a56901cc3dd6cea9a3d1a1aea)
2013-03-13 10:55:34 -04:00
Zev Benjamin 6d25940299 blueslip: Pass the stacktrace into report_error
This is to let us pass in the stack trace of an existing exception,
which will be required in a upcoming commit.

(imported from commit 421366a7a01deb770b7620417fb4660769c5db53)
2013-03-13 10:55:34 -04:00
Zev Benjamin a5b7c86303 Show an error message to users on fatal errors
(imported from commit a1ee2329e6b9dfa6f575106f1e32574bef0598a2)
2013-03-13 10:55:34 -04:00
Zev Benjamin fb0dd60857 Simply compose.check_stream_existence now that one of its return values isn't used
(imported from commit 8c910032e8ffd12b9691138ce03ceb096156e3f2)
2013-03-13 10:55:33 -04:00
Zev Benjamin 054d377709 Make stream existance error actually go somewhere
The referenced element where the error was supposed to go was removed
in 66fd42914e4fc33719c4f21ad401748989f20b49.  Now the error message uses
the regular compose error message area.

(imported from commit c82a6d863fa327ba982157d0b0607545d7e65cb7)
2013-03-13 10:55:33 -04:00
Zev Benjamin b383ee1dd4 Only report a given error message once per page load
(imported from commit 058fe321a991bbc50eed63b0bdbf75bcfa8afe2b)
2013-03-13 10:55:33 -04:00
Zev Benjamin 1109d20149 Send browser errors back to the server
(imported from commit 8c676017e8b3fc4f17552db15d32266099dba8f2)
2013-03-13 10:55:33 -04:00
Leo Franchi 2c4c6ba43e [schema][manual] Add South migration for flags on UserMessage
(imported from commit bdf6cf2d5427709e52ef051e3c4a19c5fbb4851c)
2013-03-13 10:20:56 -04:00
Zev Benjamin 65d2f65bbb Check if we need to rerender after appending messages to the MessageList
Previously, if the pointer was high on the page such that there was a
lot of empty space below and the render window was full (a situation
we could get into if we're following new messages arriving), a newly
recieved message would not be rendered even though it would have been
visible on the screen if we had done a rerender.  Adding the
_maybe_rerender() call to the end of append() ensures that we don't
end up in this situation.

(imported from commit 925d3cc62e8221b42f1d5ff1788e99c7d07ccc24)
2013-03-13 00:48:26 -04:00
Waseem Daher a57afd9a63 Use separate Twitter API key for prod.
(imported from commit ab43b42f69eaa569cf7a1ccba9f15d528050c22b)
2013-03-12 18:28:59 -04:00
Tim Abbott c947fbd0e9 Revert "Disable backfilling 1,000 messages on idle"
Now that Zev's message list branch is merged, there's no longer a
performance penalty for loading these old messages, and it improves
our narrowing performance to have them loaded.

This code is slightly different from the original commit
93d47710891cfc4db9fa00beaa5ccd10113aa1c3 since the way to access the
first element in the message list and the API for get_old_messages
have changed since then.

(imported from commit f295f892bea9327eb8316225b7b98f0e3b3fdc9a)
2013-03-12 18:16:55 -04:00
Luke Faraone 10b15640e9 Highlight messages which contain your name.
This was requested by CUSTOMER18 and CUSTOMER4.

Closes trac #705.

(imported from commit a25c6b7ca0ae3ba89c03779b19c4d6b0af93a014)
2013-03-12 18:01:16 -04:00
Jeff Arnold e9cbae67b3 Make clicking notifications give focus to browser
Resolves Trac #1081

(imported from commit d5546ecda53a57b6dbbfc65db923432f8e4cc7b2)
2013-03-12 16:03:42 -04:00
Luke Faraone 3c95013a15 Iconify public/private streams on subs page and new stream modal
This will hopefully make stream privacy more noticeable. We still don't
allow people to modify privacy after stream creation, however.

Since we now use a radio box on the stream creation modal we had to change
the selector used by subs.js to determine if a new stream was to be invite-
only.

(imported from commit 641a4fab74301a9b3ecd4b3859f010dd4ece193e)
2013-03-12 15:14:29 -04:00
Tim Abbott f160703f4a [django 1.5] Use new class-based views in urls.py.
These have been the recommended way to do generic views since Django
1.3, and the old-style views (previously deprecated) are gone in
Django 1.5.

(imported from commit 45938f452bd6aa363f7ccdbac9f2297d1b1b5e7b)
2013-03-12 14:45:45 -04:00
Zev Benjamin 26580f2399 Deduplicate messages from get_updates
This is a workaround for bug #1062.

(imported from commit 449b00e653829e263583376a88ae67b1fe4f5eb6)
2013-03-12 14:36:45 -04:00
Leo Franchi 0df3d5f2aa Give create db permissions to humbug postgres user
(imported from commit 85775d1885efcd8790593e6841ce9d56f027eea7)
2013-03-12 12:51:12 -04:00