Commit Graph

1897 Commits

Author SHA1 Message Date
Keegan McAllister b283123382 bugdown: Remove special treatment of backslash
Fixes #562.

(imported from commit aa39cf390ef44275c7d5a84ca954c75535d372b1)
2012-12-11 16:54:10 -05:00
Zev Benjamin 695d9a4dc6 Change get_updates_params.reload_pending to reload.is_pending() as the former no longer exists
(imported from commit fdc59a27230cb49adee2f5444e440aaa84103e5e)
2012-12-11 16:40:26 -05:00
Jessica McKellar 2f1f1fa6be Add tests for /json/get_old_messages.
(imported from commit 36a076af79635a11d9d48439bd92dfa694ed9df6)
2012-12-11 16:07:09 -05:00
Jessica McKellar 41e688d913 Add exception handling around database lookups based on user data.
(imported from commit 4ddab2ed130ef57c967cc9364f8890a4c5b5e347)
2012-12-11 16:07:09 -05:00
Jessica McKellar 435c98b35c Be more picky about the type of get_old_messages's narrow POST parameter.
This addresses 500s observed on prod due to bad narrow values.

(imported from commit 5a865ce41e8a90d3990332d906cba4336eb53ada)
2012-12-11 16:07:09 -05:00
Tim Abbott cba3ad8315 Humbug errors: Only display most useful request fields.
(imported from commit 1d7803b5cd1fb099cecbd14af42e2c48d263bdae)
2012-12-11 16:06:12 -05:00
Tim Abbott 1575c522e1 Humbug errors: Adjust the subject to show server name.
(imported from commit 398f0988e7817212a455c73e811be2238695de83)
2012-12-11 16:06:12 -05:00
Tim Abbott 25d95e25c8 Humbug errors: Remove unnecessary newlines in tracebacks.
(imported from commit ad5834fa32e13ede1c634e4e9e535d84eb833c95)
2012-12-11 16:06:12 -05:00
Tim Abbott 4dae30e750 Re-enable markdown for all realms but CUSTOMER1Labs.
(imported from commit 51e770b50e8c678c245d099dc9177aa49ecb5084)
2012-12-11 12:04:46 -05:00
Zev Benjamin ebb9cfa65d Re-enable markdown rendering for API users and the github bot
(imported from commit 31db13ef8b7e5224a07f784247092e2eb9cd1654)
2012-12-11 12:02:05 -05:00
Tim Abbott 100df7e349 Add a maximum message length of 10000 characters.
(imported from commit a07c872d612521c9792be8dc704a9cfd6c752c75)
2012-12-11 11:33:40 -05:00
Zev Benjamin 19108929a7 github: only describe the first several commits in push notifications
(imported from commit aa26d2ae1d2d30350ec6e30729fb5652f385bd19)
2012-12-11 11:04:37 -05:00
Luke Faraone b9b7d1b8f1 Linebreak zephyrs.
(imported from commit c77499b17ce195e36169bcb39a5f5bdfe6a3ce51)
2012-12-10 15:45:04 -05:00
Tim Abbott 6cff3dc735 models: Disable markdown (escaping instead) for now.
(imported from commit e92920919cd5d0ef11a478be5a0f8a108b62fff9)
2012-12-10 15:23:57 -05:00
Luke Faraone 6ff666b9d7 Filter out "content" and "secret" from exceptions.
(imported from commit 31206f528fc93746133ebe2d9234b6ce0b88cf3b)
2012-12-07 17:32:16 -05:00
Luke Faraone ced8062509 Use MAX_SUBJECT_LENGTH instead of hardcoded constant.
(imported from commit cc885f7ca196ec1de0279a6a6192044ff7c8420f)
2012-12-07 17:32:16 -05:00
Luke Faraone c65d6113ed Factor out notifying of a new user into a separate function, notify on manage.py create_user.
(imported from commit 1a6aa0536dbfea8035b6bbd76528e70d90aa8b60)
2012-12-07 17:32:16 -05:00
Luke Faraone 7fbee21584 Factor out Message() creation for internal use into separate function.
(imported from commit 0352010da4255fc74cd67835e04dbdb1f8bbf4e9)
2012-12-07 17:32:15 -05:00
Luke Faraone 5b70b4a04f Introduce new manage.py command which creates users with default passwords.
(imported from commit ba5ed9cb6ee91435b184845019391e5dc38fc3aa)
2012-12-07 17:32:15 -05:00
Luke Faraone a604183c5b Log errors to Humbug, too.
(imported from commit 2547625135568f3ea004bf4287471a82bc0a4f38)
2012-12-07 17:32:15 -05:00
Waseem Daher d04758f5f1 Don't make it seem like the composebox messagebox is clickable.
(imported from commit cd5840b42c11e69e87fa51085f152a193ec8aebd)
2012-12-07 15:57:35 -05:00
Waseem Daher 4397400ab4 An ugly reminder of the shortcut for sending messages.
Hopefully this will make things slightly more discoverable;
the previous solution (putting a prompt in the initial text)
was not that discoverable.

