Commit Graph

342 Commits

Author SHA1 Message Date
Tim Abbott 16ffd539af Fix computation of original pre-editing message contents.
(imported from commit ebbdc2580cd502bfb2fb07fa144ab6f815b960e7)
2013-06-06 14:18:49 -04:00
Tim Abbott 871e1b65d3 Don't highlight message edit diffs on prod for now.
(imported from commit 2bfba46c42216f5b4e83098f22291a089d527d7d)
2013-06-06 10:40:17 -04:00
Tim Abbott 0ad1094e45 bugdown: Add custom per-realm filters to linkify certain strings.
I've tried to do this in a way that's scalable and easily configured,
so that we can add new such filters for customers on-demand without
needing to add anything other than a bit of configuration.

Once we're confident in the arguments to this system, I think we'll
want to move the regular expression lists into the database so that we
don't need to do a prod push to modify the regular expression lists.

The initial set of regular expressions are:
(1) Linkifying e.g. "trac #224" in the Humbug realm, so we're exercising this code.
(2) The various ticket number things CUSTOMER7 uses for the CUSTOMER7 realm.

(imported from commit 992b0937b9012c15a7c2f585eb0aacb221c52e01)
2013-06-05 17:48:21 -04:00
Leo Franchi b815d7ea83 Properly calculate expiry of keys we add to Redis
(imported from commit 42fda34ed1cd1eb9411defa1c0cbf53ef0de7a7b)
2013-06-05 16:49:30 -04:00
Zev Benjamin 2f7f0da27f Use a per-deployment memcached key prefix
Some cache keys used by Django (like sessions) will not have the key
prefixes, but those values shouldn't change across most restarts.

(imported from commit 2fe61028111fe9d5700432214a611b3341412654)
2013-06-05 16:33:43 -04:00
Zev Benjamin 826b895a2c Avoid using djcache directly
(imported from commit 2a8f0135c7e31ecc30628420e521c8f708c656c5)
2013-06-05 16:33:43 -04:00
Leo Franchi 92256ab48f Add a TESTING_DEPLOYED settings key, and don't send stats for it
(imported from commit cd73317814a240f7df180f546a9eb6937bb368bb)
2013-06-05 12:57:47 -04:00
Zev Benjamin 4bf3cf1c67 Fix whitespace
(imported from commit 27ad5cda6ce439f81fb0ab231ef43303f2d70736)
2013-06-04 19:33:20 -04:00
Zev Benjamin 5a1f036db3 Use Diff Match Patch instead of difflib for HTML diffing
Diff Match Patch provides more human-readable diffs.  For example,
try replacing "mouse" with "sofas".

(imported from commit 7ced81202ce85d5ef69888c59912e3e44c38cfc8)
2013-06-04 18:18:36 -04:00
Zev Benjamin 0c20f48636 Show changes to edited messages using color highlighting
I didn't use red and green for fear of it not being visible to
color-blind users.  We may need to tweak the colors.

(imported from commit 59c4f1dac549a248783e4c3b3ec472d8cb690df5)
2013-06-04 18:15:45 -04:00
Zev Benjamin df53f54cbd Add library to diff HTML fragments and mark changes
I would really like to parse the HTML we produce from the library to
ensure that we don't generate malformed-HTML.  This is unfortunately
hard because we both want pretty strict parsing and we want to parse
html5 fragments.  For now, we just do a basic sanity check.

We also may want to switch to Google Diff-Match-Patch, as that can
clean up the resulting diffs.

(imported from commit 3772f92135cfd7423c335335f861f2c11462a8db)
2013-06-04 18:15:45 -04:00
Leo Franchi 0b5b1dafc4 Add a rate limiting system to our backend
(imported from commit a1218618918b4dedc77307e2f277665e7dd8fa22)
2013-06-04 09:43:09 -04:00
Jessica McKellar a63b0e31a7 Say if a realm is open in the internal signups Humbug.
(imported from commit 5745f3b2fbfbbdc2681628ef1ccb637cc1abb9f3)
2013-06-02 15:12:28 -04:00
Jessica McKellar 79d494282d Use a case-insensitive wrapper around retrieving a realm by its domain.
We were previously able to create realms for different casings of the
same domain.

