Commit Graph

13806 Commits

Author SHA1 Message Date
Tim Abbott 3a3954a8c4 Extract validation for whether the user can access subscribers.
(imported from commit 4bff4c26f98a9c2ebdd11d931c977aae8e4ebffe)
2013-09-30 17:14:05 -04:00
Tim Abbott 4de0ad29b3 Remove confusing realm optional argument to get_subscribers.
The realm should always be the realm of the stream, and we should
always pass in a stream rather than sometimes passing in a stream name
and other times passing in a stream.

(imported from commit a098d6ed3db218a37c1b6b7c956e847c316c2d13)
2013-09-30 17:14:05 -04:00
Tim Abbott 543ba03ff6 gather_subscriptions: Fix confusing overwriting of local variable stream.
(imported from commit cfe369869de5f13579ff0e0b91ec0a735e2fe81c)
2013-09-30 17:14:05 -04:00
Tim Abbott 0e23b2240d queue: Log how long it takes to connect to rabbitmq.
(imported from commit be3cd9da5e7c213cfed62feda2e676038ade57a6)
2013-09-30 13:48:48 -04:00
Steve Howell 8f1498c766 [important] Fix stacktrace in unread.js.
There is a scenario where we call process_read_message()
for a message that we haven't recorded as unread before.
I'm not sure how it happens, but I put back code to
guard against crashing.  The regression happened in
5752458c821.

(imported from commit 5ce15d2e236b738b445ed88f1733aa0612be0ff3)
2013-09-29 22:42:33 -04:00
Steve Howell 49232d9173 Preserve muting preferences across reloads.
We have been persisting muting preferences on the back end for
a while, but we haven't been adding them to page_params for the
client to have at reload/startup time.

(imported from commit d9ca68aa0e4d22bfb0e6ce67fc0bc63981175c8b)
2013-09-28 15:48:37 -04:00
Steve Howell 2a4cd3c69a Exclude muted topics from stream/home unread counts.
Update get_counts() so that it ignores counts for muted topics
when calculating stream/home unread counts.

(imported from commit 9b4e4da4346c225c535e97d709d3dee032603cc5)
2013-09-28 14:53:11 -04:00
Steve Howell c7b7f8d79a Inlined unread_hashkey() function.
The indirection was more confusing than helpful, especially
since the function had side effects, despite its getter-like
name.

(imported from commit 85d9cf642b4177f62488136f0e0f7f6c9304942e)
2013-09-28 14:53:11 -04:00
Jessica McKellar bbdf18b106 Remove the redmine URL and webhook.
The plugin will use the standard send_message path.

(imported from commit 36aba7298c07d77785b3cc19499519c1423ca8f1)
2013-09-27 16:35:14 -04:00
Leo Franchi 31d8513657 Use a one-week bound instead of sender bound to optimize query
(imported from commit 5c13f3f3a5f2a54b6645cb7f2304a6b54b759cea)
2013-09-27 16:27:35 -04:00
Jessica McKellar ed0fd51160 [schema] Add a date_created field to zerver_stream.
(imported from commit 1360da91b81fad59d49068fdf05205eef982e64a)
2013-09-27 16:23:56 -04:00
Leo Franchi d9dba41767 Add some tests for composebox_typeahead.compose_content_begins_typeahead
(imported from commit 01e71ebe87da6e866817dc56555a7e6ee61cb003)
2013-09-27 13:52:13 -04:00
Jessica McKellar f0911f51a0 email mirror: ignore decoding errors.
Empirically, we only get these for malformed emails where the charset
specified in a message part header does not match the true encoding of
the part. I checked what the resulting Zulip looked like for the
original offender, and it looked find with ignoring errors.

(imported from commit ac6ba65b611cb22d4ec547b75a585abce6fc50b0)
2013-09-27 11:34:57 -04:00
Leo Franchi b2a352da00 Limit Messages to those sent in this realm when prepopulating
(imported from commit af6312705bb43159e4448c16a9e05c00ca696ed5)
2013-09-27 11:12:09 -04:00
Leo Franchi 4102b8e844 Add query count tests for bulk_add_subscriptions
(imported from commit 84a68e3e50178df383e66bb29008da6086709eda)
2013-09-27 10:26:11 -04:00
Leo Franchi 0fe3da55e3 Reduce number of queries done by bulk_add_subscriptions
We now bulk-fetch subscription information once from the database
and use it throughout bulk_add_subscriptions in order to avoid
hitting the db O(streams) times.

On my machine this shaved the accounts_register API call from making
66 queries to making 37 queries.

(imported from commit 5dd5ad3f50b2a6edf85b5f1d55ebd697a1c60647)
2013-09-27 10:26:11 -04:00
Leo Franchi 88242de052 Use bulk_add_subscriptions in account_register
We have a handy bulk_add_subscriptions function to make cases
like this fast, so lets use it.

On my machine this reduces the number of db queries during account_register
from 112 to 66.

(imported from commit 21a6b31d0f229998d095735b8c581a50ca6aab66)
2013-09-27 10:25:23 -04:00
Leo Franchi 1e6b83b6c8 Fetch stream.realm information when fetching default streams
(imported from commit 08eb32e6ecda75b17d6532b0421c371de2327027)
2013-09-27 10:25:23 -04:00
Steve Howell 902185f8fb Add User Profile Count to General tab on /activity.
(imported from commit 231b3d6f2fe48f511d6387e25c2fea5e3accc186)
2013-09-26 22:04:36 -04:00
Steve Howell b84fb319ee Remove all-user counts in realm detail views in /activity.
(imported from commit 2231ef9a5f67e5b951c678d7f0d3f14dc252435d)
2013-09-26 15:41:20 -04:00
Steve Howell e0ceeb3340 Fix blank Desktop tab in /activity.
(imported from commit d1b7daa6db505feeb18baa6a546fd0e3fccf154b)
2013-09-26 15:41:20 -04:00
Steve Howell 85b7c93bd2 Show count of active sites.
(imported from commit 023c7880cd7784bbbb49589acde9f59aed8f1765)
2013-09-26 14:46:35 -04:00
Steve Howell 430aee6f87 Add a "General" tab to the /activity summary report.
It shows domains and how many active users they have.  A
user is consider active if they have done something at least
as active as updating their pointer in the last day.  Domains
with no meaningful activity in the last two weeks are excluded
from the report.

(imported from commit 700cecfc7f1732e9ac3ea590177da18f75b01303)
2013-09-26 13:20:02 -04:00
Steve Howell 6b5d569888 Extract local var "data" in get_activity().
This is partly just cosmetic, but it also sets me up to
build "data" more dynamically.

(imported from commit d436f700b137c1db3e9f50d308944231ce89bb83)
2013-09-26 13:20:02 -04:00
Steve Howell e93dce9ce6 Extract activity_table.html template for /activity.
A small functional change here was to eliminate an enormous "Usage"
headline that was already implicit from the tabs.  It would have
complicated the refactoring to try to preserve it, and I don't think
anyone will miss it.

Extracting this template will give us a little more flexibility
to customize future tabs in the /activity page.

(imported from commit bdb0b7030c8ec1e20d4451dc059830c3f5ea7632)
2013-09-26 13:20:02 -04:00
Steve Howell 0950aa45c4 Eliminate the default_tab attribute in ActivityTable.
(Just have the template automatically select the first tab.)

(imported from commit 4a1877c8d3d6215f8e8ad6a184c79bf4eb001001)
2013-09-26 13:20:01 -04:00
Steve Howell 9110ebd208 Improve the UI for /activity.
We are still showing the same data points, but the logic to drill
down on details for a particular realm is now all server side,
not client side, and we are smarter about omitting fields.  In
summary mode, we don't show empty Name or Email columns.  In
detailed mode, we show the realm as a headline instead of a column.

In this version you do lose the ability to see all system users in
the same view, but Waseem is ok with this.

(imported from commit edd2e646ab4cf5783ea64232d0cd621debece8d4)
2013-09-26 13:20:00 -04:00
Steve Howell fd4601c44d Add a Desktop tab to /activity.
(imported from commit 7a907e0b904be57613d5ec34c335a962ea41db48)
2013-09-26 13:19:59 -04:00
Steve Howell b8f3b38524 Make /activity client tab order be deterministic.
Use an array of tuples, not a dictionary, for the client tabs.

(imported from commit d0ef09bd7885fbb261227786b90ea2949cea7ab4)
2013-09-26 13:19:59 -04:00
Steve Howell a99d2bebab Assert that registration involves <= 53 queries.
This isn't a very strong test, to be sure, but it's something.

(imported from commit 578dbc6601f38186fec9bfb061a8bbc322201ae7)
2013-09-26 09:55:43 -04:00
Steve Howell 6890c89936 Harden the queries_captured() test decorator.
Before, it was trying to use connection.queries, but Django
could pull the rug out from under us.  Now we monkeypatch
the CursorDebugWrapper methods instead.

(imported from commit 25d5bab47673f2b66a6325f48d33e66c31055ab3)
2013-09-26 09:55:42 -04:00
Tim Abbott 4be5d81af1 [manual] Write logs to /var/log/zulip rather than /var/log/humbug.
This requires a puppet apply to update the supervisor configuration.

(imported from commit f2836b6d9c53791af6f6ceb1650d0e0740df70ab)
2013-09-25 16:52:41 -04:00
Tim Abbott e4496521e9 Update logging path for email-mirror.
(imported from commit 75f36dbb963b2b77ecda7ba138023f0f774047e0)
2013-09-25 16:52:41 -04:00
Tim Abbott 8a5fffa7cf Move twitter API credentials to local_settings.py.
(imported from commit 6b95db113b91816fbc5e91db4b1be90d3df8e028)
2013-09-25 15:40:21 -04:00
Steve Howell 93347be4af Send less presence info to Tornado in do_send_messages().
When we send a message, we send some presence information to Tornado
to help it figure out how to generate emails for idle recipients of
a message.  This change limits the presence info to being the
intersection of present users and recipients of the message.  It is
just an internal optimization to avoid queueing up unneeded data.

The history behind this feature is that I implemented it a while
back, but I think I made a rebase mistake that sent all the presence
data over the wire, despite having code to filter on recipients.
It was mostly harmless, just leading to some inefficiency which is
now fixed.

(imported from commit 7c8e97705afb299c67b99053909e952fbc823551)
2013-09-25 14:50:40 -04:00
Jessica McKellar 0d897c469d Add a utility to report some rough recent client activity metrics.
(imported from commit 27b4a70871939b2728fcbe0ce5824326ff4decc2)
2013-09-25 14:32:53 -04:00
Steve Howell 4d5842cdcd Add summary view to the /activity report.
When you load the activity report, it will just show summary
counts for realms, but if you click on a realm, you will see
details about users in the realms.  You can also click "Show all"
to see an interleaved view of realms and users.

(imported from commit b106557b1fae64d525071afc124b5a8aed319086)
2013-09-25 11:33:11 -04:00
Steve Howell b1ef9a686c Sort rows on the activity report by realm/count.
(imported from commit ed1db1b7685dc113acb8a6a8317b7b84d10c440b)
2013-09-25 11:33:11 -04:00
Steve Howell 95ceba2828 Add realm-wide rows to the activity report.
Add rows to the activity report that roll up counts for all
users on each realm, to go along with individual users.

(imported from commit 8104f3ef7fbe406fe0fd2ba1bb00ce76a1ccbee5)
2013-09-25 11:33:09 -04:00
Steve Howell d087b4e4c9 Extract local vars in ActivityTable.
This is mostly cosmetic, but it does DRY up the code a bit.

(imported from commit cb4babe5a06ca936aca90cdf49b7f72ad5fc6ef3)
2013-09-25 11:33:09 -04:00
Steve Howell d08ae832b9 Make /activity queries slimmer.
Just pull back the 5 fields we use in the query used by
ActivityTable.

(imported from commit f147c82997eca3b06ae53ebf52b110e427ebab06)
2013-09-25 11:33:08 -04:00
Zev Benjamin 871afde142 Prepare process_queue to be used with supervisor's numprocs
(imported from commit 5a652b93f1e8b32b5ed89d622035161abaedfb11)
2013-09-24 20:44:15 -04:00
Zev Benjamin 90ee96d456 Split out presence and activity interval events from user_activity queue
(imported from commit 3c22448491867a9e72659629d5d0faaf12b85b2c)
2013-09-24 20:44:15 -04:00
Zev Benjamin e450fc80c9 Move existing queue processing workers to new framework
(imported from commit b448eeefcddb1840344bd337046be30714a7fdbc)
2013-09-24 20:44:15 -04:00
Zev Benjamin 6cf5ebc63d Add new system for defining and running queue-processing workers
(imported from commit 7e77da57b8ad0b70837785c85f546601ba5b1957)
2013-09-24 20:44:15 -04:00
Zev Benjamin f6500d691e github: Make pull request comments go to the user-specified stream
(imported from commit dfce76bcba43dd4a0beba6b6af7642363193dcde)
2013-09-24 16:32:13 -04:00
Steve Howell 49a55ca6fa Call blueslip.warn from stream_data.js functions.
It used to be calling blueslip.warning(), i.e. the wrong name,
and would crash.

(imported from commit ddc953488cdb22dd37ddf674dddf1e05f34eaec9)
2013-09-24 16:19:53 -04:00
Jessica McKellar f058e9cac5 Add backend support for newer realms receiving stream notifications by default.
(imported from commit ea8ee65071423a94a462571aa30013969d9f3f7a)
2013-09-24 16:19:53 -04:00
Jessica McKellar d434bf4bb4 email mirror: use a message part's specific charset rather than the message charset.
The overall message charset may be null or not match the part's
charset. Even though it's unclear from the documentation,
experimentally using the charset for a message part seems to give you
the charset even for non-multipart emails.

