This fixes a regression in 3041480600
that would cause anything rendered on the backend differently than on
the frontend to experience this animation.
We actually only want to do the animation when the message content was
changed in a way that generates an edit history event, i.e. a
user-facing edit, not in cases where we're either transparently
swapping in post-backend-rendering content (e.g. with link previews)
or cases where there's a discrepancy between the exact HTML from the
frontend and backend markdown processes (e.g. mentions).
The comments that were added in the code for this commit explain
the cases here, but essentially for topics, we need to decide
among a few possible behaviors with regard to composing:
- Leave it closed.
- Cancel the compose.
- Leave the compose box as it was before.
- Fill in the new topic.
Before this commit, we were cancelling compose in all cases (or
leaving it closed).
Now we leave it alone in some cases where there is already content.
And we fill in the topic when the stream was correct and the topic
was empty.
Fixes#3300
This fixes the /me elements to be display inline-block and inline
rather than display block with top and left properties.
This also fixes an unrelated issue with emoji reactions not being
able to be clicked on with /me messages.
Fixes: #4218.
When a message update comes back from the server and replaces an
old message, it should fade in. There are two components to the fade:
1. The message fades in from opacity: 0 => 1.
2. The "edited" text will transform from X: -10 => X: 0.
This commit extracts the method compose_actions.on_narrow()
to handle changing the compose box (as appropriate) after
any narrowing action.
This change should be mostly non-user-facing, but it's not
exactly a trivial extraction.
For the case where the user already had content in their
compose box, we continue to leave the compose box alone,
but we now update compose fading 150+ lines later in
narrow.activate().
Likewise, for cases where we cancel composing, this will
also happen later in the function.
Finally, for PM narrows, where we auto-open the compose box, we
no longer call compose.cancel() before calling compose.start(),
because either a) the compose box would have not been open
in the first place or b) the start() function can handle
clearing the old fields.
Before this change, we would move "dormant" streams to the bottom
of your stream sidebar, but only if you had 40+ streams.
Now we do this in all cases to be more consistent.
This commit also changes the redraw strategy when we remove rows.
Before this change, we were doing incremental updates, but now we
call build_stream_list to do a complete rebuild. This was partly
motivated by adding the new divider, which would have complicated
the incrememental approach when you removed the last remaining
dormant stream.
This creates get_emoji_at_index() and
find_index_for_emoji() functions, which search for
emojis and indices in reactions_show_list. Update
maybe_select_emoji with newly created functions.
This fixed the fact that the scrollbar for this popover was super ugly
on Linux, while also ensuring that we have a consistent 6 emoji per
row in the popover (an important detail for the arrow hotkeys).
This is mostly just moving methods out of compose.js.
The variable `is_composing_message`, which isn't a boolean, has
been renamed to `message_type`, and there are new functions
set_message_type() and get_message_type() that wrap it.
This commit removes some shims related to the global variable
`compose_state`; now, `compose_state` is a typical global
variable with a 1:1 relationship with the module by the same
name.
The new module has 100% line coverage, most of it coming
via the tests on compose_actions.js. (The methods here are
super simple, so it's a good thing that the tests are somewhat
integrated with a higher layer.)
* reset the emoji popover in case of an event
regarding update of realm_emoji.
* test-node-with-js: Add dependency - popovers module;
In dispath.js to support popovers object.
* Whenever the emoji picker is opened a call is made to render
the emoji's. This rendering happend everytime the emoji picker
was opened. Thus, resulting in duplicates of emoji's getting
appended in the emoji picker over multiple open and close.
* This commit, is a fix to render the emoji's only once when the
emoji picker is opened for the first time. Further calls just
toggles the emoji picker showing the already rendered emoji's.
This enhances the performance of Emoji picker considerably
because there is no overhead of making a request to get the emoji's
from the server, each time the emoji picker is opened.
* Other changes -- on closing the emoji picker, the compose box
remains in focus.
Fixes: #4300.
See Also: #3952.
We now auto-open the compose box whenever somebody narrows to
a "pure" PM narrow. We already did this for buddy list clicks,
so this make it work the same for other ways of narrowing to
PM conversation. Here, we optimize for composing, vs. reading,
since PM conversations tend to have lots of back and forth.
(Contrast this to stream conversations, where there's a higher
likelihood of lurking or doing a quick narrow to re-read some
message from the stream.)
We don't want to auto-open the compose box for topic
sidebar clicks, because we want to convenience folks
reading messages, not writing messages, since on
stream narrows, people tend to do much more reading
than writing. (Also, opening the compose box explicitly
is super easy.)
The part of this change that affects behavior is that
we remove the call to compose_actions.start('stream').
Then the simplification is that we replace the checks
to narrowed_by_reply() and !narrowed_to_topic() with
a single call to narrowed_by_pm_reply().
Fixes#3886.