Commit Graph

2232 Commits

Author SHA1 Message Date
Jessica McKellar 256fa0e485 Fix invite bug in which we'd falsely say you'd invited folks with existing accounts.
(imported from commit 9114836d084937dcc1a707338dd916e28f97a87d)
2013-02-08 13:20:18 -05:00
Jessica McKellar a332bee2b7 When inviting users, check if the invitee is in-domain or the realm is open.
(imported from commit 42e072d9717f38cc6d0c7010d37bbabd81aa3ae7)
2013-02-08 13:20:18 -05:00
Jessica McKellar aeba3beb55 Validate and document checking the domain of the recipient of an MIT Zephyr Humbug.
(imported from commit 35b8675171bcdf0c27655723bc76bced8b53a431)
2013-02-08 13:20:18 -05:00
Jessica McKellar 8d06143115 [manual][schema] Add a restricted_to_domain bit on realms.
Default True; if False, arbitrary e-mail addresses can use your realm.

(imported from commit 6eec7516a535429cbaa74f6348651feef73cacd6)
2013-02-08 13:16:35 -05:00
Luke Faraone fd1d790b72 Don't show the stream list on Humbug for MIT.
(imported from commit d9f952aaeb910a7c57ce1174141686331224c8c0)
2013-02-08 12:02:05 -05:00
Luke Faraone 686c709788 Add a link to filter to all private messages
(imported from commit 115f84b42c14acdc8d1827bd8d914a9ac6acab43)
2013-02-07 15:35:46 -05:00
Luke Faraone 9c86db20fc Add support for "labels" in the left sidebar.
(imported from commit 5e942a8d0c7f459148a4961736f4c5305e0c51b4)
2013-02-07 15:35:46 -05:00
Keegan McAllister 8f580352a8 retention_policy: Retain all metadata changes in logs
(imported from commit 28cfc452f1ceca8a3e6b04e32034911ba384a0a8)
2013-02-07 14:29:53 -05:00
Waseem Daher 5dfd4485b5 Properly sort member list on streams page.
(imported from commit 702e78810278584fc8b2e217523ee38ff7907471)
2013-02-07 14:17:58 -05:00
Waseem Daher 87b1c91406 Don't show success notifications on subscribe.
A visual change in the form will already have made it clear
that the action succeeded.

(imported from commit 114bc3a9c9ee759993b8e2c80f7d9a479d365e21)
2013-02-07 14:17:58 -05:00
Waseem Daher bd6be38010 Slightly cleaner subscriptions page error handling.
Prior to this commit, successfully creating a stream (or unsubscribing
from a stream) didn't clear earlier error messages.

Here's how you could reproduce it:
* Try to subscribe to ""
  (You get an error)
* Now unsubscribe from something, or subscribe
  to a new stream
  (The error message does not go away)

(imported from commit c3c6fa6081df00378182ff0c3499e9d907577c04)
2013-02-07 14:17:58 -05:00
Keegan McAllister 5be28bbbb4 expunge_logs: Abort on keyboard interrupt
(imported from commit b1fe93859c15e447c0935fcfb0e83a200bc016ba)
2013-02-07 11:34:49 -05:00
Keegan McAllister a8ffa339de retention_policy: On unrecognized events, print the timestamp to full precision
(imported from commit 0f5908e0602fa8be7dea3d9e3b1ecbc437531df9)
2013-02-07 11:34:49 -05:00
Keegan McAllister d80dd021f1 retention_policy: Retain realm_created events
Previously these fell through and printed a warning message.

(imported from commit b3e488ff845b636e17c8b5b51d6cd84c1451bd2b)
2013-02-07 11:34:49 -05:00
Waseem Daher e57d8883af invite: Only clear email addresses after successful invite.
Prior to this commit, we also cleared out all of your checkboxes,
which is frustrating if you wanted to invite another person to the
exact same set of streams.