(imported from commit 0e1d23073f4c53041f9760e66a6635f8a94893d1)
2013-09-24 16:19:53 -04:00
Jessica McKellar 7bb75e3acb Populate date_created for existing realms.
(imported from commit 6a10150905a23589f098778ccbd8075025ff900f)
2013-09-24 16:19:52 -04:00
Jessica McKellar f22023d4cb [schema] Add a date_created field to Realm.
(imported from commit 1953f7c1f8af7f81d50d7362c704f6a81637d72e)
2013-09-24 16:19:52 -04:00
Jessica McKellar 4e74131008 Add a first pass at Redmine integration.
The integration supports events generated by creating and editing
issues.

(imported from commit 1988013d7a18df173623c0821e807fd4f42af3bc)
2013-09-24 16:19:52 -04:00
Steve Howell 50641c3337 [perf] Reduce the number of DB queries in send_message.
For a 4-person stream, we were hitting the DB 8 times, and 4 of
those queries were to lazily get user.email for the 4 recipients
due to upstream code using only().  I added user_profile__email
to the only() call.

I believe this regression started 9/18, and after pushing this
to prod, we would should look at this graph:

https://stats1.zulip.net/graphs/8274cd84588

(imported from commit 70629cb69fe5955c674ba76482609dfe78e5faaf)
2013-09-24 16:19:52 -04:00
Steve Howell 63de50d6f0 Add StreamMessagesTest.test_not_too_many_queries
(imported from commit bc49d7a0f932aecb1be7cecd0f6c5a9c95b2767d)
2013-09-24 16:19:52 -04:00
Steve Howell 9ee2f186ca Add queries_captured() context manager for tests.
(imported from commit 14a9529aef057e79bc12c979d88b595828a8b3a3)
2013-09-24 16:19:52 -04:00
Leo Franchi edbde0b78b Handle unknown pivotal events, and log
(imported from commit f177d7d0d8f4c09b2b94bb23973cd90ca8930f3b)
2013-09-24 16:19:52 -04:00
Zev Benjamin 233290d578 Add a management command to purge a rabbitmq queue
This is useful in debugging when you just want to discard all the
messages in a queue because they have the wrong structure.

(imported from commit 8559ac74f11841430b4d0c801d5506ebcb74c3eb)
2013-09-23 11:25:58 -04:00
Zev Benjamin 7d0fd364b2 Remove duplicate call to update_user_activity
(imported from commit e9d2dce02cb6863a3ba66045a7b88bd351fd0c5d)
2013-09-23 11:25:58 -04:00
Zev Benjamin d7d17c993c Fix using SimpleQueueClient with multiple queues
(imported from commit 18bda1430d76f8b436ad42f85d0ce3cab8fd8193)
2013-09-23 11:25:58 -04:00
Steve Howell 660475bd0c Hide muted messages.
Instead of collapsing muted messages, just hide them altogether
in view where it makes sense to hide them.

(imported from commit 1c2c987ff302ceb135a025753cf421b4de1aea71)
2013-09-23 10:53:06 -04:00
Steve Howell 022ef6e9b9 Add narrow.muting_enabled()
(imported from commit 8972d1e3ca347397664094a7f150ec86fd2f8f8e)
2013-09-23 10:53:06 -04:00
Waseem Daher 7afd3ecc81 Custom invite text for MIT invitations.
(imported from commit 21b72861e991159eb7faa74809edb8d01027c6c8)
2013-09-20 12:06:26 -04:00
Steve Howell 6eda9c3314 Rename function to send_pm_if_empty_stream().
This used to have a really long name.

(imported from commit d3027a75f49db428239d432cfaa8821aa733eb04)
2013-09-20 10:19:07 -04:00
Steve Howell a457135a25 Use efficient stream.num_subscribers() for bot PMs.
Use stream.num_subscribers() in check_if_a_bot_is_sending_a_message_to_an_empty_stream().

The num_subscribers() function using Django's count() method, which returns
a single row, vs. len() on an iterator of query rows.

(imported from commit 6157fe248945e9288ee71d8cc39fb6dda4e9a247)
2013-09-20 10:19:07 -04:00
Steve Howell 4b75dd0d85 Add Stream.num_subscribers
(imported from commit 9b79ab84516c3634ef6795ef2d90db37553cc0d1)
2013-09-20 10:19:07 -04:00
Steve Howell 5ae5e3f881 Disable empty-stream PMs for MIT bots.
(imported from commit a855d612b6ba316fc183200c4f72102831b6179c)
2013-09-20 10:19:07 -04:00
Steve Howell 098720b6d1 Extract check_if_a_bot_is_sending_a_message_to_an_empty_stream().
(imported from commit 3312d70f6b94f4a13a42bbe0320f4bb1062262e7)
2013-09-20 10:19:07 -04:00
Steve Howell a8f6c2fe55 Add CheckMessageTest.test_bot_pm_feature() test.
This tests that a bot's owner gets sent a message if the bot
sends a message to a stream with no subscribers. (Presumably
the message will be a PM; we could make the test more precise
in the future.)

(imported from commit 0aaf931a90cb9c7bc3fde8ac545c6b6ad0a55668)
2013-09-20 10:19:06 -04:00
Steve Howell 7b748fed7a Add CheckMessageTest class
(imported from commit 07c4ba895570853c923703b1332c4fc403cc858e)
2013-09-20 10:19:06 -04:00
Jessica McKellar ee2cd51c4c generate_invite_links: work for open realms too.
(imported from commit ec2143d25cb2f6f4181ece7a25c79666334a1634)
2013-09-20 10:00:10 -04:00
Zev Benjamin 9b84b2dd67 github: Reduce code duplication
This includes:
* Merging the pull request and issue subject creation functions
* Factoring out pull request and issue content creation

(imported from commit 9cf90e999482a1998431e6483788522101607167)
2013-09-19 23:44:21 -04:00
Zev Benjamin e5e7e2f7bf github: Rearrange code to put the pull request and issue handlers next to each other
This makes their parallelism clearer.

(imported from commit 328d6df9443ed68ff5f462b405a930ecb6d90155)
2013-09-19 23:44:21 -04:00
Zev Benjamin 0394459f04 github: Put pull request comments on the 'commits' stream
(imported from commit d50c1f577737a07da1f08a1fbfc4242ca9d6d4a1)
2013-09-19 23:44:21 -04:00
Zev Benjamin 1c82a9ecfa github: Format pull request messages more like issue messages
(imported from commit cba3a84c3abb6f33495e5afbe8e03d1a7a7d046c)
2013-09-19 23:44:21 -04:00
Zev Benjamin f99cf15358 github: Add tests for pull requests
(imported from commit dd099cd0e630c09f490ecd5aac761ce131b0a8e2)
2013-09-19 23:44:21 -04:00
Zev Benjamin df5c4bb202 github: Enable pull requests for zulip.com so we can test them
(imported from commit ab13951a77d6563a9ec41d6ed7f991579623c565)
2013-09-19 23:44:20 -04:00
Zev Benjamin c5d4a640be tests: Refactor Github tests to reduce code duplication
(imported from commit 7c34bd2eefe706898479f96a03685f6e027bf43f)
2013-09-19 23:44:20 -04:00
Zev Benjamin f47258c740 github: Factor out pull request and issue subject creation
(imported from commit 539238f78b0ee49672a1338fc96d00bb21ce539d)
2013-09-19 23:44:20 -04:00
Waseem Daher 190390d8ea Allow MIT to invite coworkers.
(imported from commit 273b3abdd3dcc49c01c1a04001450983d4acb000)
2013-09-19 17:14:41 -04:00
Steve Howell e79e74ade4 Add narrowed_to_topic() helper function.
(imported from commit 9190caa9b183893fb7ae883686b9bdbd661d5895)
2013-09-19 15:41:00 -04:00
Steve Howell a4e2ed9fd2 Add test_narrowed() to narrow.js unit tests.
(imported from commit 060032ac00d0c28a9625e2885ee3156bc94ff130)
2013-09-19 15:40:59 -04:00
Steve Howell 51b8caf442 Add set_filter() to narrow unit tests.
(imported from commit 60734fa1a9d0d28e8c0277a41cc69186bc2b6c0e)
2013-09-19 15:40:59 -04:00
Kevin Mehall 6695105bb9 Fix 2499d7b to not break user registration.
Some bots created by us do not have owners. Don't try to send a
message to the nonexistent owner.

(imported from commit ab952eccd7d6c4728e9477a106142214b5c81ca9)
2013-09-19 13:42:20 -04:00
Jessica McKellar 7e733a1b91 Don't rate-limit missed message e-mails.
Instead just rely on the 2-minute delay in the management command to
batch conversations.

We've had people report being confused or thinking the feature was
broken when they didn't get e-mails because of our rate-limiting, so
let's see if this is not too overwhelming.

(imported from commit 706ddb07b906b5c2edea1159c04acc2ee6f06e29)
2013-09-19 11:55:42 -04:00
Steve Howell de0d50d31a [important] Fix recent regression w/maybe_get_subscribers
(imported from commit 8069f729dcb2bfec1c1df8f50a88fe49545a9a87)
2013-09-19 09:37:39 -04:00
Steve Howell c6a9297f1a Add blueslip warnings to stream_data functions.
Warn inside these functions when you get data on streams that you
are not subscribed to:

  add_subscriber
  remove_subscriber
  user_is_subscribed

The back end should be smart enough not to spam us with subscriber
info that we don't care about.

(imported from commit b27644be2abc37c11ddff884ef392ea208bd1bd3)
2013-09-19 08:52:54 -04:00
Steve Howell 3c69a6dd26 Bulk-send peer_add events in bulk_add_subscriptions().
Send a single peer_add event per stream that has multiple users.

(imported from commit 1027b212557f848d437128a03698ecd54575c3fd)
2013-09-19 08:52:54 -04:00
Steve Howell c8c64984d3 Eliminate redundant peer_add notifications.
Don't send peer_add notifications to users who are already
getting add notifications, because they will already know
about subscribers.

(imported from commit 726b54ae0e30b71440b17d9c51b026872ea96218)
2013-09-19 08:52:54 -04:00
Steve Howell c58d366178 Optimize notifications from do_add_subscription().
Instead of sending one notification per user, bulk them up with
the users parameter.

(imported from commit c296f23599a214a63ef6f09406a9deaea469a7f3)
2013-09-19 08:52:54 -04:00
Steve Howell 8182d60961 Optimize query used by do_add_subscription().
It only grabs the user_profile_id column now.  This leads to a
speedup of about 16x between grabbing large ORM objects vs.
small 1-column dictionaries.

(imported from commit 95150bff3fdcbe250b04f014062224af42a6644f)
2013-09-19 08:52:54 -04:00
Steve Howell e89c6f64bd Extract notify_peers().
Splitting out notify_peers() will give us flexibility for cleaning
up how we notify peers for bulk adds.

(imported from commit e108fa2c432cc1fe54d788c58c82c983e0f2394e)
2013-09-19 08:52:54 -04:00
Steve Howell d24d8e4b36 Optimize showing subscribers on the settings page.
If you expand subscribers on your settings page, you will now see
a query like this in your postgres logs:

SELECT "zerver_userprofile"."email"
FROM "zerver_subscription" INNER JOIN "zerver_recipient" ON ("zerver_subscription"."recipient_id" = "zerver_recipient"."id") INNER JOIN "zerver_userprofile" ON ("zerver_subscription"."user_profile_id" = "zerver_userprofile"."id") WHERE ("zerver_recipient"."type" = 2  AND "zerver_subscription"."active" = true  AND "zerver_recipient"."type_id" = 40  AND "zerver_userprofile"."is_active" = true )

The join's still complicated, but the list of fields is one instead of 40+.

(imported from commit 48de1f888193a4d23fcea52d0b633d134e4a3ff7)
2013-09-19 08:52:53 -04:00
Steve Howell 9cdedf7e6c Optimize adding subscriptions with maybe_get_subscriber_emails().
To get emails, query one field instead of 40-ish fields.

(imported from commit d2dbbe23871df76bc7d431dcd9b19ebd7a58c161)
2013-09-19 08:52:53 -04:00
Steve Howell 986dd8289e Optimize get_subscribers back end.
get_subscribers_backend() now calls the new get_subscriber_emails()
function, which just queries the email field:

  "zerver_userprofile"."email"

...instead of querying about 40 fields that it never uses.

I was able to verify the query slimming by watching my postgres server log.

Also, you can verify that the ORM does roughly 16x less work using values():

>>> def f(): return [sub.user_profile.email for sub in list(Subscription.objects.all().select_related())]
...
>>> def g(): return [row['user_profile__email'] for row in list(Subscription.objects.all().values('user_profile__email'))]
...
>>> def timeit(func): t = time.time(); func(); return time.time() - t
...
>>> timeit(f)
0.045198917388916016
>>> timeit(g)
0.002752065658569336

(imported from commit a69f690a96d076b323fdfc2f4821b0548bdfac7f)
2013-09-19 08:52:53 -04:00
Steve Howell db2c9ff8c2 Extract get_subscribers_query
(imported from commit fea253591093a1f0cf722c1d4bcfb0df4f881984)
2013-09-19 08:52:53 -04:00
Steve Howell b2a7860d56 Add test_multi_user_subscription() to backend tests.
(imported from commit aa6849f7c01f083144acd3ecb72cf7e31794dad7)
2013-09-19 08:52:53 -04:00
Steve Howell b02770440a Add tornado_redirected_to_list() to tests.py
(imported from commit e515d3e4b9f04b5db56d4c9433bc9ba15fd3b4da)
2013-09-19 08:52:52 -04:00
Kevin Mehall 8c7f1ecffa bugdown: Don't generate garbage on invalid links.
LinkPattern returned a string which contained a placeholder if the URL was
considered invalid. AtomicLinkPattern wrapped this in an AtomicString,
where the placeholder doesn't get removed properly.

m.group(0) is always incorrect because python-markdown modifies your regex
to include more than you specified (this is why part of the message got
duplicated).

