Commit Graph
1582 Commits
Author SHA1 Message Date
Aaron Bohy 8397abd871 [IMP] mail: make chat windows somehow usable in mobile 2016-01-14 11:22:26 +01:00
Aaron Bohy 54396cfa41 [FIX] im_livechat,mail: don't automatically detach chat channels
This reverts commit a8239cd as the navbar dropdown recently introduced now
offers a quick access to channels without coming back in the Discuss App.

Moreover, this commit emphasizes the notifications navbar icon when there are
unread messages (or at least, it mutes it when there isn't).
2016-01-14 11:22:26 +01:00
Aaron Bohy 916d90af35 [IMP] mail: open dm shortcut from in navbar dropdown
Allows to directly open a dm channel from a chat window, without coming back
to Discuss.
2016-01-14 11:22:26 +01:00
Aaron Bohy b3868a613c [IMP] mail: needaction/unread messages counters
Some UI changes:
  - Unread messages in chat are now displayed as needactions in the Discuss's
sidebar (badge with counter of unread messages, instead of simply bolding the
channel name).
  - The counter displayed in the navbar is now the sum of needactions and total
of unread messages in chat.
  - The counter displayed next to Inbox is still the needaction counter.

For consistency between tabs/browsers/devices, the channel_seen info is now
broadcasted, meaning that every tab/browser/device will be noticed.

Also now correctly increment the unread counter of a channel if the received
message is a needaction.
2016-01-14 11:22:25 +01:00
Aaron Bohy d93231afe2 [IMP] mail: navbar: messaging menu
The navbar notification is now a dropdown containing a preview of all pinned
channels (except Inbox and Starred), channels with unread messages being on the
top.

It allows to quickly detach a channel without going back to Discuss.

The channels preview fetching is performed only once, and it is done in
background without blocking the whole UI (using shadow option or session.rpc()).

Also fixes a synchronization problem between server and client about the folded
state of channels (the info wasn't stored client side, so it produced weird
situations, e.g. unfolding a channel didn't actually unfold it).
2016-01-14 11:22:25 +01:00
Aaron Bohy 0301735354 [IMP] mail: move 'New message' button from navbar to Inbox 2016-01-14 11:22:25 +01:00
Aaron Bohy 18fccd9d6c [IMP] mail: put chat windows in a dropdown in case of overflow
Former algorithm to display chat windows was pretty basic: each window was
positionned 5 pixels to the left of the previous one, starting from the bottom
right corner of the screen. Thus, when there were too many chat windows to fit
in the screen, they overflowed to the left.

This rev. handles this case by hidding overflowing chat windows and making them
available in a dropdown positionned 5 pixels to the left of the last visible
chat window.
2016-01-14 11:22:25 +01:00
Aaron Bohy 37238d343a [FIX] mail: notifications: strip html tags
but keep jumps to line
2016-01-14 11:22:25 +01:00
Martin Trigaux ce2d94207b [FIX] mail,web: : untranslated term in view
_t(...) in xml qweb views do not work, not exported, not evaluted.
No reason to use t-att-*, just using simple attribute is enough.
2016-01-13 15:48:09 +01:00
Thibault Delavallée fd57dd5713 [IMP] mail: chatter: hide notification buttons
Using some templates it is possible to have odoo buttons directly in the
mail_message body. Hide them in the chatter as this is more noisy than
usefull.
2016-01-13 10:34:09 +01:00
Géry Debongnie 53f4649334 [FIX] mail: use our own autoresize for composer inputs
Instead of duplicating the autoresize logic, we might as well use it for
everything.
2016-01-11 14:32:51 +01:00
Géry Debongnie cf294f723f [FIX] mail: prevent double scrollbar with notification bar
when the bar asking for notification permission appears, it can cause
two scrollbars to appear in the client action.  This commit moves the
notification bar inside the chat content, which solves the issue.
2016-01-11 11:00:18 +01:00
Géry Debongnie 739301be09 [FIX] mail: add link to urls clientside, not serverside
the server should avoid as much as possible modifying emails.  Adding
links is a presentation concern, so this commit moves this logic client
side.
2016-01-08 15:02:22 +01:00
Aaron Bohy 0fbc128033 [FIX] mail: followers: subtypes: correctly notify channels
Except for messages, activities on a document like internal notes posted
trigger notifications to partners and channels following the corresponding
activity's subtype.

Rev. 69ed801 rightly re-introduces a filter on followers to prevent notifying
more partners than necessary. Unfortunately, this filter doesn't take into
account channels, which are thus automatically removed from followers to
notify, whatever the subtypes they follow, e.g. internal notes on a document
don't appear in channels following the 'Note' subtype of this document.

This commit makes sure that channels always pass through that filter, but warns
users that public channels should probably not following internal subtypes.

Also makes the edit subtypes dialog html valid (li's must be inside, e.g., ul).
2016-01-08 14:32:51 +01:00
Christophe Simonis 329c6e7763 [FIX] mail: check if browser support Notification API before verifying permission 2016-01-08 11:48:34 +01:00
Aaron Bohy c4240b547f [FIX] mail: chatter composer: full composer button
The chatter composer extends the basic composer to, among other things, add
a button to open the full composer next to the button to add an attachment.

In a recent commit, the basic composer template has been slightly changed and
the buttons have been extracted in a sub-template, which seems to break the
template inheritance (the xpath refers to one of those buttons).

This solution simply removes the sub-template and duplicates the code.
2015-12-29 15:59:54 +01:00
Aaron Bohy 3f370651c7 [FIX] im_livechat,mail: don't translate html data-type argument
as it is only there for a technical purpose (used in JS to bind event handlers)
2015-12-29 15:59:54 +01:00
Géry Debongnie cc8c355ecb [IMP] mail, bus: display native notifications if user away
This commit introduces native notifications (if available) to the
discuss application.

Those notifications will only appear if the user grants the permission
for that.  A notification bar will appear in the discuss application if
necessary to prompt the user.

Also, it always is the master bus that will be the one sending the
notification.

For this change, it was necessary to be able to detect if the user has
the focus on some other odoo tabs.  For this reason, the bus was
extended.
2015-12-29 14:47:40 +01:00
Aaron Bohy 30003dbce3 [FIX] im_livechat,mail: various ui fixes/improvements
im_livechat:
  - feedback message wording
  - livechat_channel form view typo

mail:
  - channel form view: email_send field label wording and layout
  - notifications preview extended
  - client action mass mailing composer fine tuning
  - client action mass mailing channels tooltip
  - client action idle bullet color
2015-12-28 10:19:22 +01:00
Aaron Bohy f6c20fa4b3 [FIX] bus,mail: user presence
Commit 5d1b323. re-enabled the user presence updates and notifications.
Unfortunately, it showed poor performance due to the high frequency of bus
notifications triggered on our instance (~600k users).

In this rev., we don't trigger notifications on presence changes anymore, but
we rather send the presence of users we have a DM open with, at the end of each
poll period. For performance reasons, we ensure not to do that more than once
every 30 seconds.

We also refined the detection of the 'away' status client side. 'Last presence'
timestamps are stored in the local storage, and the current inactivity period
is sent at each poll. Those presence timestamps now rely on browser activity
detection (click, keypress... events) rather than on the focus on Odoo tabs.

Finally, we removed the no more necessary cron introduced in 5d1b323.
2015-12-24 12:59:46 +01:00
Aaron Bohy 26b00a844a [FIX] mail: client action: traceback on composer focus
wrong copy-paste introduced in c4fb2b50e0.
2015-12-24 09:05:28 +01:00
Géry Debongnie c4fb2b50e0 [IMP] mail: extended composer for mailing channels
In Discuss, when the user opens a channel, the composer was the same,
regardless of the channel type.  This is fine for chat channels, because
we expect mostly small one liners to be written.  But for mailing
channels, it is a problem:  it is too easy to send a mail to everyone
just by typing ENTER, when the user wanted to go to the next line.

This commit introduces a new widget, the extended composer, to be used
for those channels.  It allows the edition of the subject line, and
don't sent messages when the enter key was pressed.
2015-12-23 14:37:41 +01:00
Aaron Bohy 5d1b3232fc [FIX] bus,mail: user presence
Before this rev., no notification was sent on the bus when the user presence
changed. Thus, the bullets displayed in Discuss were never updated and stayed
as they were on the initialilization of the chat_manager (on webclient launch).

This rev. makes the bus.presence notifications work, and handles them client
side.

Moreover, the disconnections detection is now performed at each poll (with a
maximum of 1 per minute), instead of randomly (1/100 chance) at each poll, as
it scales better than the former solution. We also added a cron that performs
this check every 5 minutes. It is needed to detect that the last connected user
just disconnected (useful for visitors in the website, trying to talk with a
livechat operator).

Also, the 'away' status is now handled client side, as it makes more sense
that way (being away at each poll, e.g. every 50seconds, during 10 minutes
doesn't mean that we didn't come back between two polls).

Finaly, in bus.js, CrossTabBus, we moved the code writing in/reading the local
storage after the tab registration as this code depends on the fact that the
tab is the master tab or not (and this is known only once the tab is
registered).

This rev. was necessary in stable because the livechat uses the user status to
detect if there is an operator available, and this was often inaccurate.
Moreover, it improves the user experience of the chat in the backend.
2015-12-16 15:48:43 +01:00
Aaron Bohy 89ba0a811b [FIX] mail: traceback on new msg in unpinned closed livechat
The traceback ocurred when the operator closed a livechat channel chat window,
and then unpinned it from the sidebar in Discuss. Then, if the visitor sent
him a message, the channel was automatically re-pinned to the operator, who
received two notifications: the first one being the new channel info and the
second one the message itself.

The channel fold_state being 'closed', the window manager was trying to close
it again, which produces the traceback as the channel didn't exist in the JS
cache anymore (it was re-added to the cache when processing the message
notification, so just after).

Anyway, closing this channel was useless as, even if it was in the cache, it
would already been closed. So this rev. simply checks whether or not the
channel is in the cache before trying to close it.
2015-12-16 15:48:43 +01:00
Aaron Bohy 2b99a36921 [FIX] mail: sent messages are plaintext
The problem was that users couldn't write characters like <, > in their
messages because the messages are html (e.g. '3 < 5' resulted in '3' because
this wasn't html valid so the second part was trimmed).

Because of mentions, we can't force messages to be plaintext (mentions are
processed and replaced by html links before the message is stored in DB).

The solution is to escape them just before processing the mentions. In the case
of chat windows, we must be careful because chat windows are also used for the
livechat, for which messages are plaintext. So the escaping should be done for
chat windows in the backend, but not in the livechat.
2015-12-16 15:48:42 +01:00
Aaron Bohy f5e4fbb20c [FIX] mail: correctly redirect to channels
Clicking on a channel link should open that channel in Discuss, not the channel
form view.
2015-12-16 15:48:42 +01:00
Aaron Bohy 17896a92da [FIX] mail: various ui improvements/fixes
* chat windows:
  - input was kicked out of the window on chrome 43
  - don't animate if folded by default (e.g. after a refresh)
  - width and height 100% like in the frontend
  - z-index to make sure that they are over bootstrap active btn,
    but below notifications, and modals

* chatter:
  - internal note: send button renammed to 'Log'
  - send button is the first button again
  - remove annoying form view widget's tooltip

* client action: focus on composer on channel change
2015-12-15 10:01:21 +01:00
Aaron Bohy e47d4c61d2 [FIX] mail: client action layout: scrollbar in the sidebar
There was a weird bug on chrome when there was a scrollbar in the sidebar, as
the right part of the client action overlapped that scrollbar. The problem was
seemingly linked to the use of flex, which is removed by this rev.

Courtesy of QSM
2015-12-11 17:48:11 +01:00
Géry Debongnie a53bd87585 [FIX] mail: various UI improvements to chat interface
- don't display user name in chat windows
- scroll to the new messages separator if it exists (in client action)
- increase sidebar width
- add correct link href in threads
- hide chat window in mobile mode
- mail: ignore o_mail_redirect or o_channel_redirect, but redirect anyway
2015-12-11 14:04:59 +01:00
Nicolas Martinelli 0ba93ef621 [FIX] mail: trim message and no empty message
Trim message as in Discuss and do not send empty messages
2015-12-11 10:33:27 +01:00
Géry Debongnie 2d54310096 [FIX] mail: use correct formview on redirection
this prevents the following problem: clicking on a message generated by
an opportunity in discuss leads to the lead form view.
2015-12-09 14:00:56 +01:00
Aaron Bohy ad14862907 [FIX] mail: various ui improvements/fixes
- display full content of messages in Discuss
- no content helpers in inbox and starred improved
- mark as read tooltip instead of mark ad done
- decrease font size in chat windows
- increase chat windows dimensions
- display avatars in chat windows
- chat window background is now white
- notes are displayed with a darker background
2015-12-09 11:20:25 +01:00
Géry Debongnie bff2fcde3c [FIX] mail: correctly handle message on star/unread updates 2015-12-09 11:20:21 +01:00
Aaron Bohy 6cf8ebab3d [FIX] mail: escape user and channel names to prevent xss
However, users shouldn't be allowed to have xss in their name, imo.
2015-12-09 11:16:24 +01:00
Aaron Bohy 085f6e0e68 [FIX] mail: multiple clicks on navbar needactions icon
Clicking on this icon redirects to the client action (for now at least). By
quickly clicking several times on it, we try to restore the scroll position of
a channel that not yet exists. This rev. prevents from getting a traceback in
that case.
2015-12-09 11:16:24 +01:00
Nicolas Martinelli 07425d407f [FIX] mail: replace special characters
When the delimiter '@' is used in the composer, a regular expression is
built in order to suggest followers. However, if this regular expression
is incorrect, it causes a crash since RegExp will throw a syntax error.
Since a new regular expression is built for each new character the user
types, this situation can occur very easily. For example, typing '@('
will cause a crash.

This fix replaces characters which may easily lead to a syntax error by
a space.
2015-12-09 09:36:41 +01:00
Aaron Bohy 51461d591d [FIX] bus,mail: edit title and play sound on new message
Concerns only chat messages.
2015-12-08 16:30:37 +01:00
Nicolas Martinelli 6eba2582b6 [FIX] mail: localized time
Time is now localized in the discussion.
2015-12-08 15:44:04 +01:00
Aaron Bohy 8b216f1b9f [FIX] mail: thread: oe_mail_expand: execute handler once
The read_more button displayed in long messages is an <a> inside a <span>, both
having classname oe_mail_expand, and an handler in bound on that classname
since rev. 169f819a. This handler was executed twice when clicking on that
button, toggling twice the message's bodies long and short, thus doing nothing.
2015-12-08 10:01:18 +01:00
Aaron Bohy 169f819ab1 [FIX] mail: read more: prevent default
Long messages are not displayed entirely, but a 'read more' button is displayed
and allows to show the whole message. This button is an <a> inside a <span>,
both having classname 'oe_mail_expand'. Also note that messages are html, not
plain text.

Sometimes, the long message is truncated at some point that the 'read more' is
inserted inside an <a>, which is not html valid (nested links). In this case,
the browser automatically moves the inner <a> out of the outer one.

Unfortunately, when that happens, clicking on 'read more' redirects to the app
switcher because of missing prevent_default(), as the event handler was bound
on the <span> clicked, not the inner <a>.

This rev. simply binds the handler on 'oe_mail_expand', not specifically on
its <span>.
2015-12-07 16:32:27 +01:00
Aaron Bohy 77acb57e55 [FIX] mail: correctly increment channels' unread counter
When several channels followed the same document, and a message was sent in
this document, the unread counter of each channel was incremented by the number
of following channels (because as many notifications were sent on the bus, and
for each notification, we incremented the unread_counter of the channels in
which the corresponding message is posted).

This rev. makes sure to only increment the unread counter once, if the message
is not yet in the JS cache, i.e. if this is the first notification we receive
for this message.
2015-12-07 16:32:27 +01:00
Géry Debongnie 27a455fc92 [IMP] mail: various improvement
- don't display subject for messages coming from chatter
- better tooltip on the leave channel button in client action sidebar
- don't squash nearby messages in chatter
- reduce margin of date separator in chat windows
2015-12-07 16:14:46 +01:00
Aaron Bohy f09ca9c777 [FIX] mail: followers: display followers and fetch subtypes
This commit fixes two bugs on followers:
- when landing on a form view, the followers' dropdown is now correctly filled
- when editing the subtypes of a follower while not being ourself a follower,
  the subtypes are now correctly displayed in the modal.
2015-12-03 16:13:40 +01:00
Géry Debongnie b6a4e43c02 [FIX] mail: fix full composer messages
Full composer messages were not loaded in the chatter when sent.  We
lost that functionality sometimes in the previous months.  This commit
makes it work properly again.

Some refactoring were required, we needed a way to load messages with a
given res_id and model.
2015-12-03 15:50:02 +01:00
Nicolas Martinelli 0644cfc543 [FIX] mail: message not found
message_ids contains the ids of all the messages. However, a maximum of
100 messages are fetched when a page is open, and therefore some
messages might not be found in the JS cache. This leads to
message.is_needaction throwing an exception.

This fix returns True if the message is not found. It means that the
message will be set as 'read' even if it is not displayed.

opw-657896
2015-12-03 15:31:18 +01:00
Aaron Bohy 7bea8412c5 [FIX] mail: href of mention links in sent messages
Those messages can be read from the client action interface, where the onclick
redirection is properly handled, but they are also sent by email. The
generated links should thus have a correct href.
2015-12-03 11:21:47 +01:00
Aaron Bohy e7cb3dcaa8 [FIX] mail: don't redirect to user's own partner form view
Clicking on the author of a message opens a DM with the corresponding user if
there is one, and opens the corresponding partner's form view otherwise.

When the author is the current user, obviously we don't want to open a DM with
ourself, but we probably don't want to open our partner form view either, which
was exactly the behavior before this rev.
2015-12-03 11:21:47 +01:00
Aaron Bohy 33ac65c805 [FIX] mail: redirection handling in chat windows
- clicking on a channel mention (or a user) from a chat window opens a new chat
  window for that channel
- clicking on any other link in a chat window correctly opens the corresponding
  document

2 minor changes were required:
- use do_show() instead of on_reverse_breadcrumb() to update control panel and
  url in client action, as other actions can be stacked over the client action,
  e.g. by clicking on a document link in a chat window. In that case, the
  on_reverse_breadcrumb callback wouldn't be set, and thus the control panel and
  url wouldn't be updated by coming back to client action using the breadcrumbs.
- channel_join() now checks whether or not the channel has already been joined
  (i.e. if it is in the JS cache) before performing the RPC. This check was
  performed by each caller, so this simplifies the code.
2015-12-03 11:21:47 +01:00
Géry Debongnie 2d2daccfba [FIX] mail: hide chatter when printing in browser
The chatter is not supposed to be visible when printing a form view.
2015-12-02 12:24:55 +01:00
Géry Debongnie 2c84cd4181 [FIX] mail: various improvements/fixes
- display appropriate message when no results are found in a search
- don't display 'you have been invited' notif when creating private channel
- correctly join when a user was invited in a public channel
- display a message when a user join a channel through an invitation
- don't display subject for message of type notification (still a
  mystery why it happens in test.odoo.com for channel of type mailing)
- better heuristic on when to display message subject
- tweak sidebar text color (slightly whiter)
- add ... to the placeholder of the text area in the composer
- invert send and icons for attach/smiley in composer
- don't display 'read less' on expanded messages
- exclude livechat channels from channel mention suggestions
2015-11-27 11:47:34 +01:00