Commit Graph

3001 Commits

Author SHA1 Message Date
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
Tim Abbott 4cd3fd234c puppet: Add supervisord configuration for feedback-bot.
(imported from commit c7deece3e48d59de856393a4a6b7929757bc1c7c)
2013-02-05 14:27:56 -05:00
Tim Abbott f5b44cf349 nagios: Add monitoring for zmirror subscriptions syncing.
(imported from commit 2e4ae2c35d589f14b57758cd68a58f8b49b7ecf3)
2013-02-05 14:27:56 -05:00
Jacob Hurwitz 7fad925ae7 Change our default format to be more descriptive
This adds two characters to the length of our default format field, but
based on a conversation I had with kcr, I think this should probably be
okay. If it's a problem, the symptom we'll see is that certain people
will be unable to send zephyrs with this default format (so, certain
Humbug users will have their forwarding consistently fail).

We need to remember to, in a future commit (once everyone has started
using the updated version), remove the:
> or notice.format.endswith("@(@color(blue))")

(imported from commit 703ef60f524646bca8d5099c9066efabd365be43)
2013-02-05 14:27:56 -05:00
Jacob Hurwitz e5492e939e zephyr_mirror: Fix logging messages to multiple files under /tmp.
Also fixes the fact that certain output was not logged at all.

(imported from commit 0e63a9ef4105921ad7cbe3f7565ce7832c5db25e)
2013-02-05 14:27:55 -05:00
Jacob Hurwitz e475c863ba zmirror: Allow duplicate zmirror processes to die gracefully.
Fixes #602.

I replaced the SIGKILL with a SIGINT, and then catch SIGINT with a
handler.  This handler calls cancelSubs if necessary, and can later be
edited to perform other clean-up operations, too. I thought about, in
this same commit, changing the SIGTERM in
maybe_restart_mirroring_script to a SIGINT, but after tracing out the
code paths, I realized that isn't necessary. (The SIGTERM is
necessarily performed on a process that has not subscribed to any
zephyr classes, so cancelSubs is unnecessary. If we do think that we
may want to add additional clean-up operations in the future, though,
then it might be worth investigating changing this SIGTERM.)

(imported from commit 692b295be6cb40b0e4ec2ca0bc58c58056ed9bd9)
2013-02-05 14:27:55 -05:00
Tim Abbott de26e834dc zephyr_mirror: Read list of public streams from sync-public-streams ouput.
(imported from commit c91828534bfed4047c16a98b926335f4beded005)
2013-02-05 14:27:55 -05:00
Tim Abbott b6b0e8f222 Add script to sync public streams.
(imported from commit 73fc73d585dada4a250b5861437b5a5a0e3765b9)
2013-02-05 14:27:55 -05:00
Jessica McKellar cea18d6561 Don't build non-send_message bindings.
(imported from commit 4e94989e3da7d87490e483d6d2ecc39a0824ced0)
2013-02-05 14:09:29 -05:00
Jessica McKellar d30c8b857e Only include send_message-related examples in API release.
(imported from commit 058a121b4b3c6b2829396c3c7a1007656a9e09da)
2013-02-05 14:09:29 -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 637d4a74f2 [manual] *-command-line: Drop sh -e
This meant that (in some circumstances, anyway) the script would bail after the
inner process was killed by restart-server.

Manual deployment steps:

    After pushing, log into {staging,app} and restart these commands within
    the screen session.

(imported from commit 696bc8148fa9df4b536253d54c65b7c4cb908530)
2013-02-04 19:12:35 -05:00
Keegan McAllister b55c9fdd08 chmod +x tools/process-user-activity-command-line
(imported from commit 11888d81e6e9e74cb503effbe5efd07bd1c290ec)
2013-02-04 19:12:35 -05:00
Waseem Daher d9a06ba8fd Initial API documentation page.
(imported from commit 06a5e902edf03ab781b30dd80f5fbfbaa790bc0a)
2013-02-04 17:58:12 -05:00
Waseem Daher 17b1829775 Expose pygments.css to the portico code.
(imported from commit 2f8cffa17ce1efd26d9c0ed9ce02e6f352ea8617)
2013-02-04 17:58:12 -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