Commit Graph

5550 Commits

Author SHA1 Message Date
Steve Howell 5590eb21c0 Removed match_on_visible_text() in search.js.
It appears to have been unused for a while.

(imported from commit 04a0de9f60484da660a557ad2b9953c00b91c608)
2013-08-02 17:28:04 -04:00
Steve Howell a1531b4247 Remove dead vars in search.js
(imported from commit 7fb2fa835332bb909edf173b5f487be9bb592ff3)
2013-08-02 17:28:03 -04:00
Steve Howell b33858dd70 Created search_suggestion.js.
Moved 400+ lines out of search.js into search_suggestion.js.  This
leaves search.js primarily responsible for lots of little DOM
interactions, whereas search_suggestion is more about data.

(imported from commit 53d08b29367c0172e483064f213538d45098279e)
2013-08-02 17:28:03 -04:00
Steve Howell 95102dc1bd Refactor search_suggestions.js.
1. Change code comment in search.get_suggestion.

2. Remove side effects from search.get_suggestions.

The function get_suggestions() was updating a module-scoped variable
called search_object, but now it returns a dictionary to its caller.

3. Greatly reduce the scope of the search_object var in search.js.

I also clarified the comment around it a bit. We could squeeze
the scope of search_object even further by using a function wrapper, but
this is a big enough win for now.

(imported from commit 4b633dd30ab45d24b85ea1d10df27df5aaa0c959)
2013-08-02 17:28:03 -04:00
Steve Howell cd57a7d433 Simplify search.narrow_or_search_for_term.
For legacy reasons this function used to have convert item to
search_string via the search_object hash, because we used to
have an overly convoluted data model.  The mid-July-2013
refactoring on search.js made the data model simple, and this
little bit of cleanup follows up on that.

(imported from commit aeea629862e4307897f24eaa5fc364f2b12a7c52)
2013-08-02 17:28:03 -04:00
Scott Feeney c3fc279423 Remove extra space in presence descriptions
(imported from commit 46d47cc71a72aad4f8c7447451982cfeb10cc54e)
2013-08-02 16:26:46 -04:00
Waseem Daher 0bb304a516 Request Gravatars at 2x the size we need.
This is a bit wasteful on most systems, but will result in their
looking pretty sharp on Retina displays.

(I also go and actually fix up the size we request for a bunch of
these so that they actually match the size of the gravatar in the
document -- previously we were requesting a size 30 gravatar when we
were displaying it in a size 25 space, which leads to unnecessary
ugliness upon resize.)

(imported from commit 9152e6e128e0ac38d97d893cb8243e3b9185351b)
2013-08-02 15:58:55 -04:00
Steve Howell 6b9b33f769 Use PATCH again for patching bots.
This reverts a prior commit, but the earlier commit is fine
functionally; the earlier commit was a temporary measure.

Revert "Use POST, not PATCH, for patching bots."

This reverts commit c3146b23d5d7d134c2b80507eb87033ca375a4db.

(imported from commit ebfcb2bae72c11767f9750412440d40b7a2a4995)
2013-08-02 11:46:11 -04:00
Kevin Mehall a02fe71788 Make the "Get our app" onboarding popover less obnoxious.
* Only pop up on mouseover if you haven't completed the step previously,
    and only on the first mouseover.
  * Dismiss the popover if you click anywhere but the link

Trac #1471

(imported from commit 08904be59c15526f88a2633ebd6f2a046ec62197)
2013-08-02 10:24:28 -04:00
Scott Feeney 31bee946be Don't autocomplete @-mentions mid-word
Now the @ has to follow a space, newline or certain punctuation, or be
at the beginning of the message. This addresses the frequent complaint
that typing an email address e.g. scott@zulip.com is hard, because after
the @, it would try to autocomplete.

(imported from commit 043953be3928b0acf2a4ab2b4dd1a80e1a1aa882)
2013-08-01 18:42:39 -04:00
Waseem Daher 0663c7243c Enable always-open-compose for MIT, CUSTOMER4, Zulip.
(imported from commit 43602ebeed5396de038c59240a9d695ec411db89)
2013-08-01 13:00:15 -04:00
Waseem Daher 86cf40c8a9 Move feature_flags into its own file.
(imported from commit b775f85a24422d236b0079810b98b6b984cb60a2)
2013-08-01 13:00:15 -04:00
Tim Abbott 5a320db3c1 Add curly braces for all javascript if statements lacking them.
(imported from commit 32c7643d1a6ecdfaf634424d217938c8a368dade)
2013-08-01 11:47:54 -04:00
Kevin Mehall 112d37de86 Fade message dots faster when marked read by cursor.
(imported from commit a31b0601bf13bce377c24fff96a818023d5bdd1f)
2013-08-01 11:26:55 -04:00
Kevin Mehall 0cbee97ffd Change mark-as-read behavior.
Mark messages as read when with the pointer, but mark all messages
read if the last message is visible.

(imported from commit 4c1a928bd6966111f0f34c5207723656b5f193b9)
2013-08-01 11:26:55 -04:00
Kevin Mehall 0e0ed886e1 Add feature_flags mechanism to enable experiments.
In the future, this could come from the server to enable individual
experiments on a per-realm basis.

(imported from commit 8fd1ba1910b3cfd131f58bab8efbd11a42053bc3)
2013-08-01 11:26:55 -04:00
Steve Howell 0ed73df475 Rename some functions related to bot avatars.
(imported from commit 6f88ee71dda263bfe7b5c15baed02aaf00d35f15)
2013-08-01 11:05:40 -04:00
Steve Howell f7ca0117e6 Allow users to upload new avatars for their bots.
(imported from commit 9d7895a658740815f454c8bba400d7cff821b7f9)
2013-08-01 11:05:40 -04:00
Steve Howell d0060f24ed Add close() method to avatar objects.
The close() method will let you release handlers, as well as
doing everything clear() does.

(imported from commit 3a67c3f2226918cee10cf43598e0408fb186408a)
2013-08-01 11:05:40 -04:00
Steve Howell d505d494c8 avatar.set_up_file_input returns object now
The set_up_file_input() function now returns an object to the user
with a clear field.  This object will grow soon.

(imported from commit 7b3761eafddb392bd2c84a1685aa8d1811028a0f)
2013-08-01 11:05:39 -04:00
Steve Howell 784cab9df2 Use jQuery on() consistently in avatar.js.
(imported from commit c14105dbaa174ef9aec4fc11a12a44f25e74a246)
2013-08-01 11:05:39 -04:00
Steve Howell ab23c534b9 Use POST, not PATCH, for patching bots.
This is a temporary expedient measure to work around our
PATCH not supporting file uploads in our current Django setup.

(imported from commit c3146b23d5d7d134c2b80507eb87033ca375a4db)
2013-08-01 11:05:39 -04:00
Scott Feeney 38abee8e66 Refactor code to show/hide "All messages" link
Code prior to this commit was functionally working, but semantically
flawed — returning false does not short-circuit _.each like it does with
$.each. It now uses _.every, as suggested by Steve.

In addition I renamed the function to be more descriptive, added a
comment, and eliminated needless double negation.

(imported from commit b0666dfa01b2677b4eaf577fe9ced90ed0db2438)
2013-08-01 10:16:32 -04:00
Scott Feeney 1e642ae158 Use _.any instead of _.some
They are synonyms, and Zukeeper consensus is that _.any makes it clearer
what the function does.

(imported from commit 847383e27ccefeaff1ecff15f4cb4177c9e40c25)
2013-08-01 10:16:32 -04:00
Zev Benjamin 905354f7a1 For mit.edu, include .d instances in narrowed views
(imported from commit 502b36d1a62f3f8f7b956c701fd10f580e1927d7)
2013-07-31 18:30:28 -04:00
Zev Benjamin bae5924b53 Fix whitespace
(imported from commit 96937f8225bc7039f2a98163deb9b5b142c71c7f)
2013-07-31 18:30:28 -04:00
Zev Benjamin a637fadd18 Fix regexes for MIT narrows that include un- and -.d streams
The previous regex didn't escape the period in '.d' and was doing a
case-sensitive match to find the base stream name.

(imported from commit 43ef13733987e50dcead06b7bd3e768cb4395998)
2013-07-31 18:30:28 -04:00
Tim Abbott d6acd8fce9 Add support for narrowing to a single message ID.
This is mostly useful for sending someone a link to a single Humbug
message.

(imported from commit b0994a2bf503c84690b13ce89bbcf5bab829bf0c)
2013-07-31 14:59:05 -04:00
Tim Abbott ed6f5ac470 Fix time travel by adding new near: operator.
(imported from commit 727a68016090164b586cbe59e692676a00e8cd3a)
2013-07-31 14:59:01 -04:00
Scott Feeney 473a96fd1f Fix #1629 (wrong scroll pos on narrow)
(imported from commit ac78077f104b079406e745c3eb9ff11b759d033e)
2013-07-31 14:35:48 -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 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
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
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
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