(imported from commit 576bdf09c2b677cf4bc56484c363eb05f2110158)
2013-09-18 16:22:13 -04:00
Kevin Mehall 63cff6eb71 Make populate_db set the is_bot flag on bot accounts.
(imported from commit 93a507faa2b19fde05376fd73ed3a65149cfce68)
2013-09-18 16:16:17 -04:00
Leo Franchi d88266b41d Warn bot owners when a bot sends a message to a nonexistent stream
(imported from commit 2499d7bd9d176a7ab43f751eb855813d0a479bd4)
2013-09-18 15:54:13 -04:00
Jessica McKellar c2e704e4b6 Instead of erroring out, do our best to format HTML-only e-mails.
(imported from commit a58e65864ebb3ef539cf15902b59636cd3912b69)
2013-09-18 15:41:27 -04:00
Jessica McKellar 8ab3ae9da2 email mirror: handle non-ASCII message bodies.
(imported from commit 1a8e21b7ff5441c21147bab85f5a460a7567c5e3)
2013-09-18 15:41:27 -04:00
Leo Franchi 5441e36167 Bulk update messages in deprecated cache when updating message
(imported from commit 5e68e4eec83c0ed02b9997b0cb3f93ce8f0a7fdd)
2013-09-18 13:27:58 -04:00
Leo Franchi c588c7938c Allow message topic changing to propagate backwards
(imported from commit 470178ef5f7aaf09d4528c88ae6e33f17538fcaf)
2013-09-18 13:27:58 -04:00
Leo Franchi 0a1a63c87f Blacklist some webreq urls that we don't want to store for metrics
(imported from commit 60def99010e5c55e77acc65aa516459c6e4ffaae)
2013-09-18 11:56:25 -04:00
Jessica McKellar 28f80211ec email mirror: handle non-multipart e-mails when checking for attachments.
(imported from commit 2132d604bb353ef6e8ca2c371479b2b2146d8603)
2013-09-17 16:20:28 -04:00
Steve Howell 30b6f54a36 Don't cache UserPresence info.
(imported from commit ff590bdf5d84bb9b3cedc561c2f2fbf7f7592a66)
2013-09-17 14:51:56 -04:00
Zev Benjamin 3d11d0e420 github: Remove the issue title from message bodies
(imported from commit d7298696011c548c26cc4ec4d13c7f1d83efd785)
2013-09-17 13:55:39 -04:00
Zev Benjamin 4996eb1e61 tests: Add Github issues tests
(imported from commit 1aa7a2c78f148f5e6ea9c7551f25374cbfe32f15)
2013-09-17 13:55:39 -04:00
Zev Benjamin 067997287e tests: Use real data for testing Github pushes
(imported from commit 83b800a8711cf045ffc7da3305227f495819a5da)
2013-09-17 12:59:18 -04:00
Zev Benjamin fc7106aa1b github: Only try to capture Github events when deployed
(imported from commit 99e89f52d6b1653b6bf8b65b8ab44cd06e3fc28f)
2013-09-17 12:59:18 -04:00
Zev Benjamin b1075438d1 github: Add support for issue comments
(imported from commit 1a5317303292de2a7adcb2dc6a3b5bd3d27d1c73)
2013-09-17 12:55:57 -04:00
Zev Benjamin 75196cfe9e github: Improve issues formatting
* Remove the action from the topic and add the issue title
* Only show the issue body on open or reopen

(imported from commit f08eb40f36122d2498fe0c36a69df9e606296ff3)
2013-09-17 12:55:57 -04:00
Zev Benjamin e5cf24b2fd Fully quote payload body contents in integrations
(imported from commit 3cb03eabbd917f878b37aa226eb3f3ecda63d5e7)
2013-09-17 12:55:57 -04:00
Steve Howell e1b881629c Use fold_case:true for subscribers Dict
(imported from commit 8acc794cb5369baadef512a9fcdb3537231dd604)
2013-09-17 10:32:13 -04:00
Steve Howell 4b90f1685d Add stream_data.set_subscribers() method.
This allows us to encapsulate our use of Dict for the internal
data structure.

(imported from commit e8acc50b4c17d339015cb9db9939b9452a62cc8b)
2013-09-17 10:32:11 -04:00
Jessica McKellar 3db51fa17f Upload and display attachments sent through the email mirror.
(imported from commit b3ac24b71a2e7c354d69ecae9174316102ab8f84)
2013-09-17 10:00:01 -04:00
Jessica McKellar 97e6709d49 uploads: have upload_image_to_s3 take file data instead of a file object.
We have to read the data anyway, and we don't have a convenient file
handle for uploads from attachments sent through the e-mail gateway.

(imported from commit 86260a4eaceef85c82707929a80558e11dc54ef6)
2013-09-17 10:00:01 -04:00
Jessica McKellar 8a40fb346c Be able to upload images to S3 from outside the web client.
We'll need this to upload attachments sent through the email gateway.

(imported from commit b2f5eb736b65f1478189c3aebd4cb37f1ad540fb)
2013-09-17 10:00:01 -04:00
Jessica McKellar 2c0ba365ae email mirror: show more debugging information on errors.
(imported from commit 57f5b8b57062501443367953239526f1ec78eb7f)
2013-09-17 10:00:00 -04:00
Steve Howell 1e912c7e22 Exclude bots in the user presence query.
(imported from commit 02668ba5db85e12ac0aefc0fa2480d38ffed4921)
2013-09-16 16:27:16 -04:00
Jessica McKellar cfeaa2be9b Add backend support for realm admins to rename streams.
(imported from commit eaf419f1f68dfd350b8c99e8a5089ec316f0c409)
2013-09-16 16:16:13 -04:00
Steve Howell e83c026a27 Set focus-related flags correctly after a server reload
(imported from commit 408469c0da0cfa5513e6838329816cd88665981f)
2013-09-16 12:29:34 -04:00
Steve Howell 98af7e8664 Avoid unnecessary calls to receiver_is_idle()
(imported from commit 88443f396309def2fa49360337ef5b7748ff6f79)
2013-09-16 11:29:13 -04:00
Steve Howell 1836d8958e Add comment about sending presence updates
(imported from commit da9c521a6ad652e4dbcaabcc3a24b3e23376f545)
2013-09-16 11:29:13 -04:00
Steve Howell 83e517fcf9 Flush cache on all user presence updates.
(imported from commit 130eac36f9932350a29ed88f11dd3e2f6bf3f979)
2013-09-16 11:29:13 -04:00
Steve Howell 7868787ae0 Fix indentation level in cache_save_user_profile().
(imported from commit d4dff41fa7913b15a65e10fbafb5b7b49d6b6837)
2013-09-16 11:29:13 -04:00
Steve Howell 85f9b6695f Optimize user presence/activity query.
The get_status_dict_by_realm helper gets called whenever our
 realm user_presences cache expires, and it used to query these fields:

    "zerver_userpresence"."id", "zerver_userpresence"."user_profile_id", "zerver_userpresence"."client_id", "zerver_userpresence"."timestamp", "zerver_userpresence"."status", "zerver_userprofile"."id", "zerver_userprofile"."password", "zerver_userprofile"."last_login", "zerver_userprofile"."is_superuser", "zerver_userprofile"."email", "zerver_userprofile"."is_staff", "zerver_userprofile"."is_active", "zerver_userprofile"."is_bot", "zerver_userprofile"."date_joined", "zerver_userprofile"."bot_owner_id", "zerver_userprofile"."full_name", "zerver_userprofile"."short_name", "zerver_userprofile"."pointer", "zerver_userprofile"."last_pointer_updater", "zerver_userprofile"."realm_id", "zerver_userprofile"."api_key", "zerver_userprofile"."enable_desktop_notifications", "zerver_userprofile"."enable_sounds", "zerver_userprofile"."enter_sends", "zerver_userprofile"."enable_offline_email_notifications", "zerver_userprofile"."last_reminder", "zerver_userprofile"."rate_limits", "zerver_userprofile"."avatar_source", "zerver_userprofile"."tutorial_status", "zerver_userprofile"."onboarding_steps", "zerver_userprofile"."invites_granted", "zerver_userprofile"."invites_used", "zerver_userprofile"."alert_words", "zerver_userprofile"."muted_topics", "zerver_client"."id", "zerver_client"."name"

Now it queries just the fields it needs:

  "zerver_client"."name", "zerver_userpresence"."status", "zerver_userpresence"."timestamp", "zerver_userprofile"."email" FROM "zerver_userpresence"

Also, get_status_dict_by_realm is now namespaced under UserPresence as a static method.

(imported from commit be1266844b6bd28b6c615594796713c026a850a1)
2013-09-16 11:29:10 -04:00
Steve Howell 0d2c6f756f Remove code to pre-fetch presence objects.
(imported from commit 546e98bedd809e66f506581434402caad5a984de)
2013-09-16 11:28:47 -04:00
Steve Howell e881fdd2ff Change the cache timeout for get_status_dict() back to a minute.
This function gets user presence information, which changes rapidly
and requires a pretty simple query.

(imported from commit f9b9f0f22277335c76eb4371930a4fff2758a240)
2013-09-16 11:24:29 -04:00
Steve Howell 99dd2ed8df Add presences info to the event data for process_new_message().
The do_send_messages() populates the user_presences data structure
for process_new_message(), so that Tornado code never needs to hit
the database or memcached to get the user presence info.

(imported from commit 194aeaead8fa712297a2ee8aff5aa773b92f1207)
2013-09-16 11:24:12 -04:00
Leo Franchi a4744b10ed Better logging for error diagnosis
(imported from commit a2fc108ca1230b671c7e35651e3d53042386b4bd)
2013-09-13 17:56:16 -04:00
Leo Franchi 6e56342cf6 Send missedmessage notifications if user is idle for >1hr
(imported from commit 573f46a77497cb2f73eae3b4a648e466977e6247)
2013-09-13 17:33:34 -04:00
Leo Franchi 7bb96bd36b Extract data from cache in tornado_callbacks with cache_get_many
This reduces the number of memcached calls we make in our time-
slice-limited tornado event handler.

(imported from commit 8903ce4ac754ba82d57e04d1b0356be7533edee2)
2013-09-13 17:33:34 -04:00
Steve Howell 5eaeddea12 Get stream_data.js back to 100% coverage
(imported from commit 5b82a10d50b6599c0c42604fe86275b21f9a6396)
2013-09-12 17:23:52 -04:00
Steve Howell 0165dc54ad Create blueslip error for undefined keys in Dict.
We create a blueslip error for undefined keys in Dict.  This led
to a straightforward change in the unit tests for Dict.  For the
unread test, to avoid the blueslip error, we had to be more specific
in setting up a user in one place, but this reduced our coverage,
leading to another small test being added.

(imported from commit 33e14795500d9283de2a7c03c4c58aec11cea4b8)
2013-09-11 18:07:37 -04:00
Steve Howell 9eefc8ae62 Test fold_case option of Dict
(imported from commit 630643767a21818c1ef4adb557c794e560783c3e)
2013-09-11 18:07:37 -04:00
Steve Howell e9adaaa0c0 Avoid Dict crashes for undefined keys when fold_case is true.
The exceptions were cryptic before, and they were inconsistent with
the fold_case: false behavior.

(imported from commit a40704d1a22bcdc60d91be832ee3c81eb416c6dd)
2013-09-11 18:07:37 -04:00
Steve Howell a8ebd80c89 Test that vanilla Dict handles undefined keys
(imported from commit 09846eafa55f2321ca10db950ad3785ce78ae2c6)
2013-09-11 18:07:37 -04:00
Steve Howell b7ef86bc34 Added /json/set_muted_topics
(imported from commit e9072cd273fabf0e072b6a5e9ed80b07142f1013)
2013-09-11 16:47:37 -04:00
Steve Howell 21456091e4 [schema] Add muted_topics to UserProfile
(imported from commit 5d804259be94ba83dc4f7541e50443dd1a42cc6b)
2013-09-11 16:47:37 -04:00
Steve Howell c6131b630b Handle undefined keys in muting.is_topic_muted
(imported from commit 96a9f0253e1c0e72a2b05577118dac438d190994)
2013-09-11 16:47:36 -04:00
Steve Howell f616148181 Make muting case insensitive for streams and topics
(imported from commit 6e731a5305a6d19896c61300aedf0fb4a387e148)
2013-09-11 16:47:36 -04:00
Steve Howell 0641e693fa Add muting.set_muted_topics
(imported from commit c84cd085e513d57e3913543d40cd8fd6b5d45b67)
2013-09-11 16:47:36 -04:00
Steve Howell 04c6a8198a Add muting.get_muted_topics
(imported from commit 5edb1d36ae66dfc42cf534edc452959df8306661)
2013-09-11 16:47:36 -04:00
Steve Howell 8626276dc3 Add muting.unmute_topic
(imported from commit c3aa08b7d50c70cba86b43c12d618ba1d96832b4)
2013-09-11 16:47:35 -04:00
Leo Franchi a408192f92 Don't re-parse alert words more than necessary
(imported from commit 4fee6ad9592c1dc5f844889fcb6586192de6cb35)
2013-09-11 12:00:37 -04:00
Jessica McKellar 171306a37d Don't include not in home view messages towards bankrupcty unread count.
(imported from commit 64c038f1d41c091c88875f2c90e9b4dd695308a3)
2013-09-11 01:29:45 -04:00
Kevin Mehall 7fea9e0755 Fix race condition in 06-unread
There was nothing to ensure that the changes resulting from scrolling
happened before the unread counts were checked. We already had a long
wait there; might as well do those checks after it to ensure that the
DOM is updated.

