We now have specific HTML/CSS classes for message fading and
user fading. They currently both have the same effect, changing
opacity, but we can now more easily treat them differently.
This change also removes "faded" attributes in compose-fade,
which avoids some confusion related to landing pages having
a "faded" class as well.
This fixes the mobile web experience for Chrome on iOS.
Apparently, Chrome-on-iOS silently has a `viewport` module that
overrides and user-defined module by that name, causing all of our
code that accesses the viewport module to not work on that platform.
We fix this by renaming it.
Using stream_id in recipient comparisons fixes a
bug in this scenario: go to home view, send message
to stream, wait for admin to rename stream, send
another message to the stream. Before this change,
the stream name would live-update but you'd get a
spurious recipient bar due to the prior message still
having the old stream name in places internally.
There were other ways to fix the live-update glitch,
but it's just generally cleaner to do stream id
comparisons.
Part of this change is to add stream_id to
compose_fade.set_focused_recipient().
Previously, we were checking if a particular user was the current user
in dozens of places in the codebase, and correct case-insensitive
checks were not used consistently, leading to bugs like #502.
update_rendered_message_groups needs to use the message not the
message_container when testing to see if the fade states need to be
updated.
(imported from commit b1c3baba07169a369d827c89afdc3c406ada0b79)
Now that we are not directly using message in the message list view
rename the uses of message that are message_containers.
(imported from commit 5c355703a8934a74864f5de6ecb1e2fd851e5d41)
Now that we no longer use tables for our message list, we can
more logically group messages together.
(imported from commit 9923a092f91a45fe3ef06f2f00e23e4e3fb62a37)
Don't warn when @-mentioning a bot on a public stream that it does
not appear to be subscribed to. It may be receiving those messages
anyway.
(imported from commit 4a00694942a721897a01736f48033c71048e0b16)
This is feature-flagged to staging only.
There are basically 3 parts to the implementation:
1. In response to typing, fade/unfade the user list.
2. When a compose is aborted, unfade all users.
3. When the presence list is redrawn, fade/unfade the user list again.
(imported from commit cd416de232849a9f69dcacdc8b0fcfc20e3848a2)
This partially reverts d3c28b17859cacd49b7db9f8784d4b8b9069e1ff.
It is necessary to call update_floating_recipient_bar from _fade_messages and
_want_normal_display because they are called after opening/closing the compose
box. There is no scrolling there, so it is not otherwise updated. It is not
necessary to call from update_rendered_messages as it is not called on
changes of the fade state.
Related: Trac #1682
(imported from commit e2528f8c8827b7e2a135d7fc2b53e9e8162799b0)
This fixes#1682, a recent regression that came out of
a5a47e13fc9d, which introduced the update_rendered_messages()
function in compose_fade.js. The original implementation
was finding the table row for a message, but not the table
row for its recipient bar. Now we style both elements.
(imported from commit a9628df0b03f79a24dfa68f4f2061eda2ca8ecea)
The calls to ui.update_floating_recipient_bar() were brought over
from compose.js, and it turns out they just complicate scrolling,
since we already call the function in the scroll handler.
(imported from commit d3c28b17859cacd49b7db9f8784d4b8b9069e1ff)
This resolves trac #1675, without introducing the problem that
caused us to set the immediate flag in the first place. (Some
commits just prior to this eliminate some slowness with rendering
by taking the debounced function out of the code path.)
(imported from commit 8c72f25a9d5eb38376957f222b9413d3167fa386)
The call to compose_fade.update_faded_messages() in message_list
caused us to traverse every message in the current table, which
was extremely inefficient. Now we call the newly created
compose_fade.update_rendered_messages(), which only fades/unfades the
messages passed in as the first parameter.
(imported from commit a5a47e13fc9daeedd0899b2cfb02beb3f6b8cd0a)
To get to the bottom of the too-much-fading regression,
it was necessary to clean up the code, which was overly
complicated by multi-purposed functions.
The API for compose_fade now has these functions:
set_focused_recipient
start_compose
clear_compose
update_message_list
update_faded_messages
Internally there is now a notion of "normal display",
so e.g. when you want a normal display, we call
_diplay_messages_normally() internally, which removes the
faded/unfaded classes from all messages.
(imported from commit 7eb2b0a163f29d9ebae26661f432fecc7c331e4c)
This makes fade/unfade start sooner (good), but it might
re-introduce some typing sluggishness (bad).
(imported from commit 4e3112ed1ac931f2931182f91b60567ef2d72695)
When starting a compose, call compose_fade.set_faded_messages,
which will immediately do fade/unfade logic, whereas before
the code path went thru debouncing logic.
(imported from commit 7d0b30435be32a7132dbf05bf064b03b925a2d42)
Move code from compose.update_fade() into
compose_fade.set_focused_recipient(), which makes it
so that we only have to send the msg_type.
(imported from commit c17665d9f34f525bdedcd36d39d3a112fa36a914)
The code in unfade_messages() is O(N) over the number of
messages, but a simple flag allows us to track the fact that
all messages are unfaded, so we can short circuit the O(N)
logic in many cases.
A typical scenario now would be that you start typing a
stream while the topic is still empty. Modulo debouncing,
every keystroke now leads to a call to unfade_messages(),
but this change only does real work the first time.
(imported from commit da07cf408bbdbf5b381ff3ec33a5e05e34eef5b5)
The compose_fade has three public exports:
set_focused_recipient
unfade_messages
update_faded_messages
All code was pulled directly from compose.js, except for the
one-line setter of set_focused_recipient. The focused_recipients
variable that used to be in compose.js was moved to compose_fade.js,
hence the need for the setter.
(imported from commit 462ca5d0d0bd58612d0197f3734a8c78de8c6d30)