Commit Graph

67 Commits

Author SHA1 Message Date
Jeff Arnold 6483314f74 Only fade visible messages before rendering compose box
Partially addresses #1963

(imported from commit 0c941085ab6894e8e43015a116c49a5bdc674b5f)
2013-11-04 16:27:39 -05:00
Kevin Mehall 89d149c6f7 Fix @-mention "not subscribed" warning for all_public_streams bots.
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)
2013-10-18 14:55:32 -04:00
Steve Howell be9eea6cd4 Disable compose fading for incomplete/wrong stream names
(imported from commit 2b6a0dbcd1464767e24704f270eeac2875be0d51)
2013-09-25 14:43:43 -04:00
Leo Franchi 0cf588cd25 Show a warning and action button when @-mentioning someone not on the stream
(imported from commit 464d5a028f6a8f2698683e7317972dc0c7b9e336)
2013-09-17 16:49:47 -04:00
Scott Feeney 5d800c5186 Fade users when composing
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)
2013-09-06 23:13:48 -04:00
Kevin Mehall 3345199604 Hide/show the floating recipient bar when fade state changes.
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)
2013-08-15 18:26:36 -04:00
Steve Howell 59b84aad4a Properly fade recipient bar of incoming messages.
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)
2013-08-14 13:20:39 -04:00
Steve Howell d66ac9f36c Remove calls to update_floating_recipient_bar in compose_fade.js.
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)
2013-08-14 13:20:38 -04:00
Steve Howell 1c9749d21e Debounce update_faded_message on the trailing edge.
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)
2013-08-13 17:14:07 -04:00
Steve Howell beb89e247f Avoid unnecessary fading/unfading processing via message_list.
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)
2013-08-13 17:14:06 -04:00
Zev Benjamin 62f607fd5e Debounce fading on the leading instead of the trailing edge
(imported from commit 11d0e8938c1f29cfea0678330e7af9884844af21)
2013-08-12 18:07:30 -04:00
Steve Howell c4e168254c Fix too-much-fading regression and remove spurious classes.
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)
2013-08-12 11:54:27 -04:00
Steve Howell e720737cb5 Tune fade/unfade bouncing from 150ms to 50ms.
This makes fade/unfade start sooner (good), but it might
re-introduce some typing sluggishness (bad).

(imported from commit 4e3112ed1ac931f2931182f91b60567ef2d72695)
2013-08-11 18:18:01 -04:00
Steve Howell 6591c79184 Un-debounce fade/unfade when starting a compose.
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)
2013-08-11 18:08:36 -04:00
Steve Howell 6cc5c43e59 Move code into compose_fade.set_focused_recipient().
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)
2013-08-11 17:54:50 -04:00
Steve Howell 8190cdc9fb Avoid redundant O(N) work in unfade_messages()..
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)
2013-08-11 17:05:13 -04:00
Steve Howell 37f8cc9294 Extracted code into compose_fade.js.
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)
2013-08-11 17:05:13 -04:00