(imported from commit f6a7fce1bfd27bda412522768e981b2ffc39f474)
2012-12-07 15:37:25 -05:00
Waseem Daher 4bb330bb21 Allow 'Esc' to clear a keyboard-driven Find.
(imported from commit d48028531b6e7286d177790ec5adb2e5f256b1e0)
2012-12-07 15:01:20 -05:00
Waseem Daher 64b3f072fe Restore "Enter advances find" behavior.
This fixes https://trac.humbughq.com/ticket/546.

It's a little unpleasant that this special-casing lives in hotkey.js
-- instead you could imagine doing something where there was a whole
special set of hotkeys when a search is active, like we do with the
composebox, but this gets the job and is probably simplest.

I would have written this as a case that just falls through in the
else condition, but jslint doesn't like that.

(imported from commit 65a1b8aa1efc356b6690dc177058a4fb9e12745a)
2012-12-07 15:01:20 -05:00
Zev Benjamin f09ddbf80a Raise a ValueError instead of using an assert to enforce constraints
(imported from commit d4b0a9b13df3e2ffd33ae330f2301118c2e75343)
2012-12-07 13:16:31 -05:00
Zev Benjamin d31c33e505 github: fix missing argument to format string
(imported from commit 423cb4cb62976c5689db255120db5061a8b7be11)
2012-12-06 17:18:57 -05:00
Waseem Daher de8b6b5125 Make nginx static pages consistent with the Django ones.
(imported from commit da5aac54285336926ef0c53bd94ca7d68b5e746a)
2012-12-06 16:03:34 -05:00
Tim Abbott 83af3d4090 do_activate_user: Fix join_date default.
(imported from commit ea9f933d6f7e36964ed19ef6d819ad5edc34c483)
2012-12-06 15:49:03 -05:00
Keegan McAllister 273c71e094 get_stream_colors: Use gather_subscriptions
(imported from commit fd870d889335860b14ad7a279160495e84bb303f)
2012-12-06 11:04:32 -05:00
Keegan McAllister b64c8e8979 Add notes about StreamColor schema
(imported from commit 2ca71d63a208be1555866235a2dc631f21a0d181)
2012-12-06 11:04:32 -05:00
Keegan McAllister 6776fd389f gather_subscriptions: Fetch colors along with subscriptions
Fixes #533.

(imported from commit 100b69569f61910a79a911fe82d7c8d14cac1e88)
2012-12-06 11:04:31 -05:00
Zev Benjamin 04063548fe Fix response for unsubscribe requests
The response was being populated with the same stream name over and over again

(imported from commit e205ce6019c1c7980b87ef33fd49497fe9c8691c)
2012-12-06 10:38:07 -05:00
Tim Abbott b5c8fd73f5 populate_db Use message_type variable consistently.
We previously were only using it at the first loop through all
messages, which meant code accessing the message type copied from one
place to another would break (potentially subtly), because things
would work if and only if the very last message happened to have the
same type as what is expected in the relevant piece of code.

(imported from commit ad9ce5efdb200e0c0d5c3ffa6db33113fdad8c5a)
2012-12-06 10:32:45 -05:00
Tim Abbott 28aa976be3 Fix desktop notifications being enabled on every settings change.
(imported from commit 09375c78125987de3223a17239fdef9273ccabe6)
2012-12-06 10:32:45 -05:00
Tim Abbott 41ec4d44a0 Don't let users change their fullname to be whitespace.
(imported from commit 015fc7cbc06acd5057952a3f09a9b6d3fe68d9fd)
2012-12-06 10:32:45 -05:00
Zev Benjamin 037aebd487 Improve Github push messages
This addresses Greg Price's feedback in #527.  We now distinguish
between normal pushes, force pushes, and branch deletions.