(imported from commit 0d4014ae6a74dd684521fecabefc4bf79015f842)
2013-09-10 18:06:57 -04:00
Kevin Mehall 5991b0003f Fix 06-unread PM count selector for changes in 2b82fbb
(imported from commit 0d8e52f17fb06092efff7cdf4fc4b01ab4901e2f)
2013-09-10 18:06:57 -04:00
Leo Franchi 2eb8c6aae3 Add documentation and a duration argument to analyze_user_activity.py
(imported from commit 5668ec02a23dcfeb29760b55d8acee17cfdea9cf)
2013-09-10 13:25:59 -04:00
Leo Franchi 9ebb536c2d Use json_to_bool in REQ instead of manually using ujson.loads
(imported from commit 5a607f7aba4a8e4e5920a35df06c375cff98ff55)
2013-09-10 13:25:59 -04:00
Leo Franchi a1d7e6336c Add stub for .on() in activity test
(imported from commit 82727e18739cb8bed7b2c64f8013e7f0fe386b94)
2013-09-10 13:25:59 -04:00
Tim Abbott 9fcca3df4e [schema] Collect data on when users are active on site.
These engagement data will be useful both for making pretty graphs of
how addicted our users are as well as for allowing us to check whether
a new deployment is actually using the product or not.

This measures "number of minutes during which each user had checked
the app within the previous 15 minutes".  It should correctly not
count server-initiated reloads.

It's possible that we should use something less aggressive than
mousemove; I'm a little torn on that because you really can check the
app for new messages without doing anything active.

This is somewhat tested but there are a few outstanding issues:

* Mobile apps don't report these data.  It should be as easy as having
  them send in update_active_status queries with new_user_input=true.

* The semantics of this should be better documented (e.g. the
  management script should print out the spec above)x.

(imported from commit ec8b2dc96b180e1951df00490707ae916887178e)
2013-09-10 13:25:59 -04:00
Steve Howell 5bcc403ea4 Add filter tests for is:alerted predicate
(imported from commit 077fdab5437f498f015da7ed81a77036c9ff6361)
2013-09-10 13:13:18 -04:00
Leo Franchi a33957db32 Handle mailchimp error 214 (duplicate email) in signup worker
(imported from commit cb34c153fc96bca7c8faed01d019aa2433fcf568)
2013-09-09 10:57:09 -04:00
Scott Feeney b8dc9cc198 Send you the subscribers list when you add a subscription
(imported from commit 810de1f03c6765ef1c5476df30aff4c467783cab)
2013-09-06 23:13:47 -04:00
Scott Feeney 17cad06a2d Add Dict.from_array()
(imported from commit 0650edb2217afa2c37be1bbc4f9e2ac40f4c0e2c)
2013-09-06 23:13:47 -04:00
Scott Feeney f9cfa6b5f7 Include subscriber list in page_params.stream_list
(imported from commit 7f03eec37c7cbdcdefb590c39a76444bd1b55230)
2013-09-06 23:13:47 -04:00
Scott Feeney c46007e08e When a user subscribes to a stream, notify other stream subscribers
This is a backend-only change. No frontend code that uses this is
included.

(imported from commit 4bc379de3bbfc0975ff939fa5895d716a4d1ff1b)
2013-09-06 23:13:47 -04:00
Scott Feeney 65ed20469e Split out get_subscribers method on backend
(imported from commit b5941ff90bbf5b31a9fa31aa83e5d1856d483dcc)
2013-09-06 23:13:47 -04:00
Scott Feeney 1c2479c807 Fix overly-tight coupling in set_stream_color test
The test will fail if a new attribute is added to the structure that
gather_subscriptions() returns. It should only be concerned with the
subscription's color.

(imported from commit fd5bad97bbce2544e0078ee029f54d4e45da9c15)
2013-09-06 23:13:47 -04:00
Leo Franchi cf59f07fed Replace alert_words as event contains full list
(imported from commit 489975f8bcbd0c3bcec07dd5ed62de5cae686140)
2013-09-06 16:05:08 -04:00
Leo Franchi a67d461139 Hoist joining of message content in alert_words processor
(imported from commit 5025b7108839ddc04d6d9e575a9a288223526fe8)
2013-09-06 16:05:08 -04:00
Leo Franchi 7d76c47321 Re-enable alert word bugdown processor for staging
(imported from commit a9fb8284a47d18b97b84d3ce37482132b21d3885)
2013-09-06 14:51:40 -04:00
Leo Franchi 8ad6a0daa9 Cache realm alert_words to avoid database hits when rendering
We found that since bugdown processes are threaded, the cost of
doing a db query in a markdown processor is quite high---each
thread must start up a new db connection including a SSL handshake
etc. We should strive to keep our rendering pipeline free of mandatory
DB queries.

(imported from commit 555066bd03da6c681b74ce6137acc264eb41c55d)
2013-09-06 14:50:25 -04:00
Leo Franchi 7b375634f9 Temporarily disable alert_words markdown processor on staging
(imported from commit ab3eed4ce36ebcd3d928d2d92fc34c9ebacc11f9)
2013-09-06 13:39:26 -04:00
Leo Franchi 252045fe2e Fix assignee in JIRA created message
(imported from commit 5ebadd14dee58c20746c80dfd99ba70a3d772ab6)
2013-09-06 11:24:03 -04:00
acrefoot cf3e98d74a use staging for wdaher.com for the email script
(imported from commit fbad47386f5c48785f766886218370612db31c26)
2013-09-05 19:19:41 -04:00
acrefoot 592e1ead6b Actually use the realm specified by the email mirror when doing the markdown
(imported from commit 00b909b1d0c70a3523ab53d2f91815ab14ba2a6f)
2013-09-05 18:24:55 -04:00
Zev Benjamin cb78014eef bugdown: Allow block-level block quotes
It is triggered by specifying the "language" of a code block to
"quote" or "quoted":
    Hamlet said:
    ~~~ quote
    To be or **not** to be.

    That is the question
    ~~~

(imported from commit 847a0602e335e9f2955e32d9955adf8ac8de068c)
2013-09-05 17:34:28 -04:00
Zev Benjamin dd26260884 bugdown: Clarify variable name
(imported from commit 27968536bd6a3fcda6d26d8dde7f82d9f0990dd2)
2013-09-05 17:34:28 -04:00
Zev Benjamin b3644ecfad Fix attribution of Github issues messages
(imported from commit 941e52e51dfd9fddfe4f86bb33f25877d6d0edbd)
2013-09-05 16:04:59 -04:00
Zev Benjamin 2f1551e745 Replace comment references to trac.humbughq.com with trac.zulip.net
(imported from commit 231d0884345be525d58ce51f48a76bba6960f09d)
2013-09-05 15:43:08 -04:00
Zev Benjamin 5c81148839 Switch our trac realm filter to use trac.zulip.net
(imported from commit 19163f5be01a1d9370d9ed45c55bedd670772dac)
2013-09-05 15:43:07 -04:00
Kevin Mehall e58e6f1b7d Check admin permissions on the target realm, not on their own realm.
Trac #1772

Also abstracts this into a method.

