Mentions in the public view and mentions in the new message form do not
show the contacts menu when clicked, so the cursor should be the default
one instead of the pointer cursor.
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
The contacts menu can be shown only in user sessions; in the public view
it just fails and shows an error message instead of any useful option,
so now it is disabled for mentions in the public view.
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
When an element is detached and then attached again its scroll position
is reset to the top. Now the chat view provides the "saveScrollPosition"
and "restoreScrollPosition" methods to save the scroll position before
detaching its element and then restoring it when attached again.
Note that the position can not be exactly restored, as the size of the
chat view may have changed due to switching it from the main view to the
sidebar, and thus the visible messages can not be the same in both
cases. Due to this, restoring the scroll position just ensures that the
last message that was partially visible when it was saved will be fully
visible when it is restored.
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
The scroll area covers the top and bottom padding of an element, but not
its top and bottom margins, so the margins should not be taken into
account in the scroll calculations.
Currently this does not cause any difference in the behaviour, as the
message lists does not have any margin, but it is fixed just in case it
is added in the future.
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
When an element has a negative top margin jQuery returns its top
position as the position in where the element would be if it had no
margin. In a similar way, when there is a negative margin the returned
height is not the actual height of the element, but its height without
that margin.
The message list is expected to scroll to the newest message if the last
one is partially visible, but due to the jQuery behaviour the message
list did not scroll when the last message was grouped and less than 20px
(the negative top margin) of the content of that message was visible.
Now the negative margin is taken into account and the message list
always scrolls to the newest message if the last one is partially
visible.
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
When the oldest on top layout was added it was enabled by default,
although the original newest on top layout was also kept as an option.
However, the newest on top layout has not been used since then, and it
is not expected to be used ever again. To make the chat view more
maintainable and ease adding new features this commit removes the
original newest on top chat layout.
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
When the chat view used the oldest on top layout the "oldestOnTopLayout"
CSS class was suppossed to be added to its main element. However, when
the "className" method was executed the "initialize" method had not been
executed yet, so there was no "_oldestOnTopLayout" attribute even if it
was included in the options, so the CSS class was never set and thus the
CSS rules were never used.
The support for the newest on top layout is going to be removed, and the
common CSS rules were already being used for the oldest on top layout
without problems; due to this, instead of fixing the setting of the CSS
class, the specific CSS rules for the oldest on top layout were simply
removed.
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
The contacts menu is not shown in the public view for any user, so the
default cursor should be used for all the author rows.
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Note that "currentUser" is not set in the author row of guest users, but
this is not a problem; that CSS class is used only to show the default
cursor instead of the pointer cursor, but as all the author rows of
guest users show the default cursor it makes no difference if
"currentUser" is set for them or not.
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Instead of adding the "currentUser" CSS class to ".avatar" and ".author"
elements now it is added to their wrapping ".authorRow" element.
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
When a message shows the date separator its author row is explicitly
shown. This is needed to ensure that the author row will always be shown
in that case, even if the message is a grouped message. In normal
messages (those that are not grouped and do not show the date separator)
the author row is shown using "display: inline-flex", so the same value
should be used too for messages that show the date separator.
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
When a message is being sent the submit icon is hidden and the working
icon is shown instead. However, the working icon was not placed at the
same position as the icon it replaced; the CSS rules for the submit icon
were modified in some previous commit, but the CSS rules for the working
icon were not appropriately updated. Now the CSS rules were rewritten so
both elements use the same placement rules; this fixes the issue and
should make it less likely to happen in the future if the placement is
modified again.
Also, now the size is explicitly set to ensure that both elements have
the same size; before it depended on other rules, and which rules
affected the size were different for each element due to being of
different types.
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
The server expects mentions to be in plain text, so the formatted
mentions have to be converted to "@" followed by the user name before
the message is sent to the server.
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
CSS styles were directly copied from
"apps/comments/css/autocomplete.scss".
JavaScript code in the chat view
was slightly simplified from "apps/comments/js/commentstabview.js".
Currently mentions are not formatted when a message is being composed;
"@" followed by the user name is added to the message so it can be
directly sent without further processing. Formatted mentions will be
introduced in another commit.
Signed-off-by: Joas Schilling <coding@schilljs.com>
Clicking on a message author shows the contacts menu (provided the
author is not the current user); in those cases the cursor should be a
pointer so the user knows that an interaction with those elements is
possible.
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>