Tim Abbott
7b968cd088
Revert "Revert "to_dict: Update rendered_content in the database after rendered.""
...
This reverts commit 745b4a98d0e3f67acaa207ba53e9250060dcfe06.
(imported from commit ea59de391b93b82b08c35d92620d7d8ae263f34d)
2013-03-28 07:36:10 -04:00
Tim Abbott
e8aa77c9b4
Set timeouts for our memcached caches.
...
The policy this implements is:
* 1 week for most persistent data (Clients, etc.)
* 1 day for messages
(imported from commit d57bb2c6b9626ffa2155c6d0ef9b60827d1f2381)
2013-03-28 07:36:10 -04:00
Tim Abbott
e2d010ef2d
Fix most unnecessary database queries in huddle creation.
...
This saves 2 database queries per user in the huddle when sending the
first message to a particular huddle.
(imported from commit f71aa32df846fb4b82651a93ff9608087ffcaa5a)
2013-03-28 07:36:10 -04:00
Tim Abbott
8b2cb6472b
Cache the lookup of Huddle objects by hash.
...
This is used in the send_message code path.
(imported from commit 4d9a4d079fe5b10b94c11016e9ec8c5601addc2c)
2013-03-27 12:59:24 -04:00
Tim Abbott
b2e76f50b9
Populate cache of Client objects on server restart.
...
(imported from commit 6d0ef309dadcd6c24fc9e17b0859becb053adccf)
2013-03-27 12:59:23 -04:00
Tim Abbott
a774598a10
Populate cache of Recipient objects on server restart.
...
(imported from commit 752851c7c3ee565201dd59fb0455c82a8885d42d)
2013-03-27 12:59:23 -04:00
Tim Abbott
4076704476
[django 1.5] models: Always return a string from __repr__() methods.
...
See http://bugs.python.org/issue5876 for an explanation for why this
is needed -- basically __repr__() needs to return a string, not a
unicode object in Python 2.
This causes problems on Django 1.5 because the more expressive
exception code in model.objects.get() will crash with a __repr__()
containing non-ascii unicode characters.
(imported from commit f44085e67d9d14629b821a29bbf65738f1794d6c)
2013-03-27 08:19:26 -04:00
Jessica McKellar
0c3382fabb
Always give hashlib.sha1 and friends bytes.
...
This fixes an experienced bug where you couldn't subscribe to a stream
with non-ASCII characters (failing with a UnicodeEncodeError), as well
as many other potential bugs.
(imported from commit f084a4b4b597b85935655097a7b5a163811c4d71)
2013-03-23 00:10:10 -04:00
Tim Abbott
a8febf8fce
Revert "to_dict: Update rendered_content in the database after rendered."
...
This reverts commit 4e5a370bc43defb5083cac3df45c649cf2366abf.
(imported from commit 745b4a98d0e3f67acaa207ba53e9250060dcfe06)
2013-03-21 10:30:23 -04:00
Jessica McKellar
37e58b613d
Truncate the tutorial stream name to fit the DB max stream name length.
...
(imported from commit e267656337f97d3ea14e14e957a405cf4fd2d06c)
2013-03-20 10:15:08 -04:00
Tim Abbott
02554b28cb
to_dict: Update rendered_content in the database after rendered.
...
This change could significantly load the database if pushed to prod at
the same time as:
send_message: Save rendered message content to the database.
goes out. So this should go out in a different prod push from that
commit.
(imported from commit 4e5a370bc43defb5083cac3df45c649cf2366abf)
2013-03-20 07:34:10 -04:00
Tim Abbott
17e9e56899
Fix get_stream caching the DoesNotExist value of None.
...
(imported from commit bdef7438758517ba9083ecc8bf110e3caa1ec041)
2013-03-19 11:17:31 -04:00
Tim Abbott
9977cdde54
send_message: Save rendered message content to the database.
...
(imported from commit e5bd224687d5420f556b341286f03d3829973a3c)
2013-03-19 08:09:26 -04:00
Tim Abbott
bb80d1c58c
Move check_send_message and helpers to actions.py.
...
(imported from commit d74c90e25bd63931955d2ad9b3890be53d674a48)
2013-03-18 16:15:11 -04:00
Tim Abbott
a23f6be28d
Cache the results of Recipient queries in our memcached cache.
...
(imported from commit a6ba25a9c62d2738e4738b076370e4b2bc0ffaba)
2013-03-18 16:15:10 -04:00
Tim Abbott
3c143db01a
Add memcached caching for get_stream lookups.
...
(imported from commit a089c8a99eaa1fa28ce401859cac1bdf0eb92a69)
2013-03-18 16:15:10 -04:00
Tim Abbott
c0fece1cbd
get_stream: Fetch the realm object as well.
...
(imported from commit 065ae574cb933cfc48371efd4327e70d37184dd4)
2013-03-18 16:15:10 -04:00
Tim Abbott
1e6ed16c23
Flush the User cache when saving User objects too.
...
(imported from commit e595209fe1190e2f3e0d55ad3b9bae0997b91d1a)
2013-03-15 18:09:34 -04:00
Tim Abbott
b6f42cb1e1
Update UserProfile objects in memcached when we save them.
...
(imported from commit 59426e19eeeba131f363a4bc5f74f59b6dbe1066)
2013-03-15 18:09:33 -04:00
Leo Franchi
93a3f14c43
Add backend support for handling new 'read' message flag
...
(imported from commit 6194e9332caa2d279cbc304f0d6a69f969aa9a72)
2013-03-13 14:14:45 -04:00
Leo Franchi
6a53d1c35d
Add flags to dict in load_old_messages
...
(imported from commit 7f68ea97a424aa0b01983258dbf6e9a2a07a732a)
2013-03-13 14:14:45 -04:00
Leo Franchi
a678ef2af8
Add flags field on UserMessage, created by previous south migration
...
(imported from commit e839a3871d27cd7082ecbc84946216143d373da0)
2013-03-13 14:14:45 -04:00
Tim Abbott
254bc9f361
Attempt to render messages before accepting them from the user.
...
This fixes trac #407 .
(imported from commit e33647eec32266790f864d14ad377d51956d2a6f)
2013-03-08 17:24:33 -05:00
Tim Abbott
2f022ebb34
bugdown: Allow caller of convert to tell whether we succeeded.
...
(imported from commit 9e3cab73e0d9e9ad31ba770210e535584cca3bb2)
2013-03-08 17:24:33 -05:00
Jeff Arnold
fcd033e33e
[schema] Save enter_sends on the server in the database.
...
(imported from commit 4d82f6aaf5918f155a930253c9cc334dbcc0d97a)
2013-02-27 17:25:29 -05:00
Leo Franchi
982a3fda9a
Only ignore website messages from user when calculating unread counts
...
(imported from commit 95bd6f8c2ce0ad1f5d59e311107f81e4b07b33dc)
2013-02-21 15:05:59 -05:00
Keegan McAllister
2a556fd002
Re-enable markup for CUSTOMER1
...
(imported from commit 3d74260796c85216d71d8261020cc149e0b6ce1c)
2013-02-12 17:09:47 -05:00
Leo Franchi
31f87481d0
[manual][schema] Add an API for user presence (idle) information
...
Adds a new db table for storing presences, and an API for setting
an individual user's idleness as well as fetching all idle status
for all users in a realm
(imported from commit 5aad3510d4c90c49470c130d6dfa80f0d36b0057)
2013-02-11 18:05:57 -05:00
Jessica McKellar
8d06143115
[manual][schema] Add a restricted_to_domain bit on realms.
...
Default True; if False, arbitrary e-mail addresses can use your realm.
(imported from commit 6eec7516a535429cbaa74f6348651feef73cacd6)
2013-02-08 13:16:35 -05:00
Luke Faraone
cb5c9ed047
[schema] Add new boolean field in_home_view to Subscriptions
...
This is part of the Oppa Gmail Style proposed by Waseem.
(imported from commit 0663889bcb1f691842f69d243fd4ac0e4e3e0868)
2013-02-05 15:34:03 -05:00
Jessica McKellar
a8a5d0b511
Strip whitespace before looking up a stream name with get_stream.
...
This came up when I tried to subscribe myself to an existing stream
name but with leading whitespace added; the get_subscribers request
failed with a 400.
(imported from commit 03fe370d1e80fd7e8c282f260e63b7e5ada05960)
2013-02-05 10:01:45 -05:00
Leo Franchi
7e567f527f
Move gather_subscriptions to actions.py as it's not a view
...
(imported from commit cdf94ded51e441fe3515641458023be44c1ba40c)
2013-01-28 17:32:58 -05:00
Leo Franchi
7d05450411
[schema][manual] Add schema invite_only flag for streams
...
(imported from commit 6234b67b3c72912bf40e39007bbc884d20774806)
2013-01-24 17:34:21 -05:00
Tim Abbott
8cb8c0065c
Move get_stream to models.py and accept an id for the realm argument.
...
(imported from commit 7ce09b7ed450cfa3ddf1de22bbb0b19abfc4a2a2)
2013-01-17 16:20:18 -05:00
Reid Barton
7b7f6390f9
Add a notion of "public" stream
...
A public stream is one for which any user can view all messages sent
to the stream, regardless of whether the user was subscribed when
those messages were sent.
For now, to avoid a database schema change and to facilitate testing,
public streams are all streams on the customer29.invalid or
humbughq.com realms.
(imported from commit 7a71fd788d585a6f5b3e494e771ec85b632bb36e)
2013-01-16 14:19:05 -05:00
Luke Faraone
22a4b76290
[manual] [schema] Add backend function to invite users to the app.
...
(imported from commit 17ae27b22bdca33e63b96fa8c819759e4f4315fa)
2013-01-14 10:25:25 -05:00
Tim Abbott
e36fd4b817
tornado: Send rendered messages to Tornado via memcached.
...
(imported from commit c1e8a017fa61b4e3f5c44ad4e5f59e4faf012ca3)
2013-01-11 16:11:07 -05:00
Tim Abbott
1a82741650
Move action functions from models.py to zephyr/lib/actions.py.
...
(imported from commit 9d577dd53ce7d4c9faf6cc8a56129d684a50811b)
2013-01-11 16:11:03 -05:00
Tim Abbott
761b7cd5fa
Rename zephyr.lib.time to zephyr.lib.timestamp.
...
Otherwise one gets:
AttributeError: 'module' object has no attribute 'time'
when trying to use the time module from inside zephyr.lib.
(imported from commit 645368672a3eff68320278dd480edeed56721fcc)
2013-01-11 15:58:19 -05:00
Tim Abbott
bd05bdd777
Cache client objects in get_client.
...
This should remove a database query invoked from Tornado by our
decorators in the common case.
We use hashlib.sha1() on the key because memcached doesn't support
keys with whitespace in them.
(imported from commit 351ef4c76bc68e2d53f0e7ddca91dcf95e7bb2a6)
2013-01-10 16:59:36 -05:00
Tim Abbott
3c10a2e6a0
Move bulk_create_* methods to bulk_create.py.
...
(imported from commit 30d5f86209f9c8807516f0440276fafeb6590c1a)
2013-01-10 16:59:36 -05:00
Tim Abbott
21c2317bd2
Move callbacks library to tornadoviews.py.
...
(imported from commit a4e545d82133ae9dc34e283e3bf268225e35f400)
2013-01-10 16:59:36 -05:00
Tim Abbott
e7b74060d2
Log password change events via the password reset feature.
...
(imported from commit bbec7074229e8779c81d439d4eef373b5dac9fa7)
2012-12-13 15:22:35 -05:00
Tim Abbott
7cebbd4a52
Add datetime_to_timestamp library function.
...
(imported from commit 28466ac5c8fc406ec70a61cae5975a784eb0f238)
2012-12-12 15:45:37 -05:00
Tim Abbott
c21535d420
models: Create database indexes on auxiliary Message fields.
...
I suspect we'll want these for narrowing code at some point.
(imported from commit d2077aa4d7a6967bb4cb7d9404a4db4fcf824343)
2012-12-11 17:17:38 -05:00
Tim Abbott
4dae30e750
Re-enable markdown for all realms but CUSTOMER1Labs.
...
(imported from commit 51e770b50e8c678c245d099dc9177aa49ecb5084)
2012-12-11 12:04:46 -05:00
Zev Benjamin
ebb9cfa65d
Re-enable markdown rendering for API users and the github bot
...
(imported from commit 31db13ef8b7e5224a07f784247092e2eb9cd1654)
2012-12-11 12:02:05 -05:00
Tim Abbott
100df7e349
Add a maximum message length of 10000 characters.
...
(imported from commit a07c872d612521c9792be8dc704a9cfd6c752c75)
2012-12-11 11:33:40 -05:00
Luke Faraone
b9b7d1b8f1
Linebreak zephyrs.
...
(imported from commit c77499b17ce195e36169bcb39a5f5bdfe6a3ce51)
2012-12-10 15:45:04 -05:00
Tim Abbott
6cff3dc735
models: Disable markdown (escaping instead) for now.
...
(imported from commit e92920919cd5d0ef11a478be5a0f8a108b62fff9)
2012-12-10 15:23:57 -05:00