Commit Graph

86 Commits

Author SHA1 Message Date
Zev Benjamin 3720cb1c33 Move message-related views into their own file
(imported from commit 2c71cc1b5d3f0210c98767888c461d5c6d046b49)
2014-01-10 21:38:59 -05:00
Tim Abbott 47500d8352 [schema] Add a bit for whether inactive users are mirror dummies.
(imported from commit bb21bb2c62ac09742484d7a4ca8907e7d864b982)
2014-01-09 11:08:35 -05:00
Jessica McKellar 8e3911269e Strip whitespace from emails before looking up DB entries in a few places.
(imported from commit eafdce98450d16c0ca51c4cb17a139811a6124bc)
2014-01-07 20:24:21 -05:00
Jessica McKellar a06b5bd720 [schema] Add a deactivated field to Realm.
(imported from commit 8b873296d45dbacc0865c8d101a872be0b65ed46)
2014-01-07 20:24:20 -05:00
Jessica McKellar 8091634814 Move sent_by_human check to a method on the Message class.
(imported from commit 2ef49051932f9633ad11130952591c5c5b147f12)
2013-12-31 16:42:38 -05:00
Tim Abbott 014b5e8a91 Add a per-request realm filters cache.
This avoids doing hundreds of memcached queries in get_old_messages.

(imported from commit 8b64cac3e4e91d46762a13d6812bd3c6f517e9ef)
2013-12-19 14:04:55 -05:00
Tim Abbott c91415f318 Improve names for per-request display recipient cache.
It incorrectly advertises itself as per-process.

(imported from commit faf7ca7374d020058e80249bb16a4c6afbcb3e44)
2013-12-19 14:04:55 -05:00
acrefoot 0fd492a817 [schema] Add enable_autoscroll_past_unread setting
This is for the CUSTOMER28 folks, so that they can turn Zulip into a more "chat client" thing.

(imported from commit 373a8afae4998fce5560e7b2bd13804c8fbb39fc)
2013-12-13 11:50:03 -05:00
Kevin Mehall e4589700b6 [schema] Modify device token to support both iOS and Android
This replaces the AppleDeviceToken table with a generic
PushDeviceToken with a `kind` field to make it easier to add functionality
like per-device/per-stream settings that share code between Android and
iOS devices.

The schema must continue to work on prod with the old table name, so we
add the new table in parallel and can drop the old table once this code
hits prod and any necessary data is copied.

(imported from commit 0209a7013f2850ac6311f23c3d6f92c65ffd19e3)
2013-12-11 15:37:47 -05:00
Leo Franchi 2c4efecee2 [schema] Add data model for managing realm filters via the database.
(imported from commit c624cdda9c23d9ca42706bf64b4c8a4e69e95c50)
2013-12-11 14:39:09 -05:00
Tim Abbott 1fb9c09f02 Don't import bugdown in models.py headings.
This allows us to avoid a circular import when importing models.py
from inside bugdown for the realm-filters-from-database branch.

(imported from commit 7de85b54243132ade6818b080abdc8c5e8ad84f5)
2013-12-11 14:39:09 -05:00
Tim Abbott 59e16feae1 Check whether realm exists in completely_open check.
(imported from commit 5294c4c7cdb6c03feb6bf716a3fc761dc7af1500)
2013-12-09 15:26:15 -05:00
Tim Abbott e56e892578 Enable public streams for most legacy realms.
(imported from commit 6844df2e14c624239d99a1d3fc25e55206c8c264)
2013-12-06 16:26:10 -05:00
Jessica McKellar 1b068d5433 [schema] add boolean field enable_digest_emails to UserProfile.
We'll use this to track the user preference for receiving digest
e-mails.

(imported from commit a56644b1a359444ded45f9437c954194b9ae47a1)
2013-12-02 18:58:03 -05:00
Leo Franchi 501f063426 Replace email_to_domain with split_email_to_domain and resolve_email_to_domain
Now that we support email aliases, we have to be careful when going from
an email address to a domain that we assume we can use to get a Realm
object for. When we care about the Realm's domain, we want to follow
any RealmAliases that exist for a certain domain.

When we just care about the original email address domain itself,
for comparison or other purposes, use split_email_from_domain

This removes the ambiguity of having to decide when to use
email_to_domain + RealmAlias or just email_to_domain

(imported from commit 0e199495502d946ce2e1aae56263e7e8665be4ed)
2013-11-26 10:45:01 -05:00
Zev Benjamin d2d695dcb6 Add an in-memory Client object cache
Client objects are immutable and there are very few of them, so caching them in
memory is cheap and saves a trip to memcached.

