Commit Graph

3412 Commits

Author SHA1 Message Date
Leo Franchi 028711baef Handle some JIRA formatting and make it like our own
(imported from commit 1e8369067668b0c375f226c1911814f496637d16)
2013-10-02 11:18:17 -04:00
Steve Howell 53b5768b14 Double speed of message fetching in get_old_messages_backend().
When we don't already have old messages in cache, we need to
fetch data from the database and create dictionaries for the
cache.  This commit makes that process work in 50ms, instead
of 130ms, for the data set in test_bulk_message_fetching(),
which is 602 records.  Before this commit we had about 132
microseconds of unnecessary churn per message, because we
were fetching DB fields we didn't need and incurring the cost
of the Django ORM.  Now we use values() to get only the columns
we need, and we take advantage of previous commits that make
our code less OO and more function-driven, so we can pass the
values directly to build_message_dict() without having to create
objects.

A couple caveats on this commit:

1) I haven't been able to get good measurements on the overall
effect on get_old_messages_backend().  If you kill the cache to
force DB queries, you introduce noise related to sessions and
user profiles.

2) Look at the long comment in this commit related to
re-rendering messages in this codepath.  The problem precedes
this commit.

(imported from commit dcb64aa9416f0e9583355ddd6dc3adfa746b9fc7)
2013-09-30 18:22:07 -04:00
Steve Howell f36938c2f5 Extract Message.extractor
(imported from commit e6ee015cacdb0f6e1f725b7113f750e8b33d316b)
2013-09-30 18:08:29 -04:00
Tim Abbott 002e28d838 Display user's email in logs for requesting hitting /.
(imported from commit d272f22b8b4de9640a86b66d7833336cc8a9822a)
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
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
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
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 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
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
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
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 f6500d691e github: Make pull request comments go to the user-specified stream
(imported from commit dfce76bcba43dd4a0beba6b6af7642363193dcde)
2013-09-24 16:32:13 -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 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
Leo Franchi edbde0b78b Handle unknown pivotal events, and log
(imported from commit f177d7d0d8f4c09b2b94bb23973cd90ca8930f3b)
2013-09-24 16:19:52 -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 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 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 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
Leo Franchi c588c7938c Allow message topic changing to propagate backwards
(imported from commit 470178ef5f7aaf09d4528c88ae6e33f17538fcaf)
2013-09-18 13:27:58 -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 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
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 cfeaa2be9b Add backend support for realm admins to rename streams.
(imported from commit eaf419f1f68dfd350b8c99e8a5089ec316f0c409)
2013-09-16 16:16:13 -04:00
Steve Howell b7ef86bc34 Added /json/set_muted_topics
(imported from commit e9072cd273fabf0e072b6a5e9ed80b07142f1013)
2013-09-11 16:47: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
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
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
Scott Feeney 65ed20469e Split out get_subscribers method on backend
(imported from commit b5941ff90bbf5b31a9fa31aa83e5d1856d483dcc)
2013-09-06 23:13:47 -04:00
Leo Franchi 252045fe2e Fix assignee in JIRA created message
(imported from commit 5ebadd14dee58c20746c80dfd99ba70a3d772ab6)
2013-09-06 11:24:03 -04:00
Zev Benjamin b3644ecfad Fix attribution of Github issues messages
(imported from commit 941e52e51dfd9fddfe4f86bb33f25877d6d0edbd)
2013-09-05 16:04:59 -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 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 41b286232d Allow filtering to alerted messages with is:alerted
(imported from commit 99834f1ee1b9b2e0f5c7427afa1494bf404e3626)
2013-09-05 10:18:41 -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 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 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