(imported from commit 0fab6055f63ffc7e6df283b8bb8ed9971000e6d5)
2012-12-05 16:57:33 -05:00
Jeff Arnold d67e2cc4f3 Put the domain earlier in the titlebar, to help distinguish tabs
(imported from commit 225072a7cc044b011114a8630b02d74640b39d55)
2012-12-05 16:03:02 -05:00
Tim Abbott 8b15b11cbd populate_db: Simplify a bunch of message type checking code.
(imported from commit 6eaf857d3eef8d700c5251bdd242b9bbbc8cdb72)
2012-12-05 15:34:19 -05:00
Tim Abbott 970969fc44 Add new timestamp_to_datetime helper function.
(imported from commit 6791d009ae2e8371abe2c929e87c816a1981f5fe)
2012-12-05 15:34:19 -05:00
Tim Abbott f843152427 log_event: Clean up duplicated timestamp setting code.
(imported from commit dc3b3144ca23106bef2d953b00dc042115008703)
2012-12-05 15:34:19 -05:00
Tim Abbott 4d607c79f1 populate_db: Remove potentially confusing parenthesis.
(imported from commit 9d4dd543f0787c4eae5f7c697b7edcab4cdc8a7c)
2012-12-05 15:34:19 -05:00
Tim Abbott a6f744a11f populate_db: Fix inefficient pointer update at end of replay.
This cuts a 30s operation down to about 2s on my machine.

And also move the code to run before we print the "done" message and
have logging for how long it is taking.

(imported from commit 2f20f8ca3fee714735a50fe6c6cfd630df452768)
2012-12-05 15:34:18 -05:00
Tim Abbott 156f6ee576 Log an event on new realm creation.
(imported from commit 98872c7e5922fecd2bed9b544ff5fffd8147343c)
2012-12-05 15:34:18 -05:00
Tim Abbott 81d560dc1f populate_db: Preserve the user's date_joined on replay.
(imported from commit 91dcb4f41e0e58f165db6a7417e57548914ddab7)
2012-12-05 15:34:18 -05:00
Tim Abbott 8e3bcdaa19 Add user_created event type and appropriate replay code.
This is necessary for correctly replaying new user signups on non-MIT
domains.

(imported from commit e5a9d37b8772bd9794579ef16e7039196ac06f62)
2012-12-05 15:34:18 -05:00
Tim Abbott d6218a15b1 populate_db: Use a function to make email address fixups consistent.
Also add a missing fixup on the subscription events.

(imported from commit f7e2577fca8a3df3cef900c8535612ea8615b2e8)
2012-12-05 15:34:18 -05:00
Tim Abbott fc5e626515 populate_db: Update users table when processing newly created user.
(imported from commit cfcf620888e8d395ca2f808cfff1ee5de89ba2ac)
2012-12-05 15:34:18 -05:00
Keegan McAllister ec3bef300b activity: Provide a link from the app
For humbughq.com users only.  Opens in a new tab.

(imported from commit 509905ebfacb45a454e863e8309896ffd3c538be)
2012-12-05 14:32:41 -05:00
Tim Abbott 72b9f25cbd Don't try to scroll to show composebox when no messages are showing.
(imported from commit 3835c7de0f3cad777b1fd5b609e9dc71635422ac)
2012-12-05 14:06:57 -05:00
Keegan McAllister 6d9e0095eb bugdown: Disable reference-based links
This is syntax like

    Here's [a link][]

    [a link]: http://google.com

This is not very useful for short chat-style messages.  It will confuse users,
especially because we don't document it.  And disabling it saves the effort of
applying the same link fixups as elsewhere.

(imported from commit c23391465486db545302b79c084b4f9cd5cdcc6a)
2012-12-05 13:54:43 -05:00
Keegan McAllister fb77bdf359 bugdown: Set link target, title attributes on the server
For consistency.  Fixes #266.