(imported from commit f435b3379fb5387f8b3fdf7ca728ab760eadbf95)
2013-09-05 15:36:59 -04:00
Tim Abbott ce710292ca Always use external-content.zulipcdn.net for mit.edu realm.
(imported from commit 21d1101185bf52f21fcc345e791217311e9c0a13)
2013-09-05 14:35:42 -04:00
Tim Abbott b557b94d0b bugdown: Rewrite image urls to avoid mixed-content warnings.
(imported from commit fc0a41befb04f2a8aad2937a856366ac3cadb192)
2013-09-05 14:35:29 -04:00
Tim Abbott cdfc6dc10a bugdown: Fetch youtube preview images over HTTPS.
(imported from commit 9dbf3c21083cbbcf1288789f400c33ec735d4416)
2013-09-05 14:35:29 -04:00
Tim Abbott 3f1c967e3d Clean up approximate_unread_count.
The new version is more accurate (doesn't rely on UserMessage IDs
being sorted, which they aren't necessarily) and simpler.

(imported from commit 671dd89dc8881ae2dcb8d0e804fd65458e074a29)
2013-09-05 14:35:29 -04:00
Leo Franchi 663fd4653f Feature-flag alert words to staging + reddit
(imported from commit 1fe9c596b26ce6676514719e4ed2e185108685cb)
2013-09-05 10:21:39 -04:00
Leo Franchi 41b286232d Allow filtering to alerted messages with is:alerted
(imported from commit 99834f1ee1b9b2e0f5c7427afa1494bf404e3626)
2013-09-05 10:18:41 -04:00
Leo Franchi 897dd87b94 Add a span around alert words to mark them visually
(imported from commit 9b8fbbd957086f1eeaa3409e5830aa6d7974fbe8)
2013-09-05 10:18:40 -04:00
Leo Franchi b2ddd670e4 [schema] Add backend support for per-user alert words
(imported from commit 7a9c596a010cbedbddf594c5d9c68bb9ed46d122)
2013-09-05 10:18:40 -04:00
Kevin Mehall 6b820038ad Server side tests for message editing, including subject propagation.
(imported from commit 0a68bdc337eda1b04976fb41a50a29f9f626ef25)
2013-09-04 14:51:46 -04:00
Kevin Mehall 19a835e7d5 Add a checkbox that propagates topic edits to subsequent messages.
Trac #1348

(imported from commit 28e2a8cb3ecda5ec50d17501f4ccbd8644212065)
2013-09-04 14:51:46 -04:00
Scott Feeney 6adfed7f3d Add backend support for basic Desk.com webhook
(imported from commit 425a26b2ba5ffd4f4437e8d8438e8ef540d7b1ee)
2013-09-04 13:19:23 -04:00
Scott Feeney a213fb5df2 Comment that authenticated_rest_api_view does Basic auth
(imported from commit 145ea6b0a17ab904c32e23e809410f56448baa72)
2013-09-04 13:19:22 -04:00
Leo Franchi 7e6af0a5d0 Mark messages from the desktop app as sent_by_human
(imported from commit 001073221387cbbaa541b17f9a377490562a28f1)
2013-09-04 11:00:11 -04:00
Luke Faraone 085fdebc98 Use the X-Gm-Original-To header instead of iterating through To/Cc/Bcc
This will allow mail with an implicit destination (mailing lists, complex
forwarding) to be received by our system.

See http://support.google.com/a/bin/answer.py?hl=en&answer=2368151 for
documentation of Google's behaviour that adds this header.

(imported from commit f8fd500e3c27e12af5941c63c91d5c796a2cd24a)
2013-09-03 17:46:44 -04:00
Tim Abbott eeb04ed78e deactivate_user: Only delete sessions that aren't expired.
(imported from commit e3d844a55581a7e7faab8ea9ed6703480fae8f51)
2013-09-03 11:40:42 -04:00
Kevin Mehall be5c90c217 Add test for realm-specific emoji
(imported from commit 2148038b300b71afe0a7517709ed0404536b69fd)
2013-09-03 11:01:01 -04:00
Scott Feeney 549c644480 Move webhooks views to a separate file
(imported from commit 73db9f5ccc03d19024f35001b0805ca17eeadff7)
2013-08-30 10:18:49 -04:00
Scott Feeney 6eea2d7988 Rename views.py to views/__init__.py
(imported from commit 6d2fc769b3997f8ae9aea1119ebe1c27872baf42)
2013-08-30 10:18:49 -04:00
Jessica McKellar acdfb6afa0 email mirror: make being one of many recipients okay.
Previously the email gateway had to be the only address in a recipient
field or we'd mis-parse the recipient.

This commit also makes the mirror correctly handle addresses of the
form "Jessica McKellar <jesstess@zulip.com>".

(imported from commit 7435f2b59b8f47dc599cc869f64597a730af7d12)
2013-08-29 18:13:21 -04:00
Jessica McKellar c4157ed2b6 Make email mirror testing easier by using a different mailbox locally.
The mirror will use INBOX when deployed and Test locally. Send an
e-mail to the Test mailbox by including the word "localhost" in the
subject; a GMail filter will place it in Test on receipt.

(imported from commit bacf9a9554c8c5e1f3ec8497761edf2c15d3745d)
2013-08-29 18:13:21 -04:00
Scott Feeney c94ba52d3a Backend support for "announce stream"
(imported from commit dab3206a973083c3cee8225fa9ca71f4eecc269f)
2013-08-29 10:32:32 -04:00
Scott Feeney e3247de572 Factor out get_active_user_profiles_by_realm()
(imported from commit 634ebf265b02303a938f7595de3622e25bc22b49)
2013-08-29 10:28:20 -04:00
Scott Feeney 09ff770435 Make invite-only stream invite notifications less confusing
Previously, when added to an invite-only stream, you got notifications
like this:

   Hi there! We thought you'd like to know that Some Person just subscribed
you to the invite-only stream 'Secret stuff'

   You can see historical content on a non-invite-only stream by narrowing
to it.

Note that the second line is irrelevant and confusing in light of the
first!

This commit leaves this out, and also, to make sure I didn't mess
anything up (and because I needed to change the tests anyway), adds a
test for invite-only stream notifications.

(imported from commit 49c333629c78fc06f6d2f1ec8a627c6d38e7716a)
2013-08-29 10:27:34 -04:00
Tim Abbott ac1f9b5128 check_message: Allow zephyr mirroring bot to send to invite-only streams.
(imported from commit d45c75915cc4e29328768f1ed0e0ec972e5b7269)
2013-08-28 19:07:05 -04:00
Tim Abbott 5b62101a5f check_message: Clean up confusing and redundant authorization checks.
(imported from commit 1b756c89ec740f988e8f15d21fb413de9947d658)
2013-08-28 19:07:05 -04:00
Tim Abbott 371654adb3 zephyr_mirror: Make Webathena work for golem.
(imported from commit 6f8bf1f44c521b22c9fc990711d2821e5a60761d)
2013-08-28 18:56:54 -04:00
Tim Abbott 591b42bb1c bugdown: Clarify code around inline_interesting_links processor.
(imported from commit a1d734230135ab9099fafea7814bfec25754ea4e)
2013-08-28 18:56:53 -04:00
Steve Howell 1e88bb914e Add test_private_suggestions() to search_suggestion.js
(imported from commit db89f8574a4f7e169e66ebaff3a9c2cd49a4b0dc)
2013-08-28 17:41:17 -04:00
Steve Howell 8363b7c59a Add test_subset_suggestions() to search_suggestion.js
(imported from commit db9173ffa92ca225baf24a1103807034e4f31a7f)
2013-08-28 17:41:16 -04:00
Jessica McKellar cf0f205f75 tests: check that non-subscribers can't send messages to an invite-only stream.
(imported from commit 5ee0fb49e994c4d283348d89a25606ca6d314005)
2013-08-28 16:43:40 -04:00
Jessica McKellar 2cc06aafe1 tests: don't skip message sending restriction checks!
We were using the internal do_send_message, which does not do any
security checks.

(imported from commit 14a31a39a392dd2bc6b79f4345aa80217d5356f2)
2013-08-28 16:43:40 -04:00
Jessica McKellar f67f5b7619 Allow superusers to send messages to even private streams.
(imported from commit b7253174fa25d61b5bda056a5e5353e3b8ea918b)
2013-08-28 16:43:40 -04:00
Jessica McKellar d72ed33dc6 Be more verbose and explicit in the checks on who can send a message.
It was getting hard to follow and is going to get more complicated
with a new super user check in a later commit.

(imported from commit 8d5cfa960824519d87ce0f09aab3a120ba9ef357)
2013-08-28 16:43:40 -04:00
Steve Howell 5b598a6d9c Avoid churning the cache for stream name changes that don't change the cache key.
(imported from commit 1cc1ed01eaaaec4e6ddd6901fb5b877f831b604c)
2013-08-28 13:34:26 -04:00
Steve Howell 6aecdda7f7 Allow stream renames like corporate -> Corporate
(imported from commit 46d5078fb700631ef2a5b847eeeb055ff75d87d1)
2013-08-28 13:34:25 -04:00
Steve Howell 857680102f Remove enforce_arity checks from Dict
(imported from commit 8fdb6d8807e5c16349c7fcf71f25ce73348a5fe1)
2013-08-28 12:29:11 -04:00
Jessica McKellar b27f27f932 node tests: add some asserts for stream_data.delete_sub.
(imported from commit 3428f32206105b240e230e1050e7c16cd9c3729c)
2013-08-28 10:24:52 -04:00
Jessica McKellar 2be988e6b7 Give recipient_cache and associated functions a clearer name.
(imported from commit 14b12b196e33dfc4eeca5ab0f12c130ddaef1065)
2013-08-28 10:23:40 -04:00
Jessica McKellar 95c70967d2 rename-stream: support non-ASCII stream names.
(imported from commit 5fe2c803c0645bb6367f39bfe58acc478a66a0eb)
2013-08-28 10:23:39 -04:00
Jessica McKellar 8f3c5dc924 Add a management command to rename a stream.
(imported from commit b3acadc09b289b48e2ac298e50a5427545b6a473)
2013-08-28 10:23:39 -04:00
Jessica McKellar 97f0320dd1 Add the backend facilities for renaming a stream.
An important part of this is updating the various caches that cache
the display_recipient.

(imported from commit 888bf54fd205516cf31a25ba3f4e45ad11bbd4d5)
2013-08-28 10:23:39 -04:00
Jessica McKellar c1439c8853 actions: factor stream name checks into a function.
(imported from commit e107e895f247f6bfafe2c21de12d8a3c5de9268a)
2013-08-28 10:23:39 -04:00
Jessica McKellar 1f4f799030 Flush the per-process recipient cache after every request.
This cache was created to make recipient lookups within a single
request (e.g. when fetching old messages) cheaper. To support stream
name changes, we need to invalidate this cache on every request so
that users get a consistent view of the name change.

(imported from commit 801051b9f6a108c1f50be7eca9a1242d661919b1)
2013-08-28 10:23:39 -04:00
Jessica McKellar cd4daaa41f Factor the display_recipient cache key into a function.
(imported from commit 4a80c4db6ddcf8104f45b6b068e598378e655bc0)
2013-08-28 10:23:37 -04:00
Jessica McKellar d64c09b1ed Add a cache_delete for deletion of items from memcached.
(imported from commit 4fbdc4c4b230a5ab029dacc2463437f81fb0d023)
2013-08-28 10:23:04 -04:00
Jessica McKellar 21d857e577 Add a cache_delete_many for bulk deletion of items from memcached.
(imported from commit 33fc65dce89e51b99f13b50216d975272a028c16)
2013-08-28 10:23:03 -04:00
Jessica McKellar 2dbe6914d9 Factor out finding active user IDs to a function.
(imported from commit c2d25b24833be900af40d45331e4b9eb9e3a2dc6)
2013-08-28 10:23:03 -04:00
Tim Abbott 648e85160d Fix buggy application of subscription update events.
(imported from commit 4c76dc3ee5d3d1a298591c0c60dbe0e3aa30e0af)
2013-08-27 19:12:20 -04:00
Tim Abbott 77dbbe7f23 zephyr_mirror: Require zcrypt when mirroring to invite-only streams.
(imported from commit 1b88a8fc9bc26f2f9b1bb3f037093f85255feb17)
2013-08-27 18:26:12 -04:00
Tim Abbott e95a81addb Add Webathena login button to our mirroring page.
(imported from commit 43d8323bb502299027436a8c94c04f55d87bf953)
2013-08-27 15:41:43 -04:00
Steve Howell 667372068c Add idempotency test coverage for muting.js
(imported from commit 50496866fa11df433150ff28f0f1e58e9e8b33bc)
2013-08-27 15:40:54 -04:00
Scott Feeney 9f054eb15f Add a detailed docstring to rest_dispatch()
(imported from commit 6ff92e71e995e544c19828258a11d97e68294e3a)
2013-08-27 14:27:28 -04:00
Scott Feeney f225c467b0 Strip whitespace from email/key during API auth
Trac #1681

(imported from commit 4c97bfea052d2da7673ba5a9520f7ddc7515d975)
2013-08-27 14:27:28 -04:00
Scott Feeney 141877a06c Give a helpful error if API key is wrong length
Trac #1680

(imported from commit 0a50e7a93b37a5a3e74fb99c97a8917d8fbcc8f9)
2013-08-27 14:27:28 -04:00
Allen Rabinovich 2bb6f45af2 Add a data-name attribute to stream elements in the stream list and modify the test accordingly
(imported from commit 24791703015a47ae89fdf628d6511736b9d0f026)
2013-08-27 09:44:57 -07:00
Tim Abbott 134da30fdf Add webathena authentication button for Zephyr users.
This shows up when you're not running a Zephyr mirroring bot and lets
you use Webathena to have us run it.  Obviously needs more docs.

Current problems include:

* supervisorctl reload ends up recreating /var/run/supervisor.sock
  with the wrong permissions, so it only works once in a row before
  you need to chmod that.

* /etc/supervisor/conf.d needs to be humbug-writeable; this is a clear
  local root vulnerability

* This uses SSH and thus is kinda slow.

(imported from commit 7029979615ffd50b10f126ce2cf9a85a5eefd7a2)
2013-08-26 18:17:25 -04:00
Zev Benjamin 44ecd09ac7 Simplify Github event capture condition and improve error handling
Attempted captures are causing errors and I'm not sure why.

(imported from commit ecf7a711fc13f2c8e036a0ebf6db6c2cd566109b)
2013-08-26 15:37:37 -04:00
Scott Feeney 0856274fd2 Change empty messages to '(deleted)'
Before this it was [deleted]. Using parens is consistent with how we put
in (no topic) if you don't specify a topic.

(imported from commit 931c06a1096cf7b0d226336cbe82535abd2e6032)
2013-08-26 14:13:42 -04:00
Steve Howell a2bf6c3dd7 Test stream_data.in_home_view()
(imported from commit 29f1a187000e1818797c1a4781afaabca0ed29de)
2013-08-26 13:59:33 -04:00
Steve Howell b486f06e71 Test stream_data.get_invite_only for unknown stream
(imported from commit fb4e51b44b8c20844a7575af1a471a626273ae39)
2013-08-26 13:59:33 -04:00
Steve Howell 5e2de02dfc Test stream_data.get_color() for unknown stream
(imported from commit 7507e43de3f261a19d210c58863d1e614567f4bc)
2013-08-26 13:59:32 -04:00
Steve Howell ca5cf073f4 Add test_get_and_set() to stream_data tests
(imported from commit 007486f08879ea8b98524a91ef3fc02565cc4d86)
2013-08-26 13:59:32 -04:00
Steve Howell 96a2f0d907 Test TypeError exception in Dict.from
(imported from commit 088bf04ecf10338e2d1cff1b86d5beb263ee19dc)
2013-08-26 11:21:30 -04:00
Steve Howell 5dda9a5816 Test is_subscribed=false path of unread.get_counts
(imported from commit 7fb6531fb6d2d475bf43de6267fd018cc7347d7a)
2013-08-26 11:21:30 -04:00
Steve Howell 1821005dfe Restore subject counts for Uppercase streams
(imported from commit ef0e78d39c56da67544441a73ea257f215fefd94)
2013-08-26 11:21:29 -04:00
Steve Howell ffa9cfd492 Test that unread.process_loaded_messages ignores read messages.
(imported from commit 262f20933551e786022de564f46c75f901d8123f)
2013-08-26 11:21:29 -04:00
Steve Howell 582eef8305 Add test_message_unread()
(imported from commit 7f26cafb90757a9c490a148b6dd7b4f4f0fb5f95)
2013-08-26 11:21:29 -04:00
Steve Howell 06065d50bf Add dict.num_items()
(imported from commit 209a01b61d18d4b65b54e473cf727065aada68e8)
2013-08-26 11:21:29 -04:00
Kevin Mehall 7f1a1dba9d Show realm emoji in typeahead and update the list via events.
(imported from commit bd8b8be5d088d503cac2b72cf228e769827e2308)
2013-08-23 21:39:29 -04:00
Kevin Mehall e2a13637f2 Management command for realm emoji
(imported from commit 4de3ac69c34bc6e92d180c672fa8276338fecf53)
2013-08-23 21:39:29 -04:00
Kevin Mehall d8146141a9 Render realm emoji.
(imported from commit 5a8dca8963bc6e2e16762844aebaefcb85a6aad2)
2013-08-23 21:39:29 -04:00
Kevin Mehall 32aa0bb72d [migration] Add RealmEmoji model for realm-specific emoji.
(imported from commit d0a08b748f458c0ab68985b4cf00c78950ab40c4)
2013-08-23 21:39:29 -04:00
Steve Howell 63fa194139 Turn off the "muted" topic special case
(imported from commit ea34ea060eb29864c4816d0f14ee106dcb10be9d)
2013-08-23 18:33:48 -04:00
Steve Howell 4a7bab9a6f Allow collapsing of recipient sections.
This is experimental, for staging only.  There might be a better
way to model this than dueling force_expand/force_collapse flags,
but it works for now.  The code in collapse_recipient_group()
could also be DRYed up relative to expand_summary_row().

(imported from commit 107151d1ecd640970fb7700d41278a003bd1abaa)
2013-08-23 15:57:31 -04:00
Zev Benjamin 2b1a99f985 Tweak Github test data to not cause the Github payload capture to error out
I believe the test data to be incorrect, but we'll find out when
we've captured some real data.

(imported from commit ae32af0436b6273d0b2a60b2c55047aace6adcad)
2013-08-23 15:44:19 -04:00
Steve Howell b3ebb13469 Remove some ".d" suffixes in predicate tests.
I was saying bar.d in places where I wasn't really specifically
testing the .d feature, and it was distracting and just an
unintentional consequence of copy/paste.

(imported from commit 7b137b28cb33c72b83f02fe1d2961c5c6accc263)
2013-08-23 14:10:03 -04:00
Steve Howell 439e984f3d Break up Filter predicate tests
(imported from commit 780559045d6ea84612617db9249d7f191dbd86d9)
2013-08-23 13:56:28 -04:00
Steve Howell 3239efd864 Simplify MIT regex code and harden tests
(imported from commit 96c988fb8c90d04dd4bcd7d2bbc04f1b1c8d8cb7)
2013-08-23 13:32:10 -04:00
Steve Howell df812b40f9 Have test excercise Filter.predicate caching code.
(imported from commit 504abea7c1ef3a9cdb58b5bbcf2d751c5d98b1ea)
2013-08-23 13:32:10 -04:00
Steve Howell f8c3b70ced Clarify Filter tests dealing with bogus operators
(imported from commit db8327eb6df70bc8ffee7fb8166bc6491bd2fe70)
2013-08-23 13:32:09 -04:00
Steve Howell ec5bfa2a10 Test Filter.public_operators()
(imported from commit 47e08ffb3eb7f91b95b84b91a249bcf99157998e)
2013-08-23 12:56:09 -04:00
Steve Howell c205b8b29f Test Filter.predicate better.
(imported from commit d32a1e0d7a638bc5bd010b902475a27527e699ba)
2013-08-23 12:56:08 -04:00
Steve Howell 795248a1d0 Mute any topic named "muted" on zulip.com.
This change will allow us to test the muting feature on
staging.  Any topic named "muted" will automatically be
muted.  You can also mute any other topic on the console:

    muting.mute_topic('devel', 'ios');
    current_msg_list.rerender();

More UI around this experiment will be coming soon, as well
as support for muting entire streams.

The muting module keeps track of which topics are muted, but a
user can expand muted messages, and once that happens, the
messages are marked with the "force_expand" flag that gets
persisted to the back end.

Muted messages are rendered in similar fashion to the summarized
rows, and as part of unifying some of that code, we have
made it so that expanding a summarized section doesn't remove
individual flags related to summaries; instead, the messages
get the force_expand flag set.

(imported from commit acee4190e63813d46850415c41ff8ebfae4a6953)
2013-08-23 12:10:27 -04:00
Steve Howell dca1ffdf96 [bugfix] Restore toString() call in Filter.unparse().
I regressed this recently, thinking that all our operators are
strings, but I forgot about the "near:" operator used in the
"Narrow messages around this time" feature.  The user facing
symptom was that the search bar showed up empty instead
of saying near:50, which might actually be the better
behavior, but it certainly was not intentional. :)