(imported from commit 389f27ec35dc9bf8c9058c5ffa867929ac90f674)
2013-02-06 20:18:00 -05:00
Waseem Daher e98b4b9f1e invite: Draw lock by invite-only streams (and don't select by default).
(imported from commit 1ad8a033801f70d3c6491691eebef79bbce82b77)
2013-02-06 20:15:12 -05:00
Zev Benjamin 1618ee09fc Make integral easter-egg not move the word "Humbug"
(imported from commit 7fa8088343bf5cd049c17f511495d0220faa497d)
2013-02-06 18:07:51 -05:00
Waseem Daher 209a1bee3b integrations: Trac documentation.
(imported from commit 14978913711e3386ce3c845e434fc8e16ed0adf0)
2013-02-06 17:37:44 -05:00
Waseem Daher d8b9151a31 Initial documentation page for integrations.
(imported from commit cd73c63306ab7ed8c886c30488d5ab928fac6c06)
2013-02-06 16:53:13 -05:00
Waseem Daher c7447e19d9 Add a footer to all our portico content.
This makes /api look less abruptly cut off at the end.

(imported from commit 296e431dad2aa1f72b02bb59f5572c0bf33a7bc9)
2013-02-06 14:11:00 -05:00
Keegan McAllister 59bfe38448 Fix wait condition in subscriptions frontend test
Waiting for text "Waseemio" to appear isn't reliable, because the "create
stream" modal already contains that text.  Instead, do a more specific check
for a .subscription_name element.

(imported from commit 54689aeb9d243c3fb62d1765b2b4fb93d3bb40db)
2013-02-06 13:49:37 -05:00
Zev Benjamin 526995316f Use the new tsvector cache column for full text search
Note that the tsvector cache column should be fully populated before
commit is deployed.  Otherwise, full text search will be broken until
it's populated.

(imported from commit 23c36fb7d146c289148e8243c3d6a9a6494cfc62)
2013-02-06 12:09:49 -05:00
Zev Benjamin 88937655fd [manual] Add a ts_vector cache column on zephyr_message along with the appropriate trigger and index
This needs to be done in three South migrations to not block users
from sending messages for a long time.  Adding the column requires a
write lock on the zephyr_message table and populating the new column
takes a long time.  Thus, we can't do them both in the same
transaction (which South forces on migrations).  Additionally,
creating the index takes a lot of computation and needs to lock the
table when not done CONCURRENTLY, which can't be done inside of a
transaction.

To do this manual change, you need to run:
    python manage.py migrate zephyr 0007
    ssh postgres.humbughq.com 'echo "CREATE INDEX CONCURRENTLY zephyr_message_search_tsvector ON zephyr_message USING gin(search_tsvector);" | psql'
    python manage.py migrate zephyr 0008

on staging. No action is required on prod since the database is
shared.

Note that this migration must be done completely before we switch to
using the tsvector cache column.

(imported from commit b6a27013a60c1fd196eabb095d2d11d20bba5aac)
2013-02-06 12:09:49 -05:00
Leo Franchi c637b9cf44 Handle chars at end of link better
(imported from commit 53842bc17bbb9cfb555738ee6b72291d7ce61d67)
2013-02-06 11:51:52 -05:00
Waseem Daher bff57ad983 Only draw the subscriptions-page lock icon at render time.
Because a stream can never stop being invite-only, we don't
actually need any Javascript to manipulate this besides what's
in the Handlebars template.

(imported from commit 30dc3b0baf623d88d03a643f18cd411dbe3eacfb)
2013-02-05 17:24:29 -05:00
Waseem Daher 4da5c83f64 Optionally draw a lock icon by the stream name in the main view.
If it's an invite-only stream.

(imported from commit 02bb80fee6df2cd32ded0c6f2c2b918b8aa8ac05)
2013-02-05 17:24:29 -05:00
Waseem Daher f20bd27cf9 Expose our invite-only bit to subs.js's stream object.
(imported from commit bd4d6f62331262cef5c9763d7e0e9acfd4890396)
2013-02-05 17:24:29 -05:00
Waseem Daher 99edd920c5 tests: Make sure that our subscriptions list properly returns the invite-only bit.
(imported from commit c060c6b350d335d5e94c07314fcfe7c766f2efcd)
2013-02-05 17:24:29 -05:00
Waseem Daher af45236968 tests: Cause existing tests to pass after change to gather_subscriptions.
(imported from commit 3524a5d69d9228810ae863fdea9a9f007a1ca7db)
2013-02-05 17:24:29 -05:00
Waseem Daher 66850b5dcd Make gather_subscriptions pass along whether or not a stream is invite-only.
(imported from commit f71c171185a0552dba4917967d3feffb9c92c4fe)
2013-02-05 17:24:29 -05:00
Luke Faraone ff59e28f53 Catch all exceptions when sending a message from AdminHumbugHandler
If the database is down and the Handler crashes, we get an email with an
obnoxiously long subject line and without proper sanitization performed.

By wrapping internal_send_message in a try-except, we eliminate the most
common (read: to date, only) cause of crashes in our Handlers.

(imported from commit fd59e931ad0a4fff574d3cafa47348eacacb858f)
2013-02-05 16:12:48 -05:00
Luke Faraone e7762422e4 Filter out all cookies and the csrfmiddlewaretoken.
We also remove META here since it rarely contains anything useful, and
often contains sensitive environment vars.

(imported from commit 2909613f9f52684bef9175600961801104644c75)
2013-02-05 16:12:48 -05:00
Keegan McAllister c57368d71e Fix missing close brace in zephyr.css
This was introduced in d19991c7.  Fixes code highlighting when minified.

(imported from commit ea4360f8dcc51da464619b4d570884edb0de8e26)
2013-02-05 15:43:56 -05:00
Luke Faraone 914aa336c7 Don't send "in" operators to the server, as this is a client-side filter.
(imported from commit 1f3d3c09e24093e038d83985003af0b1c87d4ed8)
2013-02-05 15:34:37 -05:00
Luke Faraone 77d0a07e4f Don't add messages to zhome if the message's Stream has in_home_view=false.
We also introduce support narrowing to "home" and "all".

(imported from commit 53b8dea9c6045a0cde368b3163f6fd6ecde1c649)
2013-02-05 15:34:37 -05:00
Luke Faraone 3de93f2b2b Pass stream information in initial template.
This allows us to remove fetch_colors() entirely, and should speed up page
load a bit.

We also JSONEncoderForHTML instead of dumps so that the result is safe
to embed.

(imported from commit 013630911960e2ac1d0bae6f5df31ad342750594)
2013-02-05 15:34:37 -05:00
Luke Faraone ac0dbd0864 Return in_home_view in gather_subscriptions.
This enables us to do client-side filtering on messages by the value of
this setting.

(imported from commit e69a7772dc90c67cb91ea8f630f5b78c902e8fa8)
2013-02-05 15:34:37 -05:00
Luke Faraone e8afaa8b8e Return a dictionary in subscriptions/list instead of a tuple.
This will give us flexibility in the future to add new properties to the
list.

In order to support that, we now do a list comprehension rather than just
returning the gather_subscriptions list in get_stream_colors.

(imported from commit a3c0f749a3320f647440f800105942434da08111)
2013-02-05 15:34:37 -05:00
Luke Faraone 1c3c3cc33f Add call to toggle whether a view is in the home view.
(imported from commit 5ece7b74a5ac4929a46d3d66ae5d838e1f418b44)
2013-02-05 15:34:37 -05:00
Luke Faraone 2a01b355a4 Correctly return a JSON error if property value is not passed.
Previously we checked if property was false after doing .strip(). Since
you can't call string methods on a NoneType, we were 500ing.

The code now does a normal dictionary get via [] and catches the
KeyError.

(imported from commit da7f28febf0865f44e92bcac1791f817c3d370f3)
2013-02-05 15:34:37 -05:00
Luke Faraone b78d154370 Factor out subscription retrieval code into another function.
(imported from commit 6a66a4feb03990e11c98cd8666d1a7bb97299987)
2013-02-05 15:34:36 -05:00
Luke Faraone 3d25fbce49 Replace calls to json_error to raise JsonableError.
Returning json_error inside an inner function call will result in the error
getting lost.

(imported from commit fd7754b15f7b62fd6e4197fd72ae03d6996a93da)
2013-02-05 15:34:36 -05:00
Luke Faraone 2d4ef59f68 Fix InviteOnlyStreamTest to call public API
Previously we made calls to the JSON api, which means that the API key
was being ignored.

(imported from commit 46d8d0e5ac7926e824f300fd846ec42bc939e2c0)
2013-02-05 15:34:36 -05:00
Luke Faraone f0afa56cd3 [manual] South migration for Subscriptions model change.
Autogenerated schema migration:
 + Added field in_home_view on zephyr.Subscription

To do this manual change, you need to run:
    python manage.py migrate zephyr 0005

on staging. No action is required on prod since there is a shared database.

(imported from commit d554f17b25631482ec2d5605a42ac0b9d6df421e)
2013-02-05 15:34:35 -05:00
Luke Faraone cb5c9ed047 [schema] Add new boolean field in_home_view to Subscriptions
This is part of the Oppa Gmail Style proposed by Waseem.

(imported from commit 0663889bcb1f691842f69d243fd4ac0e4e3e0868)
2013-02-05 15:34:03 -05:00
Tim Abbott a3a0880266 middleware: Improve logging of users causing 40x errors.
Previously we only got the user ID for /json requests, not /api
requests, and also only got the user ID, not the email address.

(imported from commit c3625f9c1a48430e35183be6c90a7855f3714948)
2013-02-05 14:36:48 -05:00
Keegan McAllister 9349a2039c Fix comment syntax error in CSS
Introduced in d19991c7.  //-style comments aren't supported in CSS.

This was causing update-prod-static to fail with a stack overflow.

(imported from commit 4cb11a7025e8fef32c852d691fccf18a5ad3b955)
2013-02-05 14:05:10 -05:00
Leo Franchi 054420fc38 Match .co.uk before .co in linkification
(imported from commit 2461cb4d49eef15431dde30dda646b25dc860a7b)
2013-02-05 13:04:45 -05:00
Keegan McAllister a8ade10fde Restore streams-example.png for /new-user
This was removed in 63788aa3.  It was the only non-symlink in
zephyr/static-access-control/.

(imported from commit c9ee043b07c5fd4050aeaafa40394a6b69915bfb)
2013-02-05 12:07:41 -05:00
Jessica McKellar 5221885035 tests: add tests for get_subscribers.
(imported from commit 25ff513dcba72ad04487e6bfd9227457f8e3cc16)
2013-02-05 10:12:04 -05:00
Jessica McKellar fdb0d15080 Don't let non-subscribers of invite-only streams query the membership.
(imported from commit 01bd8ea089dec96e487e5e82fb38df65703679ae)
2013-02-05 10:12:04 -05:00
Jessica McKellar a1506779ca tests: Add missing logins in InviteOnlyStreamTest.
This test case was supposed to be making requests as 2 different
users, but was not logging in as each of them and thus used the wrong
credentials.

(imported from commit 0dfdc86fcb385d3d2a721181b2f8075bc39ad723)
2013-02-05 10:12:04 -05:00
Jessica McKellar a9f5513181 subs: compare names using localCompare.
(imported from commit e4dcfe5147601221e720ea6622266402ed09f18a)
2013-02-05 10:12:00 -05:00
Jessica McKellar a8a5d0b511 Strip whitespace before looking up a stream name with get_stream.
This came up when I tried to subscribe myself to an existing stream
name but with leading whitespace added; the get_subscribers request
failed with a 400.

(imported from commit 03fe370d1e80fd7e8c282f260e63b7e5ada05960)
2013-02-05 10:01:45 -05:00
Jessica McKellar ab21823c19 Fix bug allowing people to subscribe themselves to others' invite-only streams.
(imported from commit db7634d81677217032c180d8bab297cc766228f1)
2013-02-05 10:01:45 -05:00
Jessica McKellar 4d170530cc subscriptions: stylize invite_only streams with a lock icon.
(imported from commit afa99dbc61ba66a6e9662780ef8daaa3d4f9e543)
2013-02-05 10:01:45 -05:00
Jessica McKellar dc66d6290b views: be more strict about the value of invite_only in add_subscriptions_backend.
(imported from commit 565375b06bb38382100923554e52a16549a18e00)
2013-02-05 10:01:45 -05:00
Jessica McKellar 85080f7ca5 decorator: deduplicate json_to_* logic.
(imported from commit d2470ebe38c391a8bb2e389a508f8b50d2e11fec)
2013-02-05 10:01:45 -05:00
Jessica McKellar 6d880c2147 subscriptions: make invite-only checkbox have an effect.
(imported from commit 7ee5c5c88efa4ab21395c03012c2921fd3c5192e)
2013-02-05 10:01:45 -05:00
Jessica McKellar 1e8b378cd9 tests: update backend tests to reflect subscription page changes.
(imported from commit 29ebd68ce85dda55a658426e35886481833d1c9d)
2013-02-05 10:01:45 -05:00
Jessica McKellar 474a91e25b tests: update frontend tests to reflect subscription page changes.
(imported from commit 1f34863b8cf1a2d951153fd4a66132418ea07a23)
2013-02-05 10:01:45 -05:00
Jessica McKellar 2e3b793ff2 subs: pop up a modal to specify subscribers on new stream creation.
(imported from commit 0c7614f3adf4022248dced4edaddb9fac11c0792)
2013-02-05 10:01:45 -05:00
Jessica McKellar 7e6a9136f5 views: make add_subscriptions_backend able to subscribe many people to streams.
Before, it let you subscribe only yourself or one other person to
possibly many streams.

This is used by the subscriptions page to specify the subscribers when
you create a stream.

(imported from commit c1055e98b0bb27799ac9e6dad80b9c9fd87deca2)
2013-02-05 10:01:45 -05:00
Jessica McKellar ce0c43329b compose: split check_stream_for_send into into request and UI response functions.
In preparation for re-using the /json/subscriptions/exists request on
the subscriptions page.

(imported from commit 76eca95b952c4b60e583a050be711023ee5fedac)
2013-02-05 10:01:45 -05:00
Jessica McKellar 018f45d151 subscriptions: add HTML and templates for new stream creation modal.
(imported from commit d19991c7fcdd29feafa877ca8203034028b1e0b2)
2013-02-05 10:01:44 -05:00
Keegan McAllister e4fa9e7ddd Adjust color of code blocks and blockquote line in selected message
Make sure they still stand out against the grey background.

It's less clear that we should do this for private messages as well, but it
seems fine for now.

Fixes #658.

(imported from commit 4c750208b5f2697e91c1c4fa7365d2744260c6f2)
2013-02-04 15:31:34 -05:00
Waseem Daher 8f434fb63e Have 'c' and 'C' behave identically to their buttons.
Prior to this commit, if you have the composebox open, pressing 'c' or
'C' clears its contents. This change makes it work more analogously to
pressing the 'New stream message'/'New private message' buttons.

(imported from commit 3de5bf83754d8ab86b1967ce2ba15f5846090667)
2013-02-04 11:46:17 -05:00
Jessica McKellar 4ac4e41b30 Add a realm_stats management command.
(imported from commit e23c9c521dff5e551615977ec5cd575bb5899ec6)
2013-02-02 08:24:21 -05:00
Jessica McKellar 393fe08eb5 Add a user_stats management command.
(imported from commit 1b13fd70dc271509cf0b5524878300d17c20f50e)
2013-02-02 08:24:06 -05:00
Jacob Hurwitz 1d113a4b03 Add the ability to show a custom notification in the bar
(imported from commit b7b763dc364e143409d862838322d63a05daacc1)
2013-02-02 01:16:26 -05:00
Jacob Hurwitz 61acc58947 Add a notifications bar when there are additional messages out of view
(imported from commit 38fa78f63fd520d0b1f09921ba064cba010a6f99)
2013-02-02 01:16:25 -05:00
Leo Franchi 6d30793a02 Add tests for XSS and emails
(imported from commit 9441f65218fa5b102658d0dd48b88fdf826eeef2)
2013-02-01 18:42:27 -05:00
Leo Franchi 3569e8e9b2 Sanitize links to prevent XSS, and handle emails
(imported from commit 622396efde50d9f5e3501f5d780c344ad0692662)
2013-02-01 18:42:27 -05:00
Leo Franchi ea2e816c4c Add tests for auto linkify
(imported from commit 395fc679ffa835f48044fce1e9c1f818581c23c3)
2013-02-01 16:14:29 -05:00
Leo Franchi cc58044234 Rework linkify regex to match more urls
(imported from commit 0e1a1df88363374ffbc802f83f43eb0fac8c99ea)
2013-02-01 16:14:29 -05:00
Tim Abbott fe100d0047 Log a message with details on any 40x responses.
(imported from commit d1c3cf28ec55cb507f4a0c17168b352323b11d5c)
2013-02-01 14:50:28 -05:00
Waseem Daher 3e28cbc545 Make 'narrow to messages containing x' the default.
As it currently stands, after the introduction of operators, narrowing
to messages that contained X would also trigger a find-in-page.

This stops that from happening, and then also makes the default action
of the search-bar-invoked-without-a-typeahead be 'narrow to messages
containing x' rather than 'find in page'.

(imported from commit 1beffce426c6b00449e7c1c803687a129747ed63)
2013-02-01 13:47:20 -05:00
Tim Abbott 72bc299af2 Add tool to analyze fraction of Zephyrs sent using Humbug.
(imported from commit b491961b21e845471b1c52eae2b7069cc5328103)
2013-02-01 13:37:40 -05:00
Waseem Daher 768725cb7c Provide visual feedback that we're working on your invitation request.
This is a tricky one because it's kind of hard to see locally, but
there's a bit of a delay between when you click "Invite" and when we
get back to you. So we give the button a "loading" state so you know
not to click again.

(imported from commit 9c3389a3d06def777427c846d6106f6d9b30cc8b)
2013-02-01 11:26:46 -05:00
Waseem Daher ca68ca58a9 Clear out any old status messages when showing the invite form.
(imported from commit 5961823a3429b419b8d699b6a04e0ccd1607249c)
2013-02-01 11:26:46 -05:00
Jacob Hurwitz c3c79f5423 This magically makes the gear not move when the search box is focused
(imported from commit b562c358f3ba80877e8f03199638c236823d184c)
2013-01-31 19:07:13 -05:00
Zev Benjamin d5fdfd7be2 Make searching for multiple words be treated as the boolean AND of those words
(imported from commit d9e47dd25553cc31eeda615e3a5709436e883ab3)
2013-01-31 18:10:54 -05:00
Waseem Daher 6d5424c910 Put "find in page" as the last option.
Leo points out that if you type a stream name, we probably want
to offer to narrow you to that stream more than we should offer
to find that stream name in the page.

(imported from commit 803ac681ec2f759f4dabb68a40722a07b86a0cab)
2013-01-31 17:50:53 -05:00
Waseem Daher 6cefbde820 Make "Find" option read "Find x in page".
(imported from commit 5d95b996f4d944c285ca6f5bc0f75ea359cb4df2)
2013-01-31 17:50:52 -05:00
Keegan McAllister 98a7d31374 Add tests for the bold / italic syntax
(imported from commit aaaf87e88d2db8e201d9f98b4e7411cfc56d50c2)
2013-01-31 16:28:57 -05:00
Keegan McAllister d348e0e9d6 bugdown: Disable italics and __foo__-style bold
(imported from commit c35d6980db6c59828514a90eec199a7494625495)
2013-01-31 16:28:57 -05:00
Zev Benjamin 97851a93c4 Use full text search when using Postgres
On my laptop, this cuts search time from several seconds down to
a few hundred milliseconds.

If we want even more speed, we could store the ts_vector as a column
on the message database.  The Postgres documentation says this will
make "searches [...] faster, since it will not be necessary to redo
the to_tsvector calls to verify index matches."  Going this route
requires creating a trigger to automatically insert the appropriate
column when new rows are inserted.

Note that the full text index must be fully created before this
commit is deployed.  Full text search without an index is actually
significantly slower than using the LIKE operator.

(imported from commit ae74083da20d33aa2425d3e44fcdc19b160002ba)
2013-01-31 15:57:45 -05:00
Zev Benjamin c6d196a22f [manual] Add South migration for creating a Postgres full text index of messages
This schema migration is only for use in automated migrations.  To
deploy on the production database (the migration only needs to be
done once for both of staging and prod because they share a
database), you should instead execute the following SQL manually:

$ ssh postgres.humbughq.com
$ psql
humbug=> CREATE INDEX CONCURRENTLY zephyr_message_full_text_idx ON zephyr_message USING gin(to_tsvector('english', subject || ' ' || content));

Note the addition of the "CONCURRENTLY" keyword.  The problem is that
creating the index takes non-trivial time and requires a write lock
on the table while the index is being created.  This would mean that
users would be unable to send messages while we were generating the
index, which isn't acceptable.  We can't create the index
concurrently in the South migration because concurrent index
creations can't happen inside of a transaction and South forces a
transaction on migration functions.

Also note that this index must be created before Postgres full text
search is deployed to the app because full text search without an index
is actually much slower than plain search using the LIKE operator.

(imported from commit 8b9445c27d0e427278de997b22342bffe6d855b7)
2013-01-31 15:57:45 -05:00
Zev Benjamin 1f4e27cf52 Pass the query object to NarrowBuilder
This is for allowing us to do things more complex than returning a Q
expression, needed for doing Postgres full text search.

(imported from commit 669ec71417c04baaf8ed1774bee147079b05b03d)
2013-01-31 15:57:45 -05:00
Keegan McAllister b9da0276e8 Add missing Glyphicons images
These are referenced from CSS, which was making Django staticfiles unhappy.

(imported from commit d2852eaad05777505ec165419140b474d59029df)
2013-01-31 15:34:12 -05:00
Keegan McAllister 5e9b0ba79d [manual] Get rid of the static-access-control mechanism
We will minify our code, rather than trying to restrict who can see the
un-minified code.  Removing access control first simplifies things.

Manual deployment steps:

    scp servers/puppet/files/nginx/humbug-include/app root@staging.humbughq.com:/etc/nginx/humbug-include/
    ssh root@staging.humbughq.com service nginx reload

and then the same for app.humbughq.com once deployed to prod.

(imported from commit 63788aa3fa7ba5fd97fcf85b05760abb5e7cae4b)
2013-01-31 15:34:12 -05:00
Leo Franchi 071ea3b9a4 Send humbug & email on markdown parse failure
(imported from commit c132ab91f1ff9ffdbe5f740980bf362b16c6bba6)
2013-01-31 14:48:40 -05:00
Jacob Hurwitz 6e8a972dad MIT should not say create stream
(imported from commit b08de8fb5e73150032fa05bbab464a47e5a4220e)
2013-01-31 11:31:23 -05:00
Leo Franchi 187aec7b0d Fetch ala time travel when narrowing to a message not in the home view
(imported from commit e5449e00f15b1cf234e7fdeecfc94234eb89a799)
2013-01-31 11:10:29 -05:00
Waseem Daher 0eca9fa595 Put 'narrow to messages containing' before 'find in page'.
This fixes Trac #740.

(imported from commit e40ffa149eac3c7d954d6cac617935496d366ce4)
2013-01-30 22:38:56 -05:00
Leo Franchi 6a755c2126 Convert to []-style list comprehensions to quiet pyflakes
(imported from commit d81ec98552846d8af71394c7c530aadc53f77127)
2013-01-30 15:24:49 -05:00
Zev Benjamin 809ba94147 Hide subscriber list warnings when its associated subscription settings get shown
We were already hiding errors, but warnings would persist.

(imported from commit 1fcf69d2214bbfa4aaec0ef7e69632d60306176c)
2013-01-30 11:49:46 -05:00
Zev Benjamin 0c8580d991 Make adding yourself to a stream's member list the same as hitting the subscribe button
Fixes #733

(imported from commit 90d4dd0fec66dec552a7588702c16bac7d120495)
2013-01-30 11:49:46 -05:00
Keegan McAllister c5a69e5814 timeout: Try to kill the thread once the timeout expires
(imported from commit 25e19a3baa306fb440b27f492506ff231681bb4e)
2013-01-30 11:13:48 -05:00
Keegan McAllister e12f10ec1f bugdown: Spend at most 5 seconds rendering a message
(imported from commit bc092acc8b2b9f8a63af669de06c6f7512ccf8c9)
2013-01-30 11:13:48 -05:00
Leo Franchi c7214a7a2c Add test for almost-but-not-quite fence
(imported from commit 26378ffbf33b3d82fe3b1dc5b5afcbc8ffc4ebbb)
2013-01-29 18:02:47 -05:00
Leo Franchi 6130d271cf Make fence regex stricter to only match fence-like things
(imported from commit 59d5302b7af09c669423d364d46fb0d1b6a7b080)
2013-01-29 18:02:46 -05:00
Leo Franchi c6f73f7697 Refactor fence block code to never infinite loop
(imported from commit f72cb182e4fc9c4e8003853276d8aa40b454d08f)
2013-01-29 18:02:45 -05:00
Zev Benjamin 56e29ba11c Add animation effects when hiding/unhiding the subscription swatch and regular settings
Fixes #727

(imported from commit 0d794e3e06c1b5238444712f032961b841e9eedb)
2013-01-29 15:58:51 -05:00
Zev Benjamin 30a1409a3d Make 'create stream' input box size responsive
(imported from commit 5daf788bbf3ae7f2960da5f70ab5945880151287)
2013-01-29 15:58:51 -05:00
Jacob Hurwitz 7c59d41006 Added unit tests for several more methods:
-json/subscriptions/exists
-json/subscriptions/list
-json/subscriptions/add
-json/subscriptions/remove

(imported from commit 95eb5421ac586bea59f749411b54661689946915)
2013-01-29 15:56:16 -05:00
Jacob Hurwitz 09e86903df assertEquals is deprecated in favor of assertEqual
See http://docs.python.org/2/library/unittest.html for details.

(imported from commit 049a4a7e994ff20b8b4fa3b526f197d63118f4c3)
2013-01-29 15:56:16 -05:00
Jacob Hurwitz c82fd34cad Two fixes to the search bar:
1) Make the search hotkey (/) no longer clear the search box
2) Vertically center the "Search..." placeholder