(imported from commit 63e199a0fe4534df804a82cc98a1fdcf8ccb45da)
2012-12-05 13:54:43 -05:00
Keegan McAllister 80d07f597b bugdown: Ignore user-specified link title
We already override this client-side.

(imported from commit c9569d42d57f206e5fb7d0cc8569b3b578ac1467)
2012-12-05 13:54:43 -05:00
Keegan McAllister 3829c8fd7f bugdown: Assume http:// for links without a protocol
It's unlikely that users want relative links within humbughq.com.

Fixes #447.

(imported from commit d43a5758e6df448b07f56dc2de28078adaab8aeb)
2012-12-05 13:54:43 -05:00
Keegan McAllister d8b6cfdc11 bugdown: Fix confusing variable use in LinkPattern
(imported from commit 1538911149263340a5ea210c6d804a937f07cd5e)
2012-12-05 13:54:43 -05:00
Keegan McAllister b577bd54cd bugdown: Remove code path to bypass sanitize_url
(imported from commit 984b87027cb56fe75c2dd9dcf505dde5bc624f8f)
2012-12-05 13:54:43 -05:00
Keegan McAllister 8b3cfc0f1b bugdown: Use a local copy of markdown.inlinepatterns.LinkPattern
With changes for the way things are imported in bugdown.

(imported from commit 11adf7911f7bb945367221f8fa317caa71de3fc4)
2012-12-05 13:54:42 -05:00
Zev Benjamin 817baa72e3 Avoid sending messages to clients more than once due to out-of-order processing
This resolves #535

(imported from commit 9a7bf7443d17523e9ba14797a0215ee11262c7de)
2012-12-05 13:51:28 -05:00
Jeff Arnold 8d4ddeb57d Keep text in the compose box when another stream/subj is clicked on
(imported from commit f063c92c4378074a7b27e45787dd1591fdde98b7)
2012-12-05 13:12:52 -05:00
Tim Abbott e816604c6e Fix bug where personals might be lost in mirroring.
(imported from commit ed78ca442677f3ee8b3149d61e351f624f437d24)
2012-12-05 12:39:56 -05:00
Keegan McAllister 97bcfbdbb8 activity: Put the three tables into Bootstrap tabs
(imported from commit 508c4b15a82df969b08b430ad892c4b13ed68092)
2012-12-05 12:35:05 -05:00
Keegan McAllister c256fcca15 activity: Right-align numeric columns
(imported from commit a09e961247a8747c96f23b8468c1a0dd5a4edbb8)
2012-12-05 11:42:09 -05:00
Keegan McAllister 3032c94668 activity: Prevent cells from wrapping
(imported from commit d6f9d935b9ed32351804aa153835a171ff093e10)
2012-12-05 11:42:09 -05:00
Keegan McAllister 23eef06ed0 activity: Initially sort rows by time of last activity
Doing this on the server is somewhat easier than making sorttable do it on page load.

(imported from commit 3ed7b127ba874d674d5cfe5b102c62a74be572f8)
2012-12-05 11:42:09 -05:00
Keegan McAllister 3f5d9902ab activity: Color rows for recently active or long inactive users
(imported from commit 5acc9317085acd7b4433b24b96bdf7fdebee5380)
2012-12-05 11:42:09 -05:00
Keegan McAllister 83d86f33ca activity: Clean up table computation a bit
(imported from commit c599d7ca572010c07b457ec15a305eef7dff78dd)
2012-12-05 11:42:08 -05:00
Keegan McAllister 6efe52b935 activity: Decrease table padding
(imported from commit 90bed6ce94442e00e7516f65388b578bdfa920b3)
2012-12-05 11:42:08 -05:00
Waseem Daher f3ba899fe1 Fix responsive layout on Subscriptions and Settings page.
This was a really cute bug where our layout messes up if you resize
the page while "Subscriptions" (or to a less visible extent,
"Settings") is active.

The problem here is that we compute the size of the top navbar
based on the size of main_div -- but when main_div is hidden,
it has a width of zero!

We need to instead look at the width of the pane that *is* active.

Resolves https://trac.humbughq.com/ticket/216

(imported from commit adbef00d190845f90c5cfdb46df4ec7b703635ef)
2012-12-04 23:00:06 -05:00
Zev Benjamin 7e4776322d [manual] Unify huddles and personals into private messages on the receive path
feedback-bot and zephyr_mirror will need to be updated and restarted
when this is deployed to prod.