(imported from commit fcb93cecbe9a052bb9bc1af7fcac5aecaba5aafb)
2013-08-22 14:55:43 -04:00
Steve Howell c4d598b36e Move parse/unparse from narrow to Filter.
I'm trying to move well-isolated methods out of narrow.js, so that
narrow.js is more strongly focused on UI/ajax interactions and
big, heavy lifting stuff.  The logical home for parse/unparse
seemed to be Filter, and they brought along two private methods
with them.  The big code moves involved trivial follow ups
like s/exports/Filter/.

(imported from commit ace0fe5aa1c7abce0334d079ba9eb8d9a57bd10f)
2013-08-22 14:53:00 -04:00
Scott Feeney f0e9786c08 Test user-sidebar unread counts & fix broken tests
This is hard to break up into separate commits; sorry about that.

Before this commit we had 3 tests:

1. Claims to check that an unread count was 3, but actually doesn't.
2. Checks that scrolling down causes the left-sidebar stream unread
   count to decrease.
3. Claims to check that unread counts are correct, but actually doesn't.

From talking to Leo, it seems that he originally tried to actually do
what tests 1 and 3 claim to do, but found it too fragile to check an
exact unread count because of font sizes, layout, etc.

We now have 4 tests. For each of the stream sidebar and user sidebar, we
test that:

1. Scrolling down causes the unread count to decrease
2. Logging out and back in again leaves the unread count unchanged

I've removed the two bogus tests and some other code that didn't seem to
serve a purpose.

(imported from commit 9f8e4b521e2765099510426d0b7e2960885e6f19)
2013-08-22 14:46:13 -04:00
Scott Feeney d4661b22c8 Remove deprecated parameter in Casper unread test
You used to have to call casper.test.done(N) where N was the number of
tests run. This is no longer required and is deprecated in CasperJS 1.1.

(imported from commit 0de9ecb1930cbce416fa02c24a882e926cdc8e87)
2013-08-22 14:46:13 -04:00
Scott Feeney f41f042127 Remove an outdated comment in CasperJS unread test
The test now works standalone, contrary to what the comment said.

(imported from commit 1280923dd522518689624628df5f3063fbdc1a1d)
2013-08-22 14:46:13 -04:00
Steve Howell 58c141ad79 Avoid side effects in ui.set_presence_list().
Have ui.set_presence_list() only touch the presence list.

Before this change, it was calling update_unread_counts(), which
has a bunch of side effects unrelated to the presence list.

(imported from commit 690f754d78874a03fa36f8ff8765d5a63e431d28)
2013-08-22 14:46:13 -04:00
Tim Abbott c2be5ca1ef Disable public streams for a CUSTOMER5 contractor.
(imported from commit bb7997cd831b9df9c951e3ecefe8a65b06bf6732)
2013-08-22 13:57:19 -04:00
Tim Abbott 9e372118a9 Simplify stream access denied error message.
Otherwise, we'll report that a stream is invite-only when it isn't.

(imported from commit 441db1c84fb19bdf564251a1bd80ace23151783d)
2013-08-22 12:29:04 -04:00
Tim Abbott a356a0a229 Enable get_streams to list subs for mit.edu realm.
This makes the mit.edu setup share code with the CUSTOMER5 special
case.

(imported from commit 5d1d824d5ab4b50a6b11a94526efc57a0bdf8cb0)
2013-08-22 12:29:04 -04:00
Tim Abbott f5f95e5f43 [manual] Extend /api/v1/streams API endpoint.
Previously it only provided the list of all public streams; now it
allows one to specify any union of some of the following:
* all public streams
* all streams the user subscribed to

(the most relevant being the union of those two, which is what we want
for the "streams" page).

Or:
* all streams in realm (superuser only)

The manual task required is that when this is pushed to prod, we need
to also deploy the new sync-public-streams version to zmirror.

(imported from commit 27848b8bd136e2777f399b7d05b2fdcec35e4e21)
2013-08-22 12:29:04 -04:00
Zev Benjamin 9167b98820 Capture Github event data from a test repository
Github's documentation is a little unclear on what data is actually
sent and in some cases conflicts with the examples in the
github-services repo.  The hope here is to capture a good sample of
different events to develop against and then use it in testing.

(imported from commit 356935894b87ca21591f5682c15f9ed27289a5b6)
2013-08-21 19:45:25 -04:00
Steve Howell 7b9d9bcdae Avoid monkeypatching in search_suggestion tests.
(imported from commit 5b36a8e7effce9f174c4f7aa0447b7c570db1ffc)
2013-08-21 18:18:58 -04:00
Steve Howell 3e259e028b Avoid monkeypatching stream_data object.
(imported from commit 4755cf44736190b566645a83a7fc576d3c8451cb)
2013-08-21 18:18:58 -04:00
Steve Howell 0202ca0261 Run unit tests in deterministic order.
(imported from commit 74e1690e3bd401730313e66611423dcdf4709f81)
2013-08-21 18:18:58 -04:00
Steve Howell d21cbac611 Clean up globals after each unit test.
The functions add_dependencies() and set_global() are convenience
methods that allow you to modify the global namespace while
the current file is running but then have it be cleaned up
by index.js when you're done.

(imported from commit f75b8a10c19f773a8d2d3a8fa4bc39b1679566fe)
2013-08-21 18:18:58 -04:00
Kevin Mehall 8b365a5681 Use '[deleted]' instead of failing if you edit a message to empty.
Trac #1571

(imported from commit a51602d72aa2b89ce451946ae7f5a5363a6421f4)
2013-08-21 16:49:24 -04:00
Zev Benjamin 3f95e54dc1 dict: Add setdefault method
This is like Python's dict.setdefault.  I don't love the name, but
the consistency is nice.

We have lots of places where we do things like:

    if (! dict.has('foo')) {
      dict.set('foo', []);
    }

    var arr = dict.get('foo');
    arr.push(3);

We can now write:

    var arr = dict.setdefault('foo', []);
    arr.push(3);

(imported from commit b8933809c69ba47ec346ed51d53966793403e56c)
2013-08-21 14:11:39 -04:00
Zev Benjamin 62aec87962 dict: Make set() return the value passed
We were accidentally leaking our internal representation.

(imported from commit 08ddc42583fb13a2ad51eea7ed1b30bf5ccb4645)
2013-08-21 14:11:39 -04:00
Zev Benjamin 707898b236 bitbucket: Allow the stream to be specified
(imported from commit eea7392551b568502c01e59c89056b4369fe53e0)
2013-08-21 13:41:03 -04:00
Luke Faraone f17d030272 Send IDLE continuously when idle, interpret a too-old status as offline.
This helps make our statuses more meaningful and should resolve trac #1534.

As part of this, we lower OFFLINE_THRESHOLD_SECS to 1.1̅6 minutes and
mark the user as idle after 5 minutes.

(imported from commit ee6b1ad203554a84b11e16c4c6195be9df5bcf4f)
2013-08-21 11:07:45 -04:00
Kevin Mehall 00fc004be2 Server-side check for empty (or all-whitespace) messages.
(imported from commit 49054dd7a8050705f579b4b7a1bda7eb7bfc25be)
2013-08-21 10:37:36 -04:00
Tim Abbott 1901ebe49d Fix showing invite-only streams on stream list.
(imported from commit f364c2fa28009f2cdfc9aed225d4a9a8c8a1d3c1)
2013-08-20 17:34:24 -04:00
Leo Franchi 8484cac5c9 Add a messages/flags POST api call to change a message's flags
(imported from commit b51ebd94c99f57f1cda19039023013209556e343)
2013-08-20 16:19:07 -04:00
Leo Franchi f8b7b54626 Log message flag changes to our event queues
(imported from commit 72fcea1a98c6a5be81f32963d51453f4bb12ace0)
2013-08-20 16:19:07 -04:00
Leo Franchi 33f4837570 Only count message queues when determining whether to deliver missed message emails
(imported from commit 5a302489f3bcb19e2824452a0d3c1330e483af7f)
2013-08-20 16:19:07 -04:00
Leo Franchi 26cd96f132 Let clients specify how long queues shall live, within limits
(imported from commit 86609f6611ed37b45b28c31e541528ce260d62c8)
2013-08-20 16:19:07 -04:00
Zev Benjamin 59041d993b dict: Move Dict.from(otherdict) functionality into clone method
(imported from commit 6a3981a726922d7acf55b49ea2d477271da430d3)
2013-08-20 15:37:08 -04:00
Zev Benjamin 2c775d0894 Make recent_subjects case-insensitive
(imported from commit 36c423f506c1e8dc0536c80a4a085b689623191a)
2013-08-20 15:37:08 -04:00
Zev Benjamin 3a70c4e928 dict: Make copying Dict constructor a class constructor method
(imported from commit 7bd5f6029c1290036a47688cf2b80f9317fe9c13)
2013-08-20 15:35:53 -04:00
Tim Abbott 517c98d56f add_subscriptions: add authorization_errors_fatal parameter.
For syncing streams between Zephyr and Zulip, we need to be able to
have the API client send the server a long list of streams, some of
which might be invite-only, and add the ones that it can add and not
the ones it cannot without a bunch of annoying round trips dropping
individual streams one is not authorized to one by one.  This argument
makes that possible.

We might find other applications as well.

(imported from commit 9236d185897c42218ab6cac3d8f3ddcb1bbc94e9)
2013-08-20 14:57:15 -04:00
Tim Abbott 5f724a94ac Add support for invite-only streams in mit.edu realm.
This changes the mit.edu access rules from:

* Susbcriber list and inviting users to streams are unavailable

to

* Susbcriber lists and inviting users to streams are only available
  for invite-only streams

streams must still be made invite-only manually.

This both cuts down on the amount of code that is different between
the mit.edu user experience and the standard one, as well as paving
the way for us to invite-only streams for zcrypt.

(imported from commit 24e0e85428608c05c89eeea349338dd392e5489a)
2013-08-20 14:57:14 -04:00
Tim Abbott 53e62d4e7b Use bulk queries when checking auth for invite-only streams.
This gets rid of our last query-in-a-loop in the code path for adding
subscriptions.

(imported from commit d192a7723647f49878fc05028e78d593077a3b78)
2013-08-20 14:57:14 -04:00
Tim Abbott 3396dc3aa9 list_to_streams: Return which new streams were created.
(imported from commit 95f6701c3d9e4ea31bbf2470fe91d05f7f1f5a17)
2013-08-20 14:57:14 -04:00
Tim Abbott a0238fcfcc list_to_streams: Rename existing_streams.
(imported from commit f7aec045fc9ead2911328860341fde31001c9456)
2013-08-20 14:57:14 -04:00
Tim Abbott 3ffc3bc7f6 Don't filter invite-only streams for mit.edu superuser.
It's likely we'll eventually want to split this into 2 API queries,
but most of the code in get_public_streams_backend is specialized for
the performance requirements of the mit.edu mirroring anyway.

(imported from commit 47ac6586b59467fd64992c573b6e36885167dcc5)
2013-08-20 14:57:14 -04:00
Tim Abbott 7f350abf74 Add missing update_fields when saving bots.
(imported from commit bdbf3785f41d39f934780a1e54dcb3e61c4c8af4)
2013-08-20 14:57:13 -04:00
Steve Howell edda967100 Leave casing alone in search suggestions.
The function narrow.unparse() is used in a bunch of places in
the search suggestion code, and now it no longer lower cases
operands.  This change contributes to fixing trac #1659.

(imported from commit 6b44b8a818482b5c8b4f9a45bc7d3a9d21e04eba)
2013-08-20 14:27:44 -04:00
Steve Howell 890a4f0ac0 Remove unused var in search_suggestion.js test
(imported from commit 2298d4c8642ac031cd98729c23eed79e2b994876)
2013-08-20 14:27:43 -04:00
Steve Howell 0a22094e24 Change operator canonicalizations.
Streams are converted to their "official" names now.
Topics are not canonicalized at all.
All other operands continue to be lowercased.

Since we don't lowercase stream/topic at the parsing stage,
we have to modify the predicate function to do the lowercasing
of stream/topic to enable case-insensitive comparisons.  This
is slightly more expensive.  The server-side predicate
functions are already case-insensitive.

(imported from commit 286f118c6c3ff9d23b37c7f958cab4c0eacd5feb)
2013-08-20 14:27:43 -04:00
Steve Howell 767a8ae400 Add test_predicates() to filter.js tests
(imported from commit 551f396b4458ac529858f91f693b424bc7d06b8c)
2013-08-20 14:27:43 -04:00
Steve Howell 33c70f0f69 Extract Filter.canonicalize_tuple().
(imported from commit 96b8dc8c27c07d6d13f1e02c88a164abcab5a5c2)
2013-08-20 14:27:43 -04:00
Steve Howell d5f997eb58 Use the correct stream name in compose defaults.
If we have a stream named "Denmark" and we're narrowed to it,
then use "Denmark" as the default stream name in the compose box
even if the narrow operators are lowercase.

(imported from commit e9f06b7307c73231aa887dc95849e0307984e6f0)
2013-08-20 14:27:42 -04:00
Steve Howell 18857f6601 Added stream_data.get_name().
This function returns the stream's actual name, if we can get it;
otherwise, it's the identity function.

