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)