Commit Graph

340 Commits

Author SHA1 Message Date
Tim Abbott 53e06a0bb5 Use rest_dispatch for accessing Tornado URLs.
(imported from commit f129f5e3dc9e83f40fa9ea1b95d97a9b9f5a6831)
2013-07-30 17:59:46 -04:00
Steve Howell 032415fcb4 Move bot avatar code to avatar.js (from settings.js).
This step of the refactoring really just moves the code.

(imported from commit 4d551c43d25723b2556448f47b6b61228e782f54)
2013-07-30 08:40:49 -04:00
Scott Feeney 6f0530ec46 Include Underscore in our "common" js bundle
This way it can be used throughout our JS, not just inside the app
proper.

(imported from commit 2bd97534cb7a3e433918747f0e397786fdfc4d2b)
2013-07-29 15:33:23 -04:00
Steve Howell 09bd52fff4 [third] Add underscore.js
(imported from commit ee17cc1d1dff2a6f816a81bb33fa04ca5562a441)
2013-07-29 13:47:56 -04:00
Tim Abbott 3bba0cc927 Move zephyr/static to just static.
It's not really a part of the server (aka the rest of zephyr/).

(imported from commit 27f6b6b064938ad927075a68d873e4b68710d279)
2013-07-29 12:11:26 -04:00
Tim Abbott 1e71d91455 Fix pipeline configuration for development environments.
Our code happened to work under python-django-pipeline <=1.2.7, but
newer versions correctly looks whether the files exist under
STATIC_ROOT, so we need to set STATIC_ROOT correctly.

(imported from commit ef48a75e0f6a4adae742dd1fd386a48e630f1850)
2013-07-29 12:10:54 -04:00
Tim Abbott ffc2f05cbb Rename zephyr.css to zulip.css.
(imported from commit 094580c1563fa05ecff58d6fb86bf2338a32b1a6)
2013-07-29 12:10:54 -04:00
Tim Abbott ab74c5d0d2 Add error handling for process_user_activity bot.
(imported from commit 367e2c76d1d6de634bbbb70c9b1c1b8c82027c9e)
2013-07-26 16:06:59 -04:00
Steve Howell 625003cbe1 Nudge pointer past visited msgs when coming home.
When you return to Home, we normally restore your last
position when in Home, which might have been before the
first unread message.  This is cumbersome for sidebar readers,
so now we keep track of messages that you visit while on a
tour away from Home, and when you return Home, we skip forward
any messages that were in the tour, landing on the last visited
message.  This all happens before rendering.

(imported from commit 9124a231d94f153e283e5ea95e40c50a58406275)
2013-07-26 14:03:55 -04:00
Steve Howell a393de2122 Support /bots/[email]/api_key/regenerate
(imported from commit 740ce4813969e45a4673b5419ba9e622acfa401d)
2013-07-25 12:41:52 -04:00
Steve Howell 25a8d5fadd Create back end for patching bots.
(imported from commit 189444d79bb7832b26f3e9c1b65da260122255bd)
2013-07-25 12:41:52 -04:00
Steve Howell fad259d75d Move code from hotkey.js -> navigate.js.
Created up, down, page_up, page_down, to_home, and to_home pretty
mechanically from the old hotkey.code.

(imported from commit 5956b91c2e0122c6440f70db9b92f918c9b599aa)
2013-07-24 23:39:35 -04:00
Kevin Mehall eb6bc91c22 New Relic integration
(imported from commit a108f4c6e90d857263453036f6d5f09279302b7e)
2013-07-24 17:19:36 -04:00
Tim Abbott 9132baacc2 Update settings.py for our current app server hostnames.
(imported from commit a8f72faf2c0204c2e86d641da5eb81b57e935183)
2013-07-23 14:26:33 -04:00
Waseem Daher 32fd11c74c Restore "Font Awesome" inclusion in the portico.
(imported from commit 0e49205a995d4b52ab1170eaf96b49d4cab47515)
2013-07-23 13:38:20 -04:00
Jessica McKellar 4d19c784d8 Switch from the @humbughq.com to @zulip.com addresses users can contact.
In particular support@ and jobs@.

(imported from commit 8051ae5628b7378cde49b160d26b704e7e14bb24)
2013-07-15 17:49:00 -04:00
Luke Faraone bb0a7c8fc3 [manual] Switch various configuration files to refer to .zulip.net.
We only want to change cases where we're talking about the hostname; HTTP
requests should still go to staging.humbughq.com for now.

Before this commit is deployed the hostname of staging.humbughq.com should
be changed to staging.zulip.net on the VM.

(the same for prod)

(imported from commit 7412530773f720ac227f40061c9ddb1a851e19bb)
2013-07-15 16:49:55 -04:00
Leo Franchi e5b855d883 Add a bulk invite page for the first user in a realm
(imported from commit cf85c9d475209da4591e2f06f142008fb19ac9d5)
2013-07-12 13:07:02 -04:00
Scott Feeney 2c33320746 Reuse minified JS from previous deploys
This is a big change affecting lots of areas:

* Pipeline no longer deals with JS (though it still minifies CSS)
* A new script, tools/minify-js (called from update-prod-static),
  minifies JavaScripts
* A command-line argument --prev-deploy, if passed to minify-js or
  update-prod-static, is used to copy minified JS from a previous
  deploy (i.e., a previous git checkout), if the source files have
  not changed
* update-deployment passes --prev-deploy
* Scripts are now included with the minified_js template tag, rather
  than Pipeline's compressed_js

Also, as a side benefit of this commit, our Handlebars templates will
no longer be copied into prod-static/ and accessible in production.

Unminification is probably broken, but, per Zev and Trac ticket #1377,
it wasn't working perfectly before this change either.

(Based on code review, this commit has been revised to:
 * Warn if git returns an error in minify-js
 * Add missing output redirects in update-prod-static
 * Use DEPLOY_ROOT instead of manually constructing that directory
 * Use old style formatting)

(imported from commit e67722ea252756db8519d5c0bd6a421d59374185)
2013-07-12 11:59:04 -04:00
Scott Feeney c42bf9b9b2 Refactor popovers into their own file
(imported from commit 36ad3c61e4d7eb05751f9b886d15edceab656d71)
2013-07-08 18:53:03 -04:00
Luke Faraone 2c83d015a9 Refactor bot deactivation view to cover all users and expose via REST
(imported from commit 9f7afb3b43ed14db0bb4217dbae4114846bb840b)
2013-07-08 18:00:28 -04:00
Luke Faraone 9a866ce5be [schema] [manual] Add django-guardian to INSTALLED_APPS
On a Debian/Ubuntu system with the Ops repo installed, you can add this
dependency by running:
    sudo apt-get install python-django-guardian

We use a slightly modified version of the package, so users of other
systems should manually download the source from my GitHub fork and
install it as they would any other Python library:
    https://github.com/lfaraone/django-guardian/archive/lfaraone-noanon.zip

guardian uses South for migrations. To apply the guardian schema to your
database, run:
    python manage.py migrate guardian

(imported from commit 12eaf4ded91e180c3245a44bacfb5b98b660147d)
2013-07-08 17:07:55 -04:00
acrefoot fdb597b4d3 v1 Emoji autocomplete
(imported from commit 0b0d4b004936ce4abc37f44317aec414451f3a8e)
2013-07-08 15:26:39 -04:00
Luke Faraone ddf0189307 Make REST API urls available under /json/
Now we can begin the transition of the app to the same interface that our
API clients use.

(imported from commit 5b5001237722692f27f5de687f01d97fa0b87ed0)
2013-07-08 14:30:20 -04:00
Steve Howell 75ac44f9f3 Support deactivate_bot API.
(imported from commit 41eece8bf69a930e02eb4c0208cf25b5c283da16)
2013-07-05 14:09:32 -04:00
Steve Howell edc718951c Use same CACHES/SESSION_ENGINE settings in dev as in prod.
(imported from commit d45ec576bd0a87b9da0c1a7f7e0a002091d728ff)
2013-07-03 13:31:27 -04:00
Jessica McKellar 46afe3be69 views: remove now-unused tutorial message sending capabilities.
(imported from commit 65d14bf469f64b47cf682f4fb36946c6d841eebd)
2013-07-02 18:26:17 -04:00
Steve Howell 9e64750083 Use memcache in the test suite.
This uses a new configuration that enables memcache, but we have
to be careful to bounce KEY_PREFIX on every new test, since data
gets rolled back in the databases between tests, but not in
memcached.  We had to break up one test to work around UserProfile
objects actually being cached.

(imported from commit f201cf9cd9e0e4c61d3c384fa8d2bbd5134161e8)
2013-07-02 16:50:10 -04:00
Luke Faraone b1b2af9b2a Add ZULIP.COM and subdomains to ALLOWED_HOSTS
(imported from commit 94e28b5973f4d83ee4f63dbae7c8def0c36b9160)
2013-07-02 11:21:43 -04:00
Luke Faraone cf81c46c77 Omit fonts.css on QtWebKit clients
QTBUG-3467 prevents non-normal-face @font-face fonts from being used when
defined as such in CSS. To work around this, the desktop applications now
ship the Humbug font themselves, and this commit causes the server to no
longer send the problematic CSS rules to those clients.

We have some duplication insofar as we now have two minified CSS files, but
this is better than conditionally applying the CSS at page runtime.