(imported from commit 7a981adba9632d6c6eba54cb6514a9226d1e83e8)
2013-08-20 14:27:42 -04:00
Steve Howell eccd7e90ab Add unit tests for stream_data.js.
(imported from commit 9a91aea1db3afc7936b1dbaeb4c014a3df6cd633)
2013-08-20 14:27:42 -04:00
Steve Howell 579f53845e Have search_suggestion clean up after itself
(imported from commit def5797f02868ecdb7dc3ffcc25caf1e532e2764)
2013-08-20 14:27:42 -04:00
Steve Howell 3d20f6478c Add unit test for narrow.set_compose_defaults().
(imported from commit 819b326bb10b4126438c9336d41e4aadce94d381)
2013-08-20 14:27:42 -04:00
Steve Howell f593c551da Add tests for Filter canonicalizations
(imported from commit def24dda1f178b658f6e49f3d2c67db779059c89)
2013-08-20 14:27:42 -04:00
Steve Howell 2491a80aa6 Fixed comment in in index.js
(imported from commit d28abf87d80f53038f1273529fcfe758fe7db2af)
2013-08-20 14:27:41 -04:00
Kevin Mehall d29484daa7 Casper tests for message editing
(imported from commit 4a62267241099432b40ef2cd592e0d5c20384f75)
2013-08-20 14:07:49 -04:00
Zev Benjamin 237746f3e2 Handle force pushes in Bitbucket integration
(imported from commit 6663934788b5cea13f9cf1344c45d2a568a0f287)
2013-08-20 12:28:04 -04:00
Scott Feeney 69efe2a695 Add a Node.js-based test runner
There are no functional changes; you can still use the shell script
tools/test-js-with-node. It just delegates now to the new index.js to
iterate through all the other .js files in the test directory and run
them. This sets the stage for Istanbul to correctly compute test
coverage.

(imported from commit 6f521c78b7a314d010fa113f9c2c971ab999b637)
2013-08-20 10:46:22 -04:00
Zev Benjamin 8010b49067 Add support for issues events for Github integration
(imported from commit 6ae1013948626acdd161bd6f2648351201842658)
2013-08-19 17:13:37 -04:00
Kevin Mehall 8a741ed3d4 Ensure that the pointer is valid before saving it.
Trac #1716

Fix the tests to use real message IDs for the pointer. One helper didn't
use the pointer ID it was passed at all, so the test didn't actually test
what it was supposed to before.

(imported from commit 457bcdb04a6c3873e224b68cd9d79c9a26612010)
2013-08-19 16:46:52 -04:00
Kevin Mehall 054ccabf16 Don't fail to load the home page if the pointer is invalid.
Trac #1716

(imported from commit 089093aaa2e5466c9f8fb89f795b44c648e8a6e8)
2013-08-19 16:46:43 -04:00
acrefoot 395aaae994 Allow anyone to edit a "no topic" message
This change would allow anyone in the realm to set a topic for a "no topic"
message. As soon as the message topic is set, only the sender can change it again.

(imported from commit 0a91a93b8fd14549965cedc79f45ffd869d82307)
2013-08-19 16:29:30 -04:00
Steve Howell 53f62bd71c Created MessageListView class.
(The code for MessageListView  was extracted from message_list.js.)

(imported from commit 60c0bac4c734d3850f8b8c047a978c292b19cc13)
2013-08-19 12:17:56 -04:00
Steve Howell 29c012dc74 Create stream_data.js module.
This pulls a lot of data-centric functions out of subs.js.

(imported from commit 0deed7d4bf5697e893af9bc9d888c2d5da8d9fa2)
2013-08-19 12:17:55 -04:00
Zev Benjamin 04147ae01f Set Cache-Control headers on index.html requesting no caching
This solves the problem of restoring a tab taking you to the previous
load's initial pointer position.

(imported from commit e5e988af65966b15a9d091064b65f87be3f0d75a)
2013-08-16 18:08:41 -04:00
Steve Howell a4af6c7062 Add unit tests for composebox_typeahead.add_topic().
This tests topics_seen_for() as well.

(imported from commit a748134af8068d9e4ae223fb7ecbbbc6c170137e)
2013-08-16 17:59:40 -04:00
Jessica McKellar f3a32d8382 Report email forwarding errors to our internal Zulip.
For now, just do this, and we'll reach out to realms having trouble
manually. We may eventually need to automatically reply to the e-mail,
reach out to a realm admin, etc.

(imported from commit 5c5ac354066f9e9be3fb928e1f8801613c22c1ac)
2013-08-16 16:09:18 -04:00
Jessica McKellar 557bdd2a6e email gateway: Make forwarding even "richly formatted" messages work.
(imported from commit b15f24fa6898eb2eaf7d27bf862e8bead76f544d)
2013-08-16 16:09:18 -04:00
Zev Benjamin f06c3c0aed Add BitBucket webhook integration
(imported from commit 50be72fb72d52e24b161f09b1d2314aaae5d636c)
2013-08-16 14:38:54 -04:00
Zev Benjamin 7650804499 Split build_message_from_gitlog in two
We do this because the upcoming Bitbucket webhook does not send
enough information for us to send a useful message for deleted
branches or force-pushes.

(imported from commit dcac675f47e10672125caabd6fefa8dc0dc9c86c)
2013-08-16 14:38:54 -04:00
Zev Benjamin 2f262b1558 Make @authenticated_rest_api_view imply @csrf_exempt
(imported from commit a90402effe48b184c05bf19f1136e3d63a6f460b)
2013-08-16 14:38:54 -04:00
Jessica McKellar d0aefa872e Give new users in all realms historical messages in their home view.
(imported from commit 60977c330d3a3dd22d77749104e388e12ef9e314)
2013-08-15 17:25:02 -04:00
Luke Faraone 078aea862c Always convert emails to lowercase in helper functions.
(imported from commit 834be7d682167c0d428c9b8a5ab8d3ae0c0d51a7)
2013-08-15 13:17:46 -04:00
Luke Faraone 4ad77831d1 Don't crash if a MIT user registers who has never sent/received a zgram.
(imported from commit 2527c8f4c3a5d8f6281318afff5ebdb431d0613e)
2013-08-15 13:17:46 -04:00
Luke Faraone 21b4b65322 Prefill a MIT user's fullname if we can guess.
(imported from commit 032aa393ee741cdae0deba6a4091be5c7dcc38d9)
2013-08-15 13:17:46 -04:00
Luke Faraone db2fd45deb Create MitUser objects in organic signups.
This is the way we disambiguate MIT users from normal PreregistrationUsers.

(imported from commit adfe781036f653ef2c15850100c7ea26332d9ef4)
2013-08-15 13:17:46 -04:00
Luke Faraone 9e71d0c7b2 Encode names before passing to urllib.
This otherwise causes Unicode bugs. See for example:

>>> import urllib
>>> urllib.quote_plus("hello&world+whats@up?")
'hello%26world%2Bwhats%40up%3F'
>>> urllib.quote_plus(u"faraoné")
/usr/lib/python2.7/urllib.py:1268: UnicodeWarning: Unicode equal
comparison failed to convert both arguments to Unicode - interpreting
them as being unequal
  return ''.join(map(quoter, s))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/urllib.py", line 1275, in quote_plus
    return quote(s, safe)
  File "/usr/lib/python2.7/urllib.py", line 1268, in quote
    return ''.join(map(quoter, s))
KeyError: u'\xe9'
>>> urllib.quote_plus(u"faraoné".encode("utf-8"))
'faraon%C3%A9'

(imported from commit 7c13b749bdc7f89e7b767ddd630be0ebce30802c)
2013-08-15 10:56:46 -04:00
Steve Howell 3e1cdaaded Add MessageList.nth_most_recent_id().
(imported from commit 69a424d4990402b9e77fbfa57fa573a002cf04ce)
2013-08-15 08:20:29 -04:00
Steve Howell 947ca3a0e0 Add Dict.each().
Dict.each() allows to iterate through values and keys of a Dict.
The callback function is passed value as the first parameter to
be similar to _.each()'s calling sequence.

(imported from commit e745e8b5d2f167b8b8acf7542b767494e354b037)
2013-08-14 14:24:38 -04:00
Jessica McKellar cc21429b99 Add a management command to dump all messages on public streams for a realm.
(imported from commit f4f8bfece408b466af4db93b2da15cf69b68e0a3)
2013-08-13 18:16:30 -04:00
Tim Abbott e24c770738 Fix bare save on UserProfile object in regenerate_api_key.
We should never be using bare saves like this, since they create
unfortunate races.

(imported from commit 82837e89b20eb4ac7040a79a5f695ca28cdf97bb)
2013-08-13 18:09:19 -04:00
Jessica McKellar f530e3b930 Display the email address for a stream in its stream page detail.
For now, only show it on staging.

(imported from commit fd07fad1c34578d8ddc2cddd1bb6bdcb72f354de)
2013-08-13 14:28:47 -04:00
Jessica McKellar 15afdf65eb email forwarder: encode stream names so they are safe in email addresses.
(imported from commit 6699d656e3cae58fad062a1403fb9923429fde89)
2013-08-13 14:28:47 -04:00
Jessica McKellar c4a0797413 Decode MIME-encoded emails before forwarding them to Zulip.
Otherwise you'll see garbage.

(imported from commit 07e68a5e209fdea4f54470396a67986dd9fa4016)
2013-08-13 14:28:47 -04:00
Jessica McKellar befd34d111 [schema][manual] Make Stream.email_token required.
This commit CANNOT be deployed until the previous schema change
([schema] models: add an email_token field to Streams) is on prod.

Before applying this schema change, run the populate-stream-tokens
management command to generate tokens for streams that need them.

(imported from commit 7adc81c8c317ec5d59dd59ba42a4dc1a46174007)
2013-08-13 14:28:47 -04:00
Luke Faraone af4c34330b Switch to checking database is_bot field instead of using a heuristic.
This has the amusing side effect of showing all the Zulip bots in the
administration view because none of them have the is_bot 	 set.

(imported from commit cdec19d2109c092018c1f331aa32f345d1587683)
2013-08-13 14:20:18 -04:00
Luke Faraone ecc42bc9f8 Add administrative panel to allow for user deactivations etc.
We now show a list of users and allow you to deactivate a user using the
same process as `python manage.py deactivate_user`.

We add a new menu item accessible from the gear icon which will eventually
have much more than just this, but we have a good start here.

Here we also add a property to UserProfile which determines whether you're
eligible to access the administration panel, and then have code which shows
the menu option if so.

This introduces a new JS file, admin.js.

(imported from commit 52296fdedb46b4f32d541df43022ffccfb277297)
2013-08-13 14:20:18 -04:00
Zev Benjamin 6843cc4479 Add test for zephyr mirror CC de-duplication
(imported from commit 1452c67818f8aa577a95a219fc6b86e9690033eb)
2013-08-13 13:49:09 -04:00
Zev Benjamin 307bba5b29 Add comment to some zephyr mirror CC de-duplication logic
(imported from commit 86680f24329475dccc79731639d51a735fa873bf)
2013-08-13 13:48:32 -04:00
Zev Benjamin 91c0be44a1 Raise JsonableErrors while checking messages instead of returning error strings
(imported from commit 986ad1e19dd508b12386c57cf093b32d3fbcf49e)
2013-08-13 13:45:10 -04:00
Zev Benjamin bfebfbbff5 Make error messages a little more consistent
(imported from commit 77baba591628bef6b8b8b0ae28a9e05ec2fac693)
2013-08-13 13:45:10 -04:00
Zev Benjamin 6fcfcf3f32 Fix comment
(imported from commit 6f8eac90e5b011bd25b09e562ebcb9d2cae39a06)
2013-08-13 13:45:09 -04:00
Zev Benjamin bcc03dd4ab Do full-precision time comparison when checking for duplicated messages
We've had microsecond-resolution timestamps since we migrated to Postgres.

(imported from commit 81fe79f00097ceb40105645aa04a2f0ee29d3a19)
2013-08-13 13:45:09 -04:00
Luke Faraone 8c35db91c0 Unit testing for MIT user name calculation / mailing list protection.
(imported from commit ae7d4c0a1fea0b0887861a71828eae7c3022ec6f)
2013-08-13 10:21:45 -07:00
Luke Faraone 3129b6374d Fix broken parsing of DNS response.
(imported from commit 3a627d45bc313bf244dc699a59df9423c849bc35)
2013-08-13 10:21:24 -07:00
Jessica McKellar 1a0cc2b421 Send enough information in page_params for the client to consider bankruptcy.
Previously, we'd determine unread counts client-side as messages got
loaded, which meant:

a) how many unread messages you were known to have kept changing
b) you could bankrupt yourself and then get the bankruptcy message
again as more messages arrived from the server

(imported from commit 90f1af27b493c720f77d37487d8746749faf157e)
2013-08-12 17:33:39 -04:00
Waseem Daher abef6be12f bugdown: Unescape HTML entities in Twitter.
This closes Trac #1071.

(imported from commit 521ffa6ed13df7c08e67218564d426ca90080948)
2013-08-12 17:23:49 -04:00
Luke Faraone 0cb741d7cc Removed confusing ALLOW_REGISTER setting.
ALLOW_REGISTER was no longer being used in determining whether you could
register for the app, so I've removed it to avoid additional local-dev /
production issues.

This closes #1613.

(imported from commit c928c6d350602d35f745ae1e60d734e4567885fc)
2013-08-12 16:16:26 -04:00
Luke Faraone f3c8806d30 Allow open realm signups with non-real-user MIT addresses.
This allows me to use a mail alias with CUSTOMER3, and closes #1671.

(imported from commit 581d1145fb112b9d35ad522fa06f81a25b4b8d3b)
2013-08-12 16:16:24 -04:00
Luke Faraone cb2e993393 Allow any user with a @mit.edu to register for Zulip.
We add a new validator that ensures that people who sign up with @mit.edu
addresses are in fact MIT users.

This closes #1612.

(imported from commit 1e30794b1615dd57cb0e367d1fa186a877253357)
2013-08-12 13:09:20 -07:00
Luke Faraone 368ace069c Use PyDNS instead of shelling out to `host`
On Debian systems, this is found in the `python-dns` package.

On OS X and others, install "pydns" using your Python package manager.

(imported from commit 17827d0a1d3d72b12945df5563295a1573bfa1ed)
2013-08-12 13:09:19 -07:00
Zev Benjamin 9c8a9ac947 Correctly return the message id for already mirrored zephyr messages
This was previously causing us to generate a traceback every time we
hit a duplicated zephyr due to CC'ing.