(imported from commit fe2b524424c174bcb1b717a851a5d3815fda3f69)
2012-12-04 18:01:51 -05:00
Zev Benjamin a454417843 Prevent users from creating an account that differs only in case from an existing one
Fixes #177

(imported from commit 96c6b4c207c920ec94b5fdd69b2937a88669fa93)
2012-12-04 16:37:55 -05:00
Waseem Daher af401fe659 Fix "resizing window breaks in Chrome" issue.
Ironically, I think this might've bee introduced by
commit ca35321c02d5e79e4f9c439a662805c016a333ed,
'Fix "resizing window breaks in Firefox" issue'.

Basically, when the window is 776px wide according to
window.innerWidth, that's the width not including the
scrollbar. However, in Chrome, the media query seems to ignore the
width of the scrollbar, so from the CSS's perspective, the window is
actually ~766px wide, so it goes into condensed mode.

But the rest of our code doesn't, which causes the break.

A bit more on this browser-specific difference at:
http://www.456bereastreet.com/archive/201101/media_queries_viewport_width_scrollbars_and_webkit_browsers/

So the issue we have is, to match the CSS's behavior:
* In Firefox, we should be listening to window.innerWidth
* In Chrome, we should be listening to window.width

We fix this hopefully once and for all by using window.matchMedia --
aka the exact same query that the CSS itself uses. As discussed in my
last commit, this feature is unavailable in IE<10, so we provide a
potentially more fragile fallback, i.e. what we did before this
commit.

(imported from commit d8e6425b81c90c8e0fdda28e7273988c9bfd67ec)
2012-12-04 14:52:29 -05:00
Tim Abbott 386e9eeb22 Fix load_old_messages being called with NaN argument.
(imported from commit 32cb17c98b81a40861f3d825e17a687575f35542)
2012-12-04 14:13:04 -05:00
Luke Faraone ec0683cd86 Cosmetic fixes to tutorial page and copy.
Make it so the image is not squished, change some paragraphs into
headers, and wordsmith a bit.

(imported from commit 81295e1a8ddd4f1ecd4532c4dfb8a38467bb530e)
2012-12-04 13:12:01 -05:00
Zev Benjamin bc67d9d1d7 Prevent race during get_updates that can cause clients to miss messages
This fixes #174

(imported from commit d900957e468815bcb99de67d570dfd7ce4413220)
2012-12-04 12:44:44 -05:00
Zev Benjamin f4898ea490 do_send_message: use JSON for the user list instead of joining/splitting with commas
(imported from commit 85d94ca647d0e6707f4f96e2b7a7b330f76db9d9)
2012-12-04 12:44:44 -05:00
Zev Benjamin 2907c3ca01 Create the Message and associated UserMessages in the same transaction
(imported from commit 96daa925142c97e34e68fae8e4bef713731b4173)
2012-12-04 12:44:44 -05:00
Waseem Daher 3867cc3fe2 Add a "tutorial" page at /new-user
This is an interim strategy for user education that'll be a stopgap
until we build something in the app itself.

(imported from commit 9022d4ceffca98e127f7045f73c012857fe6fc54)
2012-12-04 12:05:56 -05:00
Waseem Daher 3d69853784 Shrink inline gravatars.
This causes our deploy message to be less huge.

(imported from commit 5649eb42df0429a6bbaf8c8fd6f8048a66d22aa8)
2012-12-04 11:28:52 -05:00
Tim Abbott a289efb425 populate_db: Request a new DB connection after run_parallel.
This is the only code change needed to make our code
postgres-compatible.

(imported from commit a94ad0856c46ead2892674fe18d86d49876a6160)
2012-12-04 10:59:26 -05:00
Tim Abbott eea553ce40 banish_broken: Fix handling of jesstess|MIT.EDU@mit.edu.
(imported from commit 50e596261dc678a1aa4b28bec34a6f592c8dc748)
2012-12-04 10:59:26 -05:00
Tim Abbott d850bc764f Fix stream name case issues in populate_db.
When we changed our stream name model to treat stream names as
case-insensitive, we didn't update populate_db to do the same.