(imported from commit 02dee6b72c4457e160f57d8604164e15e62f5f28)
2013-01-29 15:29:27 -05:00
Jacob Hurwitz ebf85b9075 Change the typeahead sorter so that it now puts name and email matches
(sorted by PM frequency) first, then all other matches (sorted by PM
frequency).

(imported from commit 5119de41c9c847e6972f12b4dafc59a7d010ea82)
2013-01-29 14:40:57 -05:00
Waseem Daher 86b87556a6 Don't jump to top of page when returning from another tab.
This fixes Trac #723 - Message view scrolls to top after reloading on another tab (e.g. settings)

(imported from commit d9134cec6879625d577c43a08d258af3f6dacc5f)
2013-01-28 23:21:43 -05:00
Keegan McAllister f2659b7dcd bugdown: Remove dead code
The user of this function was removed in 97dd20ec.

(imported from commit c3823df65172f3799658e36d7ba183f661e9fe65)
2013-01-28 18:37:48 -05:00
Keegan McAllister 02fd0fbb06 Don't strip leading/trailing whitespace from the compose box
Fixes #719, "Indenting four spaces doesn't create a code block in the first
paragraph".

(imported from commit 697535b2d25d7191b565d26b601bb98722794978)
2013-01-28 18:37:48 -05:00
Leo Franchi b157560369 Remove last tests.py dependency on views.py
(imported from commit d667fbfdeb7ec0cf115354cf9a54fd3cdd801b73)
2013-01-28 17:33:08 -05:00
Leo Franchi 7e567f527f Move gather_subscriptions to actions.py as it's not a view
(imported from commit cdf94ded51e441fe3515641458023be44c1ba40c)
2013-01-28 17:32:58 -05:00
Leo Franchi e249326510 Convert tests to using json api rather than views
(imported from commit 2a997b93e88156e44d47277387641db1ef3b587a)
2013-01-28 16:59:25 -05:00
Leo Franchi 9cc2945c9e Add unit tests for hanging ulists bugdown
(imported from commit 7e225b54d4ab26e4d7cb734fcdbdbe74b7288dd5)
2013-01-25 17:13:13 -05:00
Leo Franchi c39c6f643c Handle lists that start immediately after paragraphs
(imported from commit 055593d7a324598e133d53db0c33103016426c8f)
2013-01-25 17:13:13 -05:00
Leo Franchi 969d89d070 Don't accept - as valid list delimiters
(imported from commit 287353a29289ee536a59f47f87ff66893bf261ec)
2013-01-25 17:13:13 -05:00
Leo Franchi ba7dcc320c Remove ``` support from code fence
Supporting ``` as a code fence marker complicates the auto-fence
closing, and as per a discussion with Keegan on code-review@, it
is not worth the extra complexity.