(imported from commit 240e1559655d0166dcd864e84649ab97b87a29ad)
2013-08-12 15:49:19 -04:00
Steve Howell 878ee2b3fd Move Filter class to filter.js from narrow.js.
1) The class Filter now lives in its own module.
2) The function canonicalized_operators() is now a class method on Filter.
3) The function message_in_home moved to filter.js and became private.
4) Various calling code had to change, of course.
5) Splitting out Filter helped simplify a few tests.

(imported from commit e41d792b46d3d6a30d3bd03db0419f129d0a2a7b)
2013-08-12 13:58:32 -04:00
Zev Benjamin 51beeba854 referral: Prevent empty form submission
(imported from commit cc012e84c21bc424adaaa79611f09415480a2ba5)
2013-08-12 12:50:32 -04:00
Tim Abbott f9c3f77d07 For the CUSTOMER3 realm, include 100 messages in initial message set.
This is an experiment to try to ease the customer3 onboarding process
given that there will be a website with a public feed of recent Zulip
messages, to ensure that those messages appear for new users.

(imported from commit 31fb59c1800728b5e4d8a5ce7282c7dcedb02b21)
2013-08-12 10:17:18 -04:00
Tim Abbott b7e3f608cb Fix setting the initial pointer for users starting with messages.
This if statement stopped working when we made the pointer managed via
the events system.

(imported from commit 382ca5bd055ab85048b211068ff3d43a47607f28)
2013-08-12 10:17:18 -04:00
Zev Benjamin ec9322fc87 Use Dict everywhere we have keys based on potentially dangerous, user-supplied data
There are also one or two places we don't need to use it for security
purposes, but we do so for consistencey.

(imported from commit aa111f5a22a0e8597ec3cf8504adae66d5fb6768)
2013-08-09 17:35:14 -04:00
Zev Benjamin 0cfc8fae9f Add basic Javascript Dict implementation
(imported from commit 9f2fb089eb6e269549de26b37bd588355757d22c)
2013-08-09 17:20:14 -04:00
Zev Benjamin e0eddabeb1 Add util.enforce_arity
util.enforce_arity takes a function and returns a new version which
throws an error if an incorrect number of arguments (as determined by
the function prototype) are passed.

(imported from commit 20e69a6dc7b6f8455726ab4fae8d5b7b04dc4103)
2013-08-09 17:12:23 -04:00
Tim Abbott dd50f29b3d get_events: Don't return a queue ID unless we allocated one.
(imported from commit 85ad1aa2a0d52247c5efcecfab5212e40b876b88)
2013-08-09 15:35:33 -04:00
Tim Abbott 7fa448cdef Return the message ID when sending a message.
Our API documentation says that we do, and it seems like it could be
useful to clients, so we might as well do it.

(imported from commit c391e4952a09d41df4dc06e3dc6ee094f774822b)
2013-08-09 15:35:33 -04:00
Tim Abbott 9d6627d269 Rewrite documentation for /api/endpoints.
The main changes are:
(1) Changing the input format for the example response so that it is
human-readable and editable
(2) Updating it to use the events API

(imported from commit 308fade9595d6877836d343d2307e3fceff3e7d4)
2013-08-09 15:34:57 -04:00
Jessica McKellar a878f8a668 populate_db: make emailgateway@zulip.com a default user.
(imported from commit 000d03f59afbb1da125d5d610e1fff6b54d5dbd0)
2013-08-09 15:22:59 -04:00
Jessica McKellar a228bb6671 Implement a v1 email-to-zulip forwarder.
(imported from commit 5f91fd69ee2075413d0d4aedf71b878bf98c640e)
2013-08-09 15:22:58 -04:00
Jessica McKellar 639aac964e Add a management command to generate hashes for all streams that need them.
(imported from commit b3a05e47dfe69b44f984185e360d79bf04f7885b)
2013-08-09 14:59:27 -04:00
Jessica McKellar c020545e02 [schema] models: add an email_token field to Streams.
The e-mail forwarder will use this. Set it to nullable temporarily to
accomodate existing streams; later commits will a) provide a script to
give all streams a token, and b) make the field non-null.

Realm administrators will eventually have a UI to regenerate stream
tokens.

(imported from commit a084d0a7012eb9665e4da095cbc46aa9ef354eaa)
2013-08-09 14:59:26 -04:00
Jessica McKellar 3f8dfc7b9b Move to a common random token generation function instead of several one-offs.
(imported from commit 3217de5384088deff68fbffc6bd481c045a76817)
2013-08-09 14:59:26 -04:00
Jessica McKellar 28a4c1e971 Give API superusers the ability to send messages to arbitrary realms.
(imported from commit e7d1e89844cd2c32c14ad852d848e93b5861eac1)
2013-08-09 14:59:26 -04:00
Jessica McKellar 62a20cf0ef Make emailgateway@zulip.com an API superuser.
(imported from commit 02b6c98123bbc10bd8feca29382a091b43d5b65a)
2013-08-09 14:59:26 -04:00
Steve Howell 6790ed79cc Add a unit test for activity.js.
This includes slightly invasive, but harmless, changes to
the production code.

(imported from commit ff40af504de2360ada866508da262e0d2e9f7ad9)
2013-08-09 13:11:59 -04:00
Steve Howell db33028b98 Added tools/test-js-with-casper symlink.
The test-all script now calls the symlink, and the run script
has been cleaned up to be symlink friendly.

(imported from commit 8abb5c1e5744416e94ff843e50c53e0d0f7e1316)
2013-08-09 13:04:52 -04:00
Steve Howell cf1d94edef Add a test for stream_color.js (pick_color).
(imported from commit a49f96a4a7b61ef51c057e8a3f11c116d77ebb49)
2013-08-09 12:29:02 -04:00
Steve Howell cef72fd8b8 Add tests for the Filter class.
(imported from commit ef0917bd7911c5cc6f6d20d356c156d483ba723f)
2013-08-09 12:04:43 -04:00
Steve Howell cc73619a9d Add unit tests to narrow.js.
This includes slightly invasive, but harmless, changes to
production code.

(imported from commit 847557c11088b75c836cc399d0af75353a8faa3a)
2013-08-09 11:59:32 -04:00
Steve Howell 50b28dec49 Add node-based unit tests for util.js.
(imported from commit df666a5b96d378787e911c2cd6e509b7d42e1cb4)
2013-08-08 17:25:24 -04:00
Waseem Daher 49849a214f New onboarding step: Set up an integration.
(imported from commit 2c6cc6f703e893b44b2871c9510e858743d417ad)
2013-08-08 17:23:27 -04:00
Steve Howell 8eb15a5436 Don't show inactive users as stream subscribers.
This fixes trac #1660.  A deactivated user may still have the
active flag set to "true" on their subscriptions, but this is
just to help future reactivations; they are not actually
valid subscribers while deactivated, so we add UserProfile.is_active
to our filter in the query in get_subscribers_backend().

(imported from commit 8598b2e180faea618371293e42b794898e645004)
2013-08-08 16:29:18 -04:00
Steve Howell 164215bc78 Support API for changing user's API key.
(imported from commit b9f5594cf809965c996115c8420a359820dad3ff)
2013-08-08 13:03:09 -04:00
Steve Howell 0b4c37ef8d Autocomplete names w/spaces in search.
See trac #1356.

(imported from commit 6aaf122c0f6d7b1d92bb074e8f3fbb93d0b63ceb)
2013-08-08 12:54:20 -04:00
Kevin Mehall 0b9497305f Add defensive checks against undefined messages to _is_summarized_message.
Should fix the issue with empty realms.

(imported from commit afca70ebf3b7b74ae0d0c269c72b4f8d54fc254b)
2013-08-08 12:47:23 -04:00
Tim Abbott 9181c7c75b Move generate-fixtures to tools/.
(imported from commit 3d452b17e315ba9adf91e33408a7711d16b069a2)
2013-08-08 10:22:32 -04:00
Tim Abbott 2ea1bb05a5 Rename ~/.humbugrc to ~/.zuliprc.
(imported from commit a0d53dd20097a56971874dc1d84c6f95267e84f2)
2013-08-08 10:22:31 -04:00
Jessica McKellar d6c87f35e2 Move domain validation from a form field validator to a data cleaning check.
We need to be able to let a user through if they are trying to sign up
for a completely open realm like CUSTOMER3.

(imported from commit 1e33ab0ce94545f217739d501e9227dfb48e1123)
2013-08-08 10:12:22 -04:00
Jessica McKellar 99b2a90440 Move completely_open to models.py.
It will have new callers soon and that's as fine a place as any to
avoid circular imports.

(imported from commit 089a724e9ad06cb5a51ffe80f1729d789238e5f6)
2013-08-08 10:12:22 -04:00
Tim Abbott 7b9305b06f Rename Django project to zproject.
This includes a hack to preserve humbug/backends.py as a symlink, so
that we don't need to regenerate all our old sessions.

(imported from commit b7918988b31c71ec01bbdc270db7017d4069221d)
2013-08-07 11:04:03 -04:00
Kevin Mehall eac6463031 Implement message summarization experiment.
When you read messages in a narrow and then un-narrow, collapse
adjacent messages read in the narrow into a summary row that can
be clicked to expand those messages.

Scoped to staging with feature flags.

The implementation of this within our current MessageList is rather ugly.

(imported from commit bcb3a39d8c0c334136fe86318f18ead03f0f50bf)
2013-08-07 10:24:03 -04:00
Tim Abbott 4c8fdec554 Rename humbug => zulip in comments.
(imported from commit 26f305fa9351135a1b874f3c2106f03aed7683cb)
2013-08-07 10:00:08 -04:00
Tim Abbott ae615dfb4d Rename humbug => zulip in some settings.
(imported from commit 4d10e6213cf828f16b833ecba98b950972c32442)
2013-08-07 10:00:08 -04:00
Tim Abbott d59ba39518 Rename humbug_finish to zulip_finish.
(imported from commit a73ef9302d16a4068c7d050d4882d2eba699488d)
2013-08-07 10:00:08 -04:00
Tim Abbott 661ca38b58 Change humbug => zulip in some local variables.
(imported from commit 88caa4a87ea0fd269ab741645c124c5d07d69c0a)
2013-08-07 10:00:08 -04:00
Tim Abbott 2db6dc6c88 Change humbug => zulip in populate_db variables.
(imported from commit 14f8e072fd87478e8877925912fde113a75aba2c)
2013-08-07 10:00:08 -04:00
Tim Abbott 41433e552f Remove old sqlite path zephyrdb from .gitignore files.
(imported from commit 1d9c9849de46854ace1caa4c32d5fe4c86d2ff5c)
2013-08-07 10:00:08 -04:00
Tim Abbott d8f78a5e2d Fix some remaining references to zephyr.
(imported from commit 2072d3451cc08bc32b997d7fafaafd7b6ac568df)
2013-08-07 10:00:08 -04:00
Tim Abbott d6e32668c8 Change Humbug => Zulip in name of exception filter module.
(imported from commit 87d4a45834f605a83fa5f9286217258dafaa1b92)
2013-08-07 10:00:07 -04:00
Tim Abbott d63a398716 Change Humbug => Zulip in name of error limiter module.
(imported from commit 55c5deba463faecc50da22e9745fd13ad8b11fd8)
2013-08-07 10:00:07 -04:00
Tim Abbott 6083ad7244 Change Humbug => Zulip in name of finder module.
(imported from commit 2f5391da2c3ce667531a3c6155c759309b9249f5)
2013-08-07 10:00:07 -04:00
Tim Abbott 034c96ef77 Change Humbug => Zulip in name of storage module.
(imported from commit 37d7994b36e5140962866d5c11d98ca05ad15d62)
2013-08-07 10:00:07 -04:00
Tim Abbott 3a470aa9c7 Change Humbug => Zulip in names of error reporting handlers.
(imported from commit 12e5486321303c80f6676c1f516ff35c3dcb676d)
2013-08-07 10:00:07 -04:00
Tim Abbott 1f1af26048 Change Humbug => Zulip in text/comments.
(imported from commit 2f9d73431ae40e1b9e9e11bc2f4f62f566ae758a)
2013-08-07 10:00:07 -04:00
Tim Abbott e05979d4c4 Rename humbug_realm to zulip_realm.
(imported from commit b36dcc7e5240159357a0f30036394a2af9b85844)
2013-08-07 10:00:07 -04:00
Steve Howell 57f518c9c2 Add node JS unit tests for MessageList.
(imported from commit 486a343add91fd5037431504e1ce4a750bfa9fbf)
2013-08-07 09:25:13 -04:00
Steve Howell 9f9c7c3e3b Loosen up emoji regex. (i.e. More emojis! 👍)
Now parsed: 🍺,🍺;🍺!

 If \w characters surround :foo:, we still say it's NOT an
 emoji, but we used to do this for \S characters, so it's loosened up.

(imported from commit 49b33d2f0ffdcfde8947ae411a4addcf4c24af9c)
2013-08-06 18:20:30 -04:00
Steve Howell 3aa5930191 Streamline search suggestions when query has trailing space.
If you entered "stream:Denmark " in the search box, we would show
you two suggestions for "stream Denmark", despite our duplicate
detection, because we didn't canonicalize the suggestion that is
literally based off the user typed query, and so the other way
of generating the "stream Denmark" suggestion created a duplicate.

Now all the suggestions we generate are canonicalized, so the
generalized duplicate detection can work.

(imported from commit 52bf08ccf9bb2e2260ca8c20690169aead3732ab)
2013-08-06 14:04:29 -04:00
Tim Abbott e111a2f9a5 [manual] Rename Django app from zephyr to zerver.
This needs to be deployed to both staging and prod at the same
off-peak time (and the schema migration run).

At the time it is deployed, we need to make a few changes directly in
the database:

(1) UPDATE django_content_type set app_label='zerver' where app_label='zephyr';
(2) UPDATE south_migrationhistory set app_name='zerver' where app_name='zephyr';

(imported from commit eb3fd719571740189514ef0b884738cb30df1320)
2013-08-06 07:39:36 -04:00