Commit Graph

6035 Commits

Author SHA1 Message Date
Tim Abbott 102b495609 api: Fix error reporting when result is not JSON.
Previously, we would return a JSONDecodeError to the user in the event
that the server returned a 500 error (or other non-JSON content).

(imported from commit 1624dfec6ac65d34216f4de91e33116a54e414fa)
2013-07-30 16:32:13 -04:00
Scott Feeney c5045b64f2 Generate API keys in a more secure way
The documentation for the Python `random` module explains that it "is
completely unsuitable for cryptographic purposes." This new way of
generating API keys replaces use of the random module with
`os.urandom()`, which is intended to be suitable for such uses. As a
bonus, the code is simpler and clearer.

(imported from commit cc3697a5048f2da53f0fce6689167f9d1cbb6466)
2013-07-30 13:54:50 -04:00
Scott Feeney c56353138d Fix tracebacks on reload while composing
(imported from commit 5ba1c93b8af015197e77bd16ef9178a6e743a849)
2013-07-30 13:10:50 -04:00
Scott Feeney a35fff90cc Replace $.extend
(imported from commit 2c1ee3c2714d388f2a71398fe81c049cc54ff94d)
2013-07-30 12:12:59 -04:00
Scott Feeney 8703134a23 Replace $.each with _.each
In a few cases the $.each was doing something imperatively that was
terser and easier to understand by using a different Underscore method,
so a few of these I rewrote.

Some code was using the fact that jQuery sets `this` in the callback to
be the item; I rewrote those to use an explicit parameter.

Some code was using $(some selector).each(callback). I converted these
to _.each($(some selector), callback).

One function, ui.process_condensing, was written to be a jQuery $.each
callback despite being in a totally different module from code using it.
I noticed this and updated the function's args.

(imported from commit bf5922a35f257c168cc09ec1d077415d6ef19a03)
2013-07-30 12:12:58 -04:00
Scott Feeney 5842d5c335 Replace $.inArray with _.indexOf
(imported from commit 6bd9c87ac98b8951411fc050e1bff83684cf8618)
2013-07-30 12:12:03 -04:00
Scott Feeney 375b1f9eb3 Replace $.map with _.map
(imported from commit 97c7a6612d8d56d19f8650db0ea8906afc0f20ef)
2013-07-30 12:09:18 -04:00
Scott Feeney 88952fb2b1 Replace $.grep with _.filter
(imported from commit 3a8830f697551a91f94f06b37d01a3687d8c583d)
2013-07-30 12:06:22 -04:00
Steve Howell d82ccb6243 rename tests
(imported from commit cd98a86a5e07765f753ac1904e45ccd1213d6d67)
2013-07-30 09:05:49 -04:00
Steve Howell 998a22eabb Created test_search.js. (unit tests for search.js)
(imported from commit 8127c04ccc68a9ac106e5684a7ea9a621cb1831f)
2013-07-30 08:55:44 -04:00
Steve Howell 6cf5b64b3c Update module.exports for various modules.
(This makes them play nice with node-style unit tests.)

(imported from commit 44fa97c9d38d0b7e82366b49db1425508b6aed67)
2013-07-30 08:54:23 -04:00
Steve Howell f11cc9e6a2 Extract search.get_suggestions().
(This makes testing a bit easier, plus it dedents some code.)

(imported from commit 80532990608cc51ca55d3354bd300734afd7942e)
2013-07-30 08:54:22 -04:00
Steve Howell 2275809103 Shorten names of internal functions in avatar.js.
Just have accept() and clear() for brevity sake.

(imported from commit 7bf9b4d89f1b7978ae7b07b5fba87b654c90e314)
2013-07-30 08:41:09 -04:00
Steve Howell 1c69b7ea46 Extract avatar.set_up_file_input.
(imported from commit c85087a4e098b1af2e4d26c97d0cb69c42d4f671)
2013-07-30 08:41:09 -04:00
Steve Howell e6609b3695 DRY up jQuery calls in avatar.js.
Extract some local variables to set up the next refactoring, where
we can parameterize the function.

(imported from commit 1c2801131c19a54713a0d5c2cc26c419412339b0)
2013-07-30 08:40:49 -04:00
Steve Howell e18b9ae3d7 Use get_file_input() to specify hidden file input for avatar uploads.
(imported from commit 898216219b36a65519439da73158da4e5996649b)
2013-07-30 08:40:49 -04:00
Steve Howell c5013c0ba1 Introduce validate_avatar function
(imported from commit 4d6d20e4b1c3b0998d0c40ca9b5c74cb7f3319e5)
2013-07-30 08:40:49 -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 209471a6c0 Fix disappearing stream sidebar chevron (#1587)
My mistake when refactoring popovers.js a month ago. Sorry everyone!

(imported from commit a588b44723a58fb01b6c3996d308e4e8ea11ec2f)
2013-07-29 19:23:09 -04:00
Scott Feeney 409c495c78 Move API readme to README.md to match GitHub repo
(imported from commit ca30e948c158a4a285bcd002d45725ff13d47cc7)
2013-07-29 16:45:06 -04:00
Steve Howell 546ae1023c Remove smartSpaceBar option from typeahead and search.
The option caused some race conditions on Firefox, and it is
really made moot by the naturalSearch option anyway.

(imported from commit dc7080c905ced9b2f4ad4275d82549acf09a59f7)
2013-07-29 16:42:14 -04:00
Leo Franchi 4b94b99c17 Send recipient id also for PMs
(imported from commit 704f604cc10cc3205420af6dca1e093ec15c3874)
2013-07-29 16:13:57 -04:00
Leo Franchi 1a7636732e Add new errors/ folder to .gitignore
(imported from commit a6c9a16539e77e07b5b63198aa62f88949aec16e)
2013-07-29 16:13:57 -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
Leo Franchi e0374cf761 Add sender_id to sent messages
(imported from commit 5ed87152143fbc2c5936ee3903b6dbef4f1c9e32)
2013-07-29 15:26:47 -04:00
Scott Feeney 0de1d3dc1f Fix "a[n] invite-only stream"
(imported from commit a4572dc1541b10f30ec0618e29371d6a187c1809)
2013-07-29 14:53:16 -04:00
Scott Feeney 85ce86c4fd "Already using Humbug" -> "Already using Zulip"
(imported from commit e05812ed3bae64f9daa7d60a7d5b2404edb306fc)
2013-07-29 14:53:16 -04:00
Scott Feeney 9e2e857a88 Fix narrow test calling .then() in a callback
As Kevin points out, un_narrow() itself calls casper.then() so should be
called outside of a callback, not inside one.

(imported from commit c5f02a14c750045697558aeafb070227e3a9d24c)
2013-07-29 14:51:40 -04:00
Scott Feeney c2ce181203 Fix race conditions in 02-narrow.js tests
(imported from commit 6a4b22992c35cdebc86194282d6a348ee9c4b810)
2013-07-29 14:51:40 -04:00
Steve Howell a004a15ff5 [important] Fix paths related to recent zephyr/static changes.
This fixes the previous commit to master.

(imported from commit 43637dcf0832a4e91de9fd98ebb777c77a3eee19)
2013-07-29 14:02:20 -04:00
Steve Howell 46c4a6a9b3 Add unit test coverage to unread.js.
This covers most of the module's functionality, with special
emphasis on lines that use underscore.js (_.each and _.filter).

(imported from commit 074181a0273286a258504be634bdd1cead2eecd5)
2013-07-29 13:47:57 -04:00
Steve Howell 3d8ce28964 Use underscore in unread.js
(imported from commit 91befaaaff5d9a791a3c1bb4ff99f4085c27c4cb)
2013-07-29 13:47:57 -04:00
Steve Howell 09bd52fff4 [third] Add underscore.js
(imported from commit ee17cc1d1dff2a6f816a81bb33fa04ca5562a441)
2013-07-29 13:47:56 -04:00
Steve Howell f92b3a9129 (css) Remove #bots_list width setting.
The width setting was unintentional, and it interferes with
the inline-block settings for the image and bot info.

(imported from commit 741c82829efed00b6d47badcf14b26223b47a7a9)
2013-07-29 13:17:26 -04:00
Tim Abbott bc4d7c687d Rename our custom JS events to use Zulip, not Zephyr.
(imported from commit 61ac456d394a6dbc14f3e9183a53313990db5059)
2013-07-29 12:11:26 -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
Steve Howell a9da6e28e7 Made minor changes to test_message_tour.js
I added a comment at the top, and I made it run the test
more automatically.

(imported from commit db6e382d766d0cc35eed28d589608645253f23e8)
2013-07-29 10:28:14 -04:00
Waseem Daher b6d2682abf Remove inelegant gear menu hack.
Rather than play elaborate games to strip off the 'active' class, we
just neutralize it by making it the exact same as the inactive class.

(imported from commit d26a02ca0edef6ee86affa2fa5daee0426eb5f8a)
2013-07-26 18:37:07 -04:00
Waseem Daher 474a42a9bb Typo fix: mox-shadow -> box-shadow
(imported from commit ba8931c232d25d3bc5cd4e46110b923c1a9f63a9)
2013-07-26 18:36:40 -04:00
Steve Howell 945562fbe1 [bugfix] Fix the recent gear hovering regression.
It's a long story, but we need to set the actual-dropdown-menu
class for the gear, since it messes with bootstrap's notion of
active.

(imported from commit 94f2d9ee65014bc954e088e6c913d9682b7322f6)
2013-07-26 18:12:06 -04:00
Steve Howell 04df44f91f Allow a backdoor for styling dropdown hovers in bootstrap.
We had to turn off hover styling to make typeaheads work properly, but
some plain dropdown menus might need it, like our gear menu, and they
can set a class of actual-dropdown-menu to be unaffected by the
typeahead patch.

(imported from commit af41c1cfa6da3ff90ca4245a12c47993c65e6766)
2013-07-26 18:12:05 -04:00
Leo Franchi d68df4f142 Don't infinite loop if trying to bankrupt while pointer update is in flight
(imported from commit e23be332ff86239283b9568e8e4c92edf0c59f75)
2013-07-26 17:32:49 -04:00
Luke Faraone 942cc94b04 Install files to customise postgres for maximum performance.
Configuration provided by Zev.

(imported from commit 4d0cdbb6747689863208079e2c21864521e1cf02)
2013-07-26 17:11:54 -04:00
Steve Howell b8794e1a9d Revert "[third] Mouse-enable naturalSearch option in typeahead."
This reverts commit 02318d3d830e7e28d638efee0ef27023a73f52f7.

(imported from commit b6e48772dbef127a9e25e5ea5042d250cce6fed1)
2013-07-26 17:11:43 -04:00
Leo Franchi 7b6579c74c s/humbughq/zulip/ in graphite setup
(imported from commit 5c87bbe3d1ae4f57c5f66899b66cbd4417e49887)
2013-07-26 16:23:03 -04:00
Luke Faraone 7c2de24213 Make trac.ini world-readable
This is bringing our puppet configuration in line with reality.

(imported from commit 48a10676a9f28566dd89fff1337a4b34c23c0b61)
2013-07-26 16:14:55 -04:00
Luke Faraone 5e2dda4d73 Configuration for puppetized MediaWiki on trac.
(imported from commit cff2becbe590e50414f74a31ea2a2914de49f4bd)
2013-07-26 16:14:55 -04:00
Luke Faraone 85988df75d [third] Import Auth_remoteuser.php into puppet.
This is a module we're using for REMOTE_USER support in MediaWiki. It is
not used in any app code nor is it distributed, nor is it incorporated
into any comapny works.

License: GPLv2+

(imported from commit da9a81db251cf850335987697ea8383623b58c53)
2013-07-26 16:14:55 -04:00