(imported from commit c13a86c9eb9fb4934bebcda7a578e2a071dd1962)
2013-06-02 15:12:28 -04:00
Jessica McKellar 83a8ed048f Remove unused imports in zephyr/lib/.
(imported from commit 54fa64f34d29ede939d18f3834249b7bff4490e5)
2013-06-02 15:12:27 -04:00
Jessica McKellar 048a53c1ce Make do_create_realm aware of restricted_to_domain.
(imported from commit bee8d79cd5f5d4165e2a573eb3a91123857be6cd)
2013-06-02 15:12:27 -04:00
Jessica McKellar 67a25614df Remove unused reply argument to do_create_realm.
(imported from commit 6f56c0748a989a8d7163d20f6d9d243c8d96ce87)
2013-06-02 15:12:27 -04:00
Leo Franchi a906e1609d Remove 'PM' from missed message subject as we also email you on @-notifications
(imported from commit 0993bae5b6a1e40b462a314c41bd5c2d47b4bc8c)
2013-05-31 15:54:57 -04:00
Steve Howell 303b8174ac Fix trailing whitespace in a couple Python files.
(imported from commit a8338773aa4ff10add6f06c699b395890b9ed3ee)
2013-05-31 15:25:35 -04:00
Leo Franchi 56af48cd50 Split wildcard mentions from personal mentions, only email on personals
(imported from commit 18971d9e40dd2c93ef9c30edc963da33e3c65309)
2013-05-31 12:24:31 -04:00
Tim Abbott 47b4283c4b Only use numbers and letters in our API keys.
(imported from commit f845fd092695286b83a2e4c9a5708df778c5b770)
2013-05-30 16:42:14 -04:00
Keegan McAllister 371d0dbaa0 Identify app.js source map using a special comment
If we're going to minify third party code, the size heuristic may not hold
anymore.

(imported from commit 78ada1fee1446e78b3b1ad299ee3e975d1cd9002)
2013-05-30 13:51:46 -04:00
Keegan McAllister 5aafdc7cf9 Set input language for Closure Compiler to ECMAScript 5
Some of the third-party files use constructs not valid in ECMAScript 3 (the
default).

(imported from commit 9292bf23a4860353944c18a6f413b4828cc63e11)
2013-05-30 13:51:46 -04:00
Tim Abbott 2b1799b71c bugdown: Fix handling of twitter-format links that aren't actually tweets.
(imported from commit 60512147d8d303ff07cf1e86306fd14b1490e708)
2013-05-30 10:29:41 -04:00
Tim Abbott abd9e4e635 Use proper randomization when generating new API keys.
Previously we were generating API keys deterministically using a hash
of the user's email address; this is clearly not a good long-term
approach.

(imported from commit 14d0c7c9edbc45b3ae1d17a43765ad9726338d4d)
2013-05-29 15:11:24 -04:00
Leo Franchi 81bb2603eb Replace statsd.py with a call to statsd
(imported from commit 086b9c565b0e3bc88aa3dcd0fb76024ec21d8556)
2013-05-29 09:59:28 -04:00
Leo Franchi bd921c6a04 Allow mentions in PMs
(imported from commit 4d354eb3abb153706a577312724fa40fd2559f92)
2013-05-29 09:48:14 -04:00
Tim Abbott 2de2491021 Disabled embed.ly support, for now.
We get too many error reports from it, which is bad for us actually
fixing the other errors that we do have.

(imported from commit 8442fe4251adb15a01b4e61ebcd07bc270b08631)
2013-05-28 11:50:56 -04:00
Leo Franchi c528e3d960 Handle multiple users with the same fullname or shortname in @-completions
(imported from commit 3d60b657ae975e5dcdfc383f431eb8c8dee2c40a)
2013-05-28 10:17:05 -04:00
Leo Franchi d25d52cf00 Batch messages into logical groups in emails, like the web interface
(imported from commit 5c771f7aafc3972c8f0dd1dc329535233f01ee7a)
2013-05-24 21:23:59 -04:00
Leo Franchi 65b247edec Add a event_queue gc hook for missed messages
(imported from commit a799abb35a9622e6aa59e9499cab3281ccb6859f)
2013-05-24 21:23:59 -04:00
Leo Franchi 81058f5f9b Reset our 24hr email blackout when a user logs in
(imported from commit 93bed7c4d049ba4d7b30d2e02fbbe0d2debca6f8)
2013-05-24 21:23:59 -04:00
Leo Franchi e5b1e16885 [schema] Make last_reminder field nullable
(imported from commit e7d14c222d64ac317fc96d0c6bb17220aa6ba097)
2013-05-24 21:23:58 -04:00
Leo Franchi 1a0eefdaa5 Send missed message email on @-notifications
(imported from commit 4c29662ae45fd5e5932b5a6029b90afc7efbbd09)
2013-05-24 21:23:58 -04:00
Leo Franchi b548538a98 [manual] Send UserMessage flags in get_events updates
This commit must be deployed in a separate step from the previous [manual]
commit