(imported from commit 405afb95c4295a02f4677181456caf9d49913ac4)
2013-01-25 17:12:49 -05:00
Leo Franchi 187e8cfa88 Add markdown tests for auto code block ending
(imported from commit 905ce149fd5d601733c2a7e748636c7a66904fbc)
2013-01-25 17:02:57 -05:00
Leo Franchi c2db0dd8bf Automatically add an end-of-code fence block if missing
(imported from commit 167f0217bbe6709e73dbc06f2894d9e22ee17a77)
2013-01-25 17:02:57 -05:00
Leo Franchi 639ec9380a Handle case where @-replies are not at beginning of msg
(imported from commit 2ed80845f49f48de71a5ea1db382dc4d9369f393)
2013-01-25 16:04:17 -05:00
Leo Franchi 64a08a5496 Parse multi-pm recipients to autocomplete nth names
(imported from commit 479d4e02356710636657226cf0dcd51b57503212)
2013-01-25 15:33:22 -05:00
Leo Franchi 4e78d18972 Lookahead on @-searches by removing the @
(imported from commit fd8b4dd19db4f291387397a3a795cf9ade5b195a)
2013-01-25 15:33:22 -05:00
Luke Faraone 5e3f043111 Filter out api-key, not api_key
We don't use the latter anywhere in our API, and this typo caused user
API keys to be emailed / humbugged places.