(imported from commit 9a887f9fb8002d44171d366d1249ebbf21cc9c77)
2013-07-01 14:37:58 -04:00
Steve Howell 0da7ead83d Add FormData shim for IE (used in bot avatar uploads).
(imported from commit 41cd090768c1299db3ca0d154ee5495802302a9f)
2013-07-01 11:27:36 -04:00
Scott Feeney 83cd963c49 Remove unused imports
(imported from commit 9e3050c72a2d1137b9096c6cfa1c3945341b9a56)
2013-06-27 16:22:39 -04:00
Steve Howell 660ee6571d Disable embedly everywhere.
(Before it had been disabled only on prod/staging, but we are
removing it everywhere, motivated by making tests run faster.
In particular, the call to embedly_client.is_supported() was
expensive, as it went over the Internet.)

(imported from commit ea12bf6e7ae84ce7e8023a0d314ecc4c07cbc0a8)
2013-06-25 08:46:02 -04:00
Scott Feeney 6b8bc74b4e Replace SITE_ROOT with DEPLOY_ROOT
Whereas `SITE_ROOT` referred to the directory where settings.py is
located, *all* actual uses of `SITE_ROOT` were joining it with `..` to
get the root of the git checkout, a much more useful value.

`DEPLOY_ROOT` now represents the root of the git checkout.

(imported from commit 351437f9a5801e5c7c08a3a97619e863144e5cc8)
2013-06-24 15:55:03 -04:00
Scott Feeney fcb39a262c Add note that DEBUG must be off for cache-busting
(imported from commit 2f14af77fcf95835f7f31b15048f417e8a5682a4)
2013-06-24 15:55:03 -04:00
acrefoot a37b08db58 In-Browser Notifications
Some browsers don't support desktop notifications. Some people haven't allowed permissions
for humbug to have desktop notifications. This is a poor man's attempt at desktop notifications.

We are adding the bootstrap-notify package (http://nijikokun.github.io/bootstrap-notify/)

Resolves Trac #1336.

(imported from commit 6a54f7d1875e765dabd32d94ada8ebe4474a3d71)
2013-06-21 11:44:25 -04:00
Tim Abbott e55eb53297 Use get_user_profile_by_* functions to get UserProfiles.
We had a few bugs where we were using a raw Django database query to
get a UserProfile object.  This might seem OK, but going through
memcached is more efficient, and also guarantees that we get back the
.select_related() version of the object, so that if we later access
related fields like user_profile.realm.domain, we don't end up doing a
second database query as well.

Fixing these should in practice save a substantial number of database
queries on handling update_status_list requests, which happen very
often and access user_profile.realm.domain.

(imported from commit 0a2027da1b5bbc7a4f6c6927aca498530d7a4977)
2013-06-20 17:57:06 -04:00
Scott Feeney eb3281b193 Update a comment mentioning PipelineCachedStorage
(imported from commit 7b4029db2831538e3077a2f090804da418e13d38)
2013-06-20 16:20:52 -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
Zev Benjamin a9e4441bee [manual] Serve static files from the same location across prod deploys
This only affects DEPLOYED installations.

This does not take care of removing old versions of static files from
that directory.  The problem is that staticfiles is clever and
doesn't copy files that are already there, so we can't depend on
mtime for detecting which files we no longer need.  Hopefully that
won't be too much of a problem for now.

(imported from commit 4341460dd5bc6544086fd445014ebdac58192910)
2013-06-12 17:46:38 -04:00
Zev Benjamin 614b5396a6 Collect static files directly in the location that will be served
We exclude the original source files for minified files by using a
custom Finder.

(imported from commit a6a25eb6146da53167b71c6d1c44588f75966059)
2013-06-12 17:46:38 -04:00
Zev Benjamin 33fed064e2 Prepend the minified static file header using a custom Storage class
(imported from commit 2b67a6d94de1693bdb8a91f455b92375692f4c41)
2013-06-12 17:46:38 -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
Steve Howell 01372b1f9a Configure S3 buckets for avatars.
(imported from commit 1da135a8cf62e204440e14043e148716ec103c51)
2013-06-12 15:34:51 -04:00
Steve Howell e753fd8088 Simplify setup for Humbug internal users.
I moved the list of internal users out of populate_db.py and
into settings.py, and I removed some dead code related to sqlite.

(imported from commit 1e080716dc296c05f51cdd229911082469de64bd)
2013-06-12 11:42:18 -04:00
Zev Benjamin 05d2fca93b Only email or Humbug on Django errors if the app is actually deployed
(imported from commit bf495eb3b0bab9a8fad7a4bc55476e7ec7e3c8d1)
2013-06-10 14:59:29 -04:00
Zev Benjamin e6a98dabce Rename 'inapp' logging handler to 'humbug_admins'
(imported from commit f789616ee6be983ec8a1fd21db3def1ff9ad3b63)
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
Steve Howell 41a3ce0d22 Allows slashes at the end of links.
This makes it so that URLs for pages like the hello page and
API page can optionally end in a trailing slash (/hello/, /api/).
In places where we don't want to be pedantic, we should get
into the habit of ending Django URL regexes with /$.

(imported from commit 82757db684c8f1d8d2040af993ece49b20e036fb)
2013-06-06 15:14:28 -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