Commit Graph

351 Commits

Author SHA1 Message Date
Steve Howell b896c587e2 Extracted S3-related code to lib/upload.py
(imported from commit 4f0b0012b89d21b3bd445a2a6f84f3de72190e13)
2013-06-19 18:10:45 -04:00
Steve Howell 2b320f8d57 Allow user to upload an image for their bot's avatar (back end).
(imported from commit 34833b61b935f4eec2b23abbb3532aaa58e13fb6)
2013-06-19 10:21:20 -04:00
Zev Benjamin 80702ccaa0 Add metrics variables to the template context via a context processor
Wrapping render_to_response never actually worked correctly.  On the
login page, mixpanel_token would be missing, but we wouldn't get an
error because it is surrounded by double quotes, which meant that it
was still valid Javascript.

(imported from commit 820ee42fab8f679983e5a3a4309a2feaf690f20f)
2013-06-18 17:07:36 -04:00
Kevin Mehall 334424ae79 bugdown: TLD and parentheses shouldn't make it a link. Trac #1364
(imported from commit d4da7ec080a6a8362b6370ced9ddc10d52443452)
2013-06-17 10:08:13 -04:00
Leo Franchi 625f8427e6 Return both subscribed and unsubscribed stream information when listing streams
(imported from commit 0aee84712eefd93aebc1041b371e471182eb7e9b)
2013-06-13 10:06:34 -04:00
Steve Howell d740d7c082 Show user-uploaded avatars on the website.
Show user-uploaded avatars on the website for users who have
UserProfile.avatar_source == 'U'.  (Continue to show gravatars
for other users.)  This includes the home page, the visible-phone
div, and the settings page.

This fix does NOT address a few things:
* There is no GUI to actually upload user images yet on the website.
* The !gravatar syntax in bugdown will continue to show gravatar images
  only.
* We are not changing identicon behavior.

(imported from commit 9f5ac0bbe21ba56528048233aab2430e4dd431aa)
2013-06-12 15:34:51 -04:00
Zev Benjamin 03b40d180c Add logging filter for checking that the app is actually deployed
(imported from commit 77bd7e008fdea4033e18a91d206999f9714e0f74)
2013-06-10 14:59:29 -04:00
Zev Benjamin 7d999160ab Move logging rate-limiting code
The new file can't be called logging.py because then it would be
annoying to import the system logging module within it.

(imported from commit 71d116e4be98d45b09dda049a43142a82647b727)
2013-06-10 14:59:29 -04:00
Leo Franchi f4132ace48 Fix bankruptcy event sent to graphite
(imported from commit b016ab41ddc2636b76a49c9eb33b7becd387557d)
2013-06-10 09:17:43 -04:00
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