(imported from commit c6f00e217062790fce8380f61f82ea8824fb3722)
2013-05-24 21:23:58 -04:00
Leo Franchi 3c81664641 Calculate mentions in a message server-side, and save as UserMessage flag
(imported from commit a3a868a8c6f48b68010108e0ec18ca65b7f0d498)
2013-05-24 21:23:58 -04:00
acrefoot 9454683108 [manual] Send new-stream invitations using a bulk database query
Messages that get sent out when someone subscribes many people to a new stream each
cause individual database queries (and their associated transactions). With the patched
bulk_create (which sets the .id on created objects), we can reduce this query down to a constant
number of queries on the Message and UserMessage tables.

Note for deployment (local dev, staging and prod):
you must be running a patched django, found here: https://github.com/acrefoot/django/branches
use this branch: acrefoot-bulk_create_with_id-1.5.1
on acrefoot-bulk_create_with_id-1.5.1
relevant sha1: ac6d885b811f7e2e34f0db0da217983f7dfd357f

(imported from commit b0dab9dac784d3ff47751e65bf22c2dddc22edf5)
2013-05-24 21:23:57 -04:00
Tim Abbott 5d61e32d25 message_edit: Store rendered content and rendered content version.
(imported from commit 5ddc18a19ff945ed327e4cc03a8183bbfd190c9b)
2013-05-24 21:23:56 -04:00
Tim Abbott 8479b4f0cd [schema] Record and display whether a message was edited.
We also record the historical edits to the message in this JSON format:

 [{"prev_content": "new test message 14", "timestamp": 1369157249},
  {"prev_content": "new test message 13", "timestamp": 1369157118}]

but we don't actually do anything with the information as of yet.

(imported from commit 2d5ca449b87b33ad035ab0e076a22e150c8e7267)
2013-05-24 21:23:55 -04:00
Tim Abbott c98b37550e Record how much time is spent in the markdown parser.
(imported from commit c382f4f88ae253a47e05b3d15c6d21bc0cbb2bb7)
2013-05-22 14:41:57 -04:00
Tim Abbott 5b8dc0d09a Unify our various link processors into a single processor.
There was no benefit to our various link processors all doing
independent scans through the list of messages, and this makes it much
easier to understand the logic of how each link will be handled, and
also makes policies like "don't process links if there are more than 5
of then" easier to implement coherently.

(imported from commit 4affdeab889ba89b99eec905fdf871e78bbc3dd4)
2013-05-22 13:43:20 -04:00
Zev Benjamin 22e2eb3305 Use different mixpanel tokens while deployed vs in development
(imported from commit 4fac466a822d49cb0e1a7592dbd77d8ee019803e)
2013-05-21 17:56:49 -04:00
Zev Benjamin ae9be7298d Wrap render_to_response
(imported from commit d23aa3e5ad4c5243e83df098953ea4b1f7b3c294)
2013-05-21 17:56:49 -04:00
Tim Abbott d467a93877 Add support for updating messages after they've been received.
Currently the interface for editing messages is limited to a
command-line API tool; it's great for testing with e.g.:

./api/examples/edit-message --message=348135 --content="test $(date +%s)" --site=http://localhost:9991 --subject="test"

The next commit will add a user interface for actually doing the editing.

(imported from commit bdd408cec2946f31c2292e44f724f96ed5938791)
2013-05-20 23:40:26 -04:00
Tim Abbott 56949b4788 Create subscription objects in bulk by user_profile.
This, combined with acrefoot's work on sending the notifications in
bulk, resolves trac #1142 -- we do only 10 database queries and the
whole operation completes in about 300ms on my laptop.

(imported from commit 36b5bb836bc6c713903d1ca72e39af87775dc469)
2013-05-20 23:29:54 -04:00
Tim Abbott c325794f3c Send Markdown parser failures to the errors stream.
(imported from commit 8638744ec45d6505fe3a7be87df0a70943f23996)
2013-05-20 23:29:54 -04:00
Luke Faraone 1bb9def157 Only contact embed.ly if we have items that are not cached to fetch.
(imported from commit 8016d1f5dac6a75ced63bec8f0f11d9e4020cccb)
2013-05-14 08:00:37 -07:00
Tim Abbott a4c5c24029 Use the event system to sync onboarding steps across browser tabs.
(imported from commit 29311390133aca8f3a3d79fbe06dbbcabc4fb6ea)
2013-05-14 10:27:40 -04:00
Jessica McKellar 76a57e78ed Enumerate onboarding steps client-side, and give a way to update them.
(imported from commit 0a993976e898cdb20ebb814a19d520572ef8b7e6)
2013-05-14 10:27:39 -04:00
Jessica McKellar 24bb8ad797 onboarding: give new users a list of uncompleted onboarding steps.
(imported from commit 068a6e2112db98965ec5a1c5fc69a9fe285c0333)
2013-05-14 10:27:39 -04:00