(imported from commit 300b9b402f4e509f86a7fd86b5f898dc3f43738f)
2013-11-20 16:55:10 -05:00
Jessica McKellar d1619b3f3c Use a more accurate "is admin?" check.
UserProfile.show_admin was intended to be a check for users that have
administrative rights in other realms, which we've harmlessly but
erroneously been using to check if they are an admin in their realm.

Use the more straightforward check instead, with a more intuitive
name.

(imported from commit d81050c7dbbb19e59c5e31750be303a4630e1456)
2013-11-19 14:31:02 -05:00
Steve Howell 220678ae40 Support emojis/bolding/etc. in single-line /me messages.
(imported from commit c62ae8cf26117e30a029e025021cc4a3a67f4a83)
2013-11-15 14:34:38 -05:00
Steve Howell ee28e5e2f6 Relax 80-char limit on status messages (/me).
(imported from commit e9de2cb6c394f5b764e988e279f0fb3cfd38c6e8)
2013-11-14 13:51:07 -08:00
acrefoot f7b5a10da0 [schema] Add ScheduledJob table, and update mandrill related code
ScheduledJobs with type Email displace the usual mandrill codepaths
in the Zulip Enterprise deploys

* Email-specific helper functions will appear in deliver_email.py
* 0058_auto__add_scheduledjob.py

(imported from commit 8db08d8a279600322acfdbed792dc1a676f7a0ab)
2013-11-13 16:41:36 -05:00
Leo Franchi 62ba16a829 [schema] Allow a realm to have aliases for multiple other domains
(imported from commit 5d0340afd4c77f50db63550a3ec8d81e885c285c)
2013-11-13 14:17:43 -05:00
Tim Abbott e18a08c69e settings: Move hardcoded API super users into local_settings.py.
(imported from commit fea7550a771c837db0fb948238488f778bedf73a)
2013-11-13 12:02:49 -05:00
Tim Abbott 5293cdebe8 Rename LOCAL_SERVER to ENTERPRISE.
(imported from commit 7edf353eefe6c9e7aac74b7bbc37b923cac1b913)
2013-11-12 15:57:01 -05:00
Steve Howell 56c39728ba Support /me syntax.
If a user types "/me runs to the store", we put "runs to the store"
in bold after their name.

(imported from commit fbc11e99244e1c8fa1c03e4753e706957fcd449e)
2013-11-12 10:49:10 -05:00
Luke Faraone 3daca0ca9c Fix rebasing errors that rightfully made the linter sad
(imported from commit fbed798c7d752ea2b058aeebb5ae31a620684a3a)
2013-11-05 17:52:53 -05:00
Luke Faraone c11b65590b SSO / REMOTE_USER support
(imported from commit 4f4fad7af5d3c6099cac95d7708338c182626d72)
2013-11-05 16:14:13 -05:00
Tim Abbott 68dcc760c3 Clean up some unused imports.
(imported from commit 0c5d8e2a55ba1b8909ba807fee3afe863dcdc226)
2013-11-04 11:51:17 -05:00
Tim Abbott 0ae03eb655 Remove transaction management hacks in get_client.
I'm pretty sure this code was a hack to workaround the fact that
without database-level autocommit, .get_or_create is racy.

(imported from commit bfdd476a354aee439feeaa0030ae59cc43c165b9)
2013-11-04 07:31:39 -05:00
Tim Abbott 2de31ee287 [schema] Remove the UserMessage.archived field.
This was a precursor to UserMessage.flags.read that never got used
because we decided to use django-bitfield.

(imported from commit 868754723c07ee9b85ae951aee785e571ccfef97)
2013-11-04 07:31:11 -05:00
Steve Howell 406c4f172a Add realm.get_admin_users() method.
(imported from commit b1cb465f0c81eb9f56ad1486b92cd39a8d001474)
2013-11-02 11:37:27 -04:00
Tim Abbott 1292c5dbfe Add backend support for Jabber mirroring.
(imported from commit 12f5c708a6961aded4f4e166af84e87720be4ddc)
2013-10-29 16:49:42 -04:00
Leo Franchi e1557bef73 Cache realm user basic info dict that is used in bugdown
(imported from commit 688c47daceb73534be90bd98a031c7b4edb5546e)
2013-10-28 12:59:36 -04:00
Waseem Daher 66f48288b4 Rename LOCALSERVER -> LOCAL_SERVER.
(imported from commit b3abdd10d54d2ad7a9c463af9a291d2e2127707f)
2013-10-25 17:37:06 -04:00
Luke Faraone 81d7dd1fda [schema] Support for authenticating Deployments via the API.
Here we introduce a new Django app, zilencer. The intent is to not have
this app enabled on LOCALSERVER instances, and for it to grow to include
all the functionality we want to have in our central server that isn't
relevant for local deployments.