(imported from commit d0402e8e9fd587f6a9018c962d222fb5f9ceca48)
2013-01-25 14:20:07 -05:00
Zev Benjamin 1ba381c4a9 Account for the new top navigation bar when setting the main div height
This fixes #704

(imported from commit 5e73bf38cf0cda661a4c7070eea760934b30e454)
2013-01-25 14:09:30 -05:00
Zev Benjamin 1099b01a19 Make spinners have a lower z-index than the top nav bar
(imported from commit 9e32122efdfc5b5f75e527e3df0ac4363b45191d)
2013-01-25 14:09:30 -05:00
Zev Benjamin c1bd8d821f Hack around loading indicator width calculations sometimes being slightly wrong
Under some unknown circumstances (it happens on Keegan's laptop) the
loading indicator text width calculation returns a result that's a
few pixels too small.  We hack around this by setting 'white-space'
property on the container div to 'nowrap'.  The container's div will
be slightly too small (and thus the text will stick out the right
side by a few pixels), but that's probably OK.

This fixes #698

(imported from commit 2e5b28fb3a1fca78c700af74a452bfafd09a2da9)
2013-01-25 14:09:30 -05:00
Zev Benjamin 8bade19451 Document the connection between loading indicator CSS and associated JS constants
(imported from commit 21947f311e0df0aa7353eb57857c14ba0a5eceb2)
2013-01-25 14:09:30 -05:00
Zev Benjamin dba8b27a35 Shrink loading indicator text a little smaller
This is to make the loading_indicator_text height closer to
loading_indicidator_spinner's height.

(imported from commit 062973e9c09b005601c5c943ce65dc97eeee179f)
2013-01-25 14:09:30 -05:00
Zev Benjamin 2be4a612ff Force spinners to be centered in their enclosing elements
This should fix the weird positioning spinners had when they were
created while hidden.

(imported from commit 777d5c376a3f93b0b7b3b749877070b438b7c102)
2013-01-25 14:09:30 -05:00
Zev Benjamin a58fecfdeb Make the 'create stream' row more visually distinct
(imported from commit 6d0b6e26fa4bbd37e6f29795be4f61aa7c20ec0c)
2013-01-25 12:35:25 -05:00
Zev Benjamin 842edf31e8 Make the stream list have subscribed streams at the top
(imported from commit daa2037f97041e39cc6a54628c98d39a3c66c5bc)
2013-01-25 12:35:25 -05:00
Leo Franchi 56f4c96a98 Sort recipients by name prefix, email prefix, then pm order
This changes the sorting for autocomplete to:

* Properly prioritize case sensitive and insensitive prefix
* For recipients, prefix-search on email, then sort by most recently sent pm

(imported from commit 893c7a07d678644a418a69656180fadf0d6f374d)
2013-01-25 11:18:50 -05:00
Zev Benjamin 7fe78592fc Hide the color swatch and regular stream settings when not subscribed
(imported from commit 15fb70e1e18bcb9acc5f556a33b9a574cfbb874d)
2013-01-24 17:59:03 -05:00
Zev Benjamin 69a1903f86 Add the user to the member list of a stream when they're viewing the member list
(imported from commit a07c9c507f45c77ff82040f4b226c1a1a0177bd3)
2013-01-24 17:59:03 -05:00
Zev Benjamin 616bd3a1e1 subs.js: Factor out code for formatting and adding users to member lists
(imported from commit 5f929df5c0a105a3774e9e43255d17093ea1496f)
2013-01-24 17:59:03 -05:00
Zev Benjamin 4dbd51033a Hide subscription settings on unsubscribe
(imported from commit 28f08ffdf5ffc4af697563df19b4facb28e9c681)
2013-01-24 17:59:03 -05:00
Zev Benjamin e03fe9e3f1 Expand subscription settings of newly created streams
(imported from commit 6171014fd712b60d83b2a0ac2953d8065c00a585)
2013-01-24 17:59:03 -05:00
Zev Benjamin 2e7d411ef8 Remove redundant success messages from subscriptions page
The fact that the user sees a change (the button changes or a row
appears) makes it obvious that the operation was a success.  The
success messages were only serving to make the page scroll
confusingly when you couldn't see the top.

(imported from commit 471b9304f71bb8533c98d208b855d4d75c04a886)
2013-01-24 17:59:03 -05:00
Zev Benjamin df712b7794 Move the "create new stream" form into the subscriptions table
(imported from commit 6cfccf01b4253423e271a08c74f6077cbc10fce3)
2013-01-24 17:59:03 -05:00
Zev Benjamin 131167e228 Remove btn-block class from subscribe/unsubscribe buttons
It's not doing anything for us because we also float the buttons.

(imported from commit c63c153821ef392fbfca732d4a6e79a18ea21ff0)
2013-01-24 17:59:03 -05:00
Zev Benjamin 6082222a68 Don't try to show all streams on the subscriptions page for the MIT realm
The query fails anyway, so this is not a safety check.  This commit
makes it so that MIT users actually see their subscriptions instead
of an error.

(imported from commit ee635943728d7d9823e118d9fa51c402b1cd9bf2)
2013-01-24 17:59:03 -05:00
Zev Benjamin 3250e83e66 subs.js: rename render_subscribers() -> should_render_subscribers()
(imported from commit a7273c330ad94001cc008bcd06a60a0e11fb937c)
2013-01-24 17:59:03 -05:00
Zev Benjamin 0d9c2fd7f4 Show all public streams on the subscriptions page
(imported from commit 1f00e864a7ae653aad02328dff1b8683c5d585d9)
2013-01-24 17:59:03 -05:00
Zev Benjamin 72ebecf801 Do initial stream color fetch in subs.js instead of zephyr.js
(imported from commit e819e04951be037241b43c8c7061c7979038b7b8)
2013-01-24 17:59:03 -05:00
Zev Benjamin 6e05a72898 subs.js: Simplify subscriptions management
We now keep around the subscription information for streams that the
user unsubscribed from in stream_info and have a field that
indicates whether the user is currently subscribed.

(imported from commit 973e2f4bd4139157b03d7c1a372db93a1a5130f7)
2013-01-24 17:59:02 -05:00
Zev Benjamin 7f2252cfa8 subs.js: Factor out code to set stream color
(imported from commit 40c907976aef0d860d4963285be96430f719d0a7)
2013-01-24 17:59:02 -05:00
Zev Benjamin 8e7ac23d2b Make subs.js the keeper of the streams list
(imported from commit 566f529757bb83ad8dd4e52d3fc8c1b90c497ca2)
2013-01-24 17:59:02 -05:00
Leo Franchi 556295dd28 Add unit tests for new invite-only streams
(imported from commit 89f19b85a97d4f9a35988d7c7eb29984719523e5)
2013-01-24 17:34:22 -05:00