This commit makes that update, which is to use the lower-cased stream
name for dictionary lookups and deduplication, but the original-case
stream name for actually creating streams.

(imported from commit fc32ec75a5ae286bce7ec86c6e6fb6893888cbd0)
2012-12-04 10:59:25 -05:00
Tim Abbott cf31374497 bulk_create_streams: Fix missing select_related().
bulk_create_streams was taking about 10 seconds to run with prod data;
this should be a basically immediate operation.  The cause was a
missing select_related on one of the loops through all streams.

(imported from commit 8b82f0c41facc3999bb699dbc350708ac69797e9)
2012-12-04 10:55:31 -05:00
Tim Abbott 2ad1b14f23 Set zephyr_mirror_active to False for new MIT users.
(imported from commit ffa0513561c994da1b561c0ad50728b8351e22e8)
2012-12-04 10:55:31 -05:00
Keegan McAllister 7907be735e hotkey: Make Enter an alias for 'r'
(imported from commit 9bf1b97304a4a4c1100826fefbba8edf1e4cff12)
2012-12-04 10:52:44 -05:00
Jeff Arnold f014163aed When narrowed, we want to load messages older than the oldest message
in the narrowed view, not messages older than the oldest message in
the home view

Tim provided most of the code for this patch

(imported from commit ec0bbfd344cac351f56a456fc560848603721135)
2012-12-03 15:58:26 -05:00
Jeff Arnold 5ea4e30caf Proprely handle get_old_messages when narrowed to personals with yourself
(imported from commit 3ace5655d093f4568b4dea512a6e1bbbd6245f10)
2012-12-03 15:58:26 -05:00
Keegan McAllister f61c26c361 preventDefault for modal mousewheel events but not e.g. subscriptions tab
Fixes mousewheel scrolling on the subscriptions tab.

(imported from commit 38d214fd53a478f3076dbfa4d7942ff13ec61369)
2012-12-03 15:35:46 -05:00
Keegan McAllister 2401fab25c Replace home_tab_active with home_tab_obscured
(imported from commit fb8c47079e63594a22c3d47fcf373887bda6e499)
2012-12-03 15:35:46 -05:00
Jessica McKellar c9c94c6696 Add unit tests for subscription color requests.
(imported from commit 6eeeefcfe75b78d36cd94c4d02ca3a1f1a3df3ac)
2012-12-03 12:46:27 -05:00
Jessica McKellar dbcd6684a2 Add error handling to subscription color requests.
(imported from commit b2f65feeb44abe37397de88c616fa1aa01cf8277)
2012-12-03 12:46:27 -05:00
Jessica McKellar 55e68fc89a Log subscription color changes so they can be replayed by populate_db.
(imported from commit 5c7f46ed0d727926e9819cb2d71eb31f241e2e34)
2012-12-03 12:46:27 -05:00
Jessica McKellar 2fd3eb521c Refactor colorizing requests into a subscription properties model.
(imported from commit da4bfee4a12e941d4ec4c9f140973bb138c82c93)
2012-12-03 12:46:27 -05:00
Jessica McKellar 1dbb2c6ed5 decorators: split authenticated_json_view into POST and non-POST versions.
(imported from commit cdcfdb51c379c07e94ebc763cf925e6a73747fc0)
2012-12-03 12:46:27 -05:00
Jessica McKellar 6a316daee8 Add frontend support for colorizing streams.
(imported from commit 48395ba915d6b22d8a7a8c7fbfb5e462680cef09)
2012-12-03 12:46:27 -05:00
Jessica McKellar 505d35ac9b Add backend support for colorizing streams.
This includes JSON requests to fetch and set stream colors.

(imported from commit 92e19c9a3b72e9012df0178348068ea033b5f060)
2012-12-03 12:46:26 -05:00
Jessica McKellar 71371823f8 [schema] Add a StreamColor table.
(imported from commit 2906c30ad326373bc6265bf30dd0a70e11d69c7d)
2012-12-03 12:46:26 -05:00
Waseem Daher f71affdc11 Layout for colorizing streams.
(imported from commit 50d359ed44f46a0c666778bf510dafbb3e6e6f97)
2012-12-03 12:46:26 -05:00
Waseem Daher bbd2ea4c5a Add spectrum.js (color picker).
(imported from commit 7d25ecab2cb0126df0f165b6cce42a3b266b772c)
2012-12-03 12:46:26 -05:00
Tim Abbott 988b0ce7ba Fix missing transaction decorator in get_user_activity.
The transaction.commit() line inside the except IntegrityError clause
doesn't work unless we've entered transaction management.

(imported from commit 2ae520e05c9a19ec35af7c244631b01d4b9598d6)
2012-12-03 12:30:13 -05:00
Tim Abbott 79f8e2a6a3 get_public_streams: Return only streams someone is subscribed to.
This makes subscribing to zephyr classes for the zephyr class
mirroring bot a lot faster, since we don't need to subscribe to the
third of our streams on which no users will actually receive messages.

(imported from commit 029b7fb260b480db5599e3c9f9effc502f6d8b59)
2012-12-01 09:36:36 -05:00
Keegan McAllister aeb64959dd exunge_log: Ignore default_streams entries
(imported from commit e7b2cd62be0ba868498db286e9e1671441bf07e6)
2012-11-30 17:24:37 -05:00
Keegan McAllister 3715583d29 Implement a command to expunge old UserMessages and Messages from the database
(imported from commit a4873dfa8737c483411d12f30daaebebebf859f9)
2012-11-30 17:24:37 -05:00
Keegan McAllister c8b6e72cbf Implement a command to expunge old entries from log files
(imported from commit 28bc40bf12dd8cea0ff9b842f72e7713640e55a6)
2012-11-30 17:24:37 -05:00
Keegan McAllister 5caf67f27d Implement a framework for data retention policies
And add customer1.invalid to it.

(imported from commit 32b0293bc48abf5d9a3bd36f14f6b16d48ea6ff2)
2012-11-30 17:24:37 -05:00
Keegan McAllister 36816c46e2 Add a function to remove all Messages that are not referred to by any UserMessage
(imported from commit cdad013aed0fd8d1bc6ec8c2dcf5905390a01339)
2012-11-30 17:24:37 -05:00
Zev Benjamin c5bf05ad0a Make clicking on 'Find <search term>' work
(imported from commit 756bd6cb3533e985e031954ece9228a146c5160e)
2012-11-30 17:03:52 -05:00
Zev Benjamin 0af3199d7c Desynchronize web client reloads
(imported from commit 216df5996f597ccd47bbc80e3f2fdaae751789d0)
2012-11-30 15:04:46 -05:00
Zev Benjamin 46f4a5eb38 Add util module
(imported from commit 3844e136fb799c6f57f8823255addf00a07ef686)
2012-11-30 15:04:46 -05:00
Zev Benjamin d29c77b14c Name unconditional reload time constant and appropriately move its use
(imported from commit 5ead2dbe0f170f8b93e726de6d6ed10a985882ab)
2012-11-30 15:03:19 -05:00
Jessica McKellar 37968bc9c7 If necessary, scroll to avoid occluding the message to which you are replying.
(imported from commit adf23d647a3d462d6236d8f1039da89a31b782d5)
2012-11-30 14:32:41 -05:00
Keegan McAllister 83660d7020 mousewheel: Explain why the home_tab_active() check is outside throttled_mousewheelhandler
(imported from commit 6fd5504fb5fb0e72426fa60e051b7e912696b8c2)
2012-11-30 13:58:04 -05:00
Keegan McAllister 3ce4427614 ui.js: Whitespace fixes
(imported from commit d7bb9fe17e319f60f1cc65bdfd381dc2f5d25a3a)
2012-11-30 13:01:02 -05:00
Keegan McAllister ee17165ad5 ui.js: Simplify event setup
(imported from commit 96444a0776e6408eb7e885a630855a0f33e0b6ff)
2012-11-30 13:01:02 -05:00
Keegan McAllister 45e515cc20 Handle mousewheel events properly in modals, different tabs, and compose box
Fixes #109.

(imported from commit ebcc90deeba712296998bfaa2df46ec6be305219)
2012-11-30 13:01:01 -05:00
Keegan McAllister 11487a0fd8 Ignore hotkeys when a modal pop-up is visible
Fixes #382.

(imported from commit 50162fde211a88de5e7f410fd7b1ed0df12d6082)
2012-11-29 19:28:59 -05:00
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