Currently we have to modify functions in zerver/* to match; in the
future, it would be cool to have the relevant shared code broken out
into a separate library.

This commit inclues both the migration to create the models as well as a
data migration that (for non-LOCALSERVER) creates a single default
Deployment for zulip.com.

To apply this migration to your system, run:
   ./manage.py migrate zilencer

(imported from commit 86d5497ac120e03fa7f298a9cc08b192d5939b43)
2013-10-25 14:13:30 -04:00
Leo Franchi 05564ec0e2 [schema] Add a config option for enabling/disabling push notifications
(imported from commit 5649188cd5e0e4edb6e71559ec7d7fc5e92efaf8)
2013-10-24 14:54:30 -04:00
Leo Franchi 1d82704b8d [schema] Add a last_updated field to AppleDeviceToken
(imported from commit 2ea91e462773c50591585a610b0de63625ad2b7e)
2013-10-24 14:54:30 -04:00
Tim Abbott 1b381b343d Allow starring historical messages.
This has a small bug where we don't actually filter the message out of
the home view; fixing that requires adding an index on the "flags"
field of UserMessage.

(imported from commit 492c99d0a8e87b253e577be6564bec12099bd8e9)
2013-10-23 18:51:47 -04:00
Steve Howell 58acef4098 Add get_emails_from_user_ids() action.
(imported from commit 887090de16f685373bd2f3548bd1ec94a7ad4a9e)
2013-10-22 15:51:18 -04:00
Tim Abbott d58b4e92dd Add irc-bot@zulip.com as an API superuser.
(imported from commit 36aa0faf8c3ccd8454f214986f32da4f37236921)
2013-10-21 14:37:36 -04:00
Jessica McKellar 5c5ffd6ea3 [schema] Add a name field to zerver_realm.
(imported from commit 5b5d7a40d5dff11fe9ca6624b3794cb9c8a3520a)
2013-10-17 13:47:51 -04:00
Leo Franchi f7386c3f58 [schema] Add support for keeping track of iOS APNS device tokens
In order to support iOS Push Notifications, we need to keep track
of a device's unique APNS Token. These are delivered to our iOS
code after registering for remote notifications

(imported from commit bbe34483e1380dc20a1c93e3ffa1fcfdb9087e67)
2013-10-16 12:54:28 -04:00
Tim Abbott 32861af323 [schema] Increase maximum stream name length to 60.
(imported from commit 83e9434178909d18481692a9e7fe3b8e1802bd7e)
2013-10-15 09:13:35 -04:00
Luke Faraone 1d9391e867 Initial local server configuration.
(imported from commit ac9b9896b74b78c6ca03af7f411d0788ae402cff)
2013-10-10 14:14:14 -04:00
Jessica McKellar 836f3894fb Add a comment to UserProfile that pointer is a Message.id.
And NOT a UserMessage.id. I kept having to trace the code and convince
myself of this.

(imported from commit 720a982a888dd525e63c37ddfedd28b71492d32e)
2013-10-08 10:46:52 -04:00
Leo Franchi 72c7c5b836 [schema] Give new realms a default notifications stream, and send signups/creations to it
(imported from commit 19ad761f7d9eabb865ac3526bf66dff8b7ed0224)
2013-10-07 15:46:13 -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 eb299bf5c8 Extract Message.build_message_dict()
(imported from commit 03395ea8fbffd0a52f85127c9a24f0cc3f4a6969)
2013-09-30 18:22:07 -04:00
Steve Howell 2a3747e21f Isolate message side effects in Message.to_dict_uncached().
Only call a function on the message object in the unfortunate
situation that we are rendering new content in to_dict_uncached().
Long term, it would be nice if this function didn't have side
effects, and we had a better strategy for upgrading rendered
content when bugdown versions change.

(imported from commit 2a323f52af37a6d651c171cb8234fbfa3d25d561)
2013-09-30 18:22:07 -04:00
Steve Howell f65462c891 Extract Message.need_to_render_content()
(imported from commit 466fa133ed1e8fb13b7222ba3bdcd5773d63de14)
2013-09-30 18:22:07 -04:00
Steve Howell 95254398f2 Extract get_avatar_url().
This function doesn't require the whole UserProfile object to
create the avatar url, and we call it from Message.to_dict_uncached().

(imported from commit e814caab101c4fedd1ba66df041a3408014e4085)
2013-09-30 18:22:06 -04:00