This fixes Trac #1567.
This is kind of a big hammer approach, though. If we did support
spellcheck on other platforms (without doing more work), this might
actually potentially disable it.
But we don't, so this is mostly a non-issue for now.
(imported from commit 74dcb42b19c37e1e8d1e9a2b265e1e6ae0cc2c67)
There are also one or two places we don't need to use it for security
purposes, but we do so for consistencey.
(imported from commit aa111f5a22a0e8597ec3cf8504adae66d5fb6768)
util.enforce_arity takes a function and returns a new version which
throws an error if an incorrect number of arguments (as determined by
the function prototype) are passed.
(imported from commit 20e69a6dc7b6f8455726ab4fae8d5b7b04dc4103)
This fixes trac #1357, which says that some users get annoyed
when the system keeps generating the same color for them, which
would happen if they didn't like #76ce90 and kept picking a
new color for their streams.
(imported from commit 0fdb726aad4009332cc056a5e98bb39e01ef414c)
Instead of splicing up a cloned copy of stream_assignment_colors
every time somebody uses a color, we just rebuild a hash
of used_colors from our subscribed streams when we need to assign
a color, and we avoid calling into stream_color.pick_color() when
a stream already has a color.
This change has a slight functional impact in the situation where
a user unsubscribes some streams during their session, because
we weren't "reclaiming" colors before on unsubscription, but the
simple approach gets that for free.
(imported from commit adf360365bdf1ae9db99c533a0bde62d91f5dfe8)
This is a pure refactoring that mostly just moves code from
subs.js to the new stream_color.js and updates module references
accordingly. In order to prevent introducing some exports,
update_stream_color was given an additional "sub" parameter
and update_stream_sidebar_swatch_color was given an "id"
parameter.
Killed off unused initial_color_fetch var.
(imported from commit b7644ce67f50d31fb46f564d758d661eea776aa6)
Fixes the blueslip error on "i" in empty narrow.
Also removes a then-uncessary check from do_narrow_action as suggested
by acrefoot.
(imported from commit 10b1f702b535b4eef54e500ccef93b6a5280e953)
Summarized messages are not shown and cannot be selected. If
`opts.use_closest === false` and you try to select a summarized
message, we still have to use the closest instead of failing.
Eventually, we'll make summary rows selectable, but that would be
rather involved since selections are managed by ID, summaries exist only
in the DOM, and many parts of the code get the selection and expect
it to be a message.
(imported from commit 998c4f24aece84528cc9da53a47f9e4f5391702d)
On a page load or reload, the browser will, at an idle time, scroll to
the top of the page. We can't intercept this browser-induced scroll,
so to make sure it doesn't in interfere with our scrolling to the
correct place in your message feed, we let the browser scroll happen
before the work we do on page load.
(imported from commit f5f441ab90bcdb8404e05caea3c6da81a3a6fc1e)
This commit makes keep_pointer_in_view() less aggressive when
the pointer is toward the top of the screen. If the pointer is toward
the top of the screen, then as long as it's fully on the screen, we
don't pull the rug out from under the user and change the pointer.
An important benefit of this change is that we fix trac #1608,
which was a bug where autoscrolling interacted with
keep_pointer_in_view() to push messages past the top of the screen
before they were read.
(imported from commit e39926df99bfaedd5c0757f1241887ccd9b93fab)
The helper functions now return true when a message is on
screen, not when it's off screen, and the names have been
changed accordingly. I also eliminated the at_end parameter,
which was kind of abstract, by having message_is_far_enough_up
and message_is_far_enough_down handle those details.
(imported from commit cdb1543e430f49f23eb1b3a88d9aaff95ce7ca74)
* Move the state into a closure to duplicate it for multiple queues
* Use _.debounce instead of manual setTimeout fiddling
* Have it handle manipulating the message flags
(imported from commit 938f51fd666131a3cec5901d3f3fdd39e203b462)
Functions were supposed to check that messages were unread before
passing them to process_read_messages, but some didn't.
The `mark_messages_as_read` function was essentially that, so
take that name.
(imported from commit 2917fe30d2defb8a047ec32e1bc70d379779276b)
When you read messages in a narrow and then un-narrow, collapse
adjacent messages read in the narrow into a summary row that can
be clicked to expand those messages.
Scoped to staging with feature flags.
The implementation of this within our current MessageList is rather ugly.
(imported from commit bcb3a39d8c0c334136fe86318f18ead03f0f50bf)
Adding a span for CSS reasons in the presence list indicator
broke the click handler if you clicked the presence circle directly.
(imported from commit 1aa28755d849a1f2a5a06aeb4cc27ca368730c35)
If you entered "stream:Denmark " in the search box, we would show
you two suggestions for "stream Denmark", despite our duplicate
detection, because we didn't canonicalize the suggestion that is
literally based off the user typed query, and so the other way
of generating the "stream Denmark" suggestion created a duplicate.
Now all the suggestions we generate are canonicalized, so the
generalized duplicate detection can work.
(imported from commit 52bf08ccf9bb2e2260ca8c20690169aead3732ab)
This was introduced in a71867c2435790, intended to fix#1287.
Very subtle bug. The problem was that we were attaching a click handler
to two selectors, a link, and a div that the link is inside of.
Since the link was a descendant of the other selector, clicking the link
created TWO click events, and the second click on a stream box while
already narrowed to that stream jumped you to the end.
We should be careful of this in the future — never attach an event
handler to two selectors, one of which is contained in the other.
(imported from commit f428f593280e80c90b2665d1dfbff1df8a39bd35)
When you are narrowed and hit "New stream message", the topic
will autofill. This broke during the subject-to-topic
transition.
(imported from commit a9b471884c5cdae449e02ce7aa782add4a178077)
For now, we just get emails about referrals that we have to follow up
on manually.
I don't love using the name "referral" in some places and "invite" in
others, but we already use the verb "invite" to mean something else
and "invite" is a canonical noun.
(imported from commit 0814c18395952fcdef234c1584984f71ca1b6f37)
This restores the feature that hitting down when you are at the
last message automatically centers the last message. This is not
a pure revert, because some additional code now goes through
navigate.down.
(imported from commit 2db1f247692ba068613a2d6c93f18ca7c13a16b8)
We now only suggest "Home" if you have an empty search box (suggestion #1),
or if you are typing "Home". Before we'd show it as a way to get back
from various narrows. This is trac #1596.
(imported from commit 9228bf45e9aaf9912d83efdf70338abb4b7e054f)
We always intended to move the pointer up when you were at the
top of the viewport and scrolling up, and we always intended to
move the pointer down when you were at the bottom of the viewport
and scrolling down. We didn't intend to move the pointer up
when you were at the bottom, or vice versa. This commit fixes
that bug, simplifies the code, and inlines the code into ui.js.
(imported from commit 77e2ace9d2fc1025e1349e3be13c76c3a397fd38)
We had a feature that if you hit the down arrow key when you
were at the last message, it would recenter you. Waseem has bought
into temporarily removing this feature. Justifications:
1) We can always put it back.
2) Autoscrolling makes it less relevant.
3) The feature complicated the code a bit.
4) The feature worked different for End than down arrow, due to
a FIXME.
5) It might have been a misfeature for users that want more
control over their own scrolling.
6) You can achieve the same essential effect by using PgDn
or space.
(imported from commit fa6874bb5d29d7057bb1601f0b6d577bac1272c7)
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)
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)
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)
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)
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)
* 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)
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)
Mark messages as read when with the pointer, but mark all messages
read if the last message is visible.
(imported from commit 4c1a928bd6966111f0f34c5207723656b5f193b9)
In the future, this could come from the server to enable individual
experiments on a per-realm basis.
(imported from commit 8fd1ba1910b3cfd131f58bab8efbd11a42053bc3)
The close() method will let you release handlers, as well as
doing everything clear() does.
(imported from commit 3a67c3f2226918cee10cf43598e0408fb186408a)
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)
This is a temporary expedient measure to work around our
PATCH not supporting file uploads in our current Django setup.
(imported from commit c3146b23d5d7d134c2b80507eb87033ca375a4db)
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)
They are synonyms, and Zukeeper consensus is that _.any makes it clearer
what the function does.
(imported from commit 847383e27ccefeaff1ecff15f4cb4177c9e40c25)
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)
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)
Extract some local variables to set up the next refactoring, where
we can parameterize the function.
(imported from commit 1c2801131c19a54713a0d5c2cc26c419412339b0)
The option caused some race conditions on Firefox, and it is
really made moot by the naturalSearch option anyway.
(imported from commit dc7080c905ced9b2f4ad4275d82549acf09a59f7)
This covers most of the module's functionality, with special
emphasis on lines that use underscore.js (_.each and _.filter).
(imported from commit 074181a0273286a258504be634bdd1cead2eecd5)