Commit Graph

2676 Commits

Author SHA1 Message Date
JC Brand
4015eb2fd1 Name anonymous function to fix failing test 2019-09-05 13:12:34 +02:00
JC Brand
b5c56c8323 Add getFullname to XMPPStatus model and use that
instead of returning the fullname as fallback in `getNickname`
2019-09-05 12:49:10 +02:00
JC Brand
5f5de90f0c MUC: Don't set a default nick
We first want to check whether the user has registered a nick with the
MUC, and if so, that will be set as the nick.
2019-09-05 10:49:06 +02:00
JC Brand
c8f0fd2a7f Refactor cleaner separation between converse-vcard and other plugins 2019-09-05 10:49:06 +02:00
JC Brand
3f0d88e88d Fix ids for the modtools modal 2019-09-04 15:18:51 +02:00
JC Brand
cf7d2fb648 Add webpack.nodeps.js
Use it to generate dist/converse-no-dependencies.js which we use to
generate the converse.pot file.
2019-08-23 21:36:27 +02:00
JC Brand
93de11d167 Dynamically load the dayjs translation.
Also, remove the Promise polyfill. We don't support browsers which don't support promises.
2019-08-23 14:03:52 +02:00
JC Brand
9f054dd767 Update webpack config
- hot reloading
- split config into dev and prod
2019-08-23 13:29:26 +02:00
JC Brand
76f2b66445 Add a po loader for webpack.
- Removes the need for generating and keeping json files
2019-08-23 11:42:37 +02:00
JC Brand
8aaf50d58c Use webpack's dynamic imports feature for fetching emoji JSON 2019-08-23 09:18:10 +02:00
JC Brand
d619012b6b Emojis: Fix failing tests 2019-08-23 07:05:00 +02:00
JC Brand
bb0670c6b2 converse-emoji-views: tweak threshold values 2019-08-22 16:26:10 +02:00
JC Brand
3b40f6964f Update Emoji JSON
* Order by category
* Set odering pre category (instead of just showing them alphabetically)
2019-08-22 16:21:27 +02:00
JC Brand
c01d110501 Avoid interference between username and emoji autocomplete 2019-08-22 14:30:02 +02:00
JC Brand
a59510bbf0 Highlight relevant category when scrolling 2019-08-22 13:56:47 +02:00
JC Brand
2c48096664 Add new spec with emoji tests 2019-08-22 13:56:47 +02:00
JC Brand
e4dc9fa820 Open emojis popup when TAB is pressed on a word starting with : 2019-08-22 13:56:47 +02:00
JC Brand
9099ef89fa Close emoji popup after insertion 2019-08-22 13:56:47 +02:00
JC Brand
73c8002b76 Add search bar for emojis 2019-08-22 13:56:47 +02:00
JC Brand
13d419102a converse-emoji-views: Show categories in chosen skintone 2019-08-22 13:56:47 +02:00
JC Brand
1cf9a936a4 Move Views associated to emojis into a new plugin 2019-08-22 13:56:47 +02:00
JC Brand
d7ce231c51 Various emoji improvements:
* Add emoji tooltip
* Make categories configurable and add smileys category
* Rearrange emoji categories and style
& Show all emojis together
2019-08-22 13:56:47 +02:00
JC Brand
4cb9fd88a8 Refactor emojis so that JSON is fetch asynchronously 2019-08-22 13:56:47 +02:00
Dele Olajide
4e440b0325 Update converse-chatboxes.js 2019-08-19 09:16:19 +02:00
Dele Olajide
f6c5f167f8 Fix Issue #1679
This fix forces Converse.js to respect auto_join_rooms and allow auto join room to occur with server-side generated random room names as required for XEP 0142 - workgroup queues
2019-08-19 09:16:19 +02:00
JC Brand
c9c689aec7 Docstring fixes 2019-08-16 15:44:58 +02:00
JC Brand
4291a45631 Postrelease 2019-08-14 13:15:16 +02:00
JC Brand
8f571ff148 Release 5.0.1 2019-08-14 12:56:44 +02:00
JC Brand
bcc73fe727 converse-muc: occupantAdded promise has been removed
Also:

* converted two docstrings into JSDoc format
* Don't use `_.isNull`
2019-08-14 12:14:02 +02:00
JC Brand
9c024757b6 Bugfix: TypeError: o.getAttribute is not a function converse-chatview.js
can cause messages to not appear.

* Check against null not Element.
* Avoid iterating over non-Element nodes
2019-08-14 12:10:32 +02:00
JC Brand
3faaf6a62b converse-muc: Fetch messages in the initialize method
Lately we've been fetching messages only after entering the MUC, so that
we already have occupants to attach to them (due to `fetchMembers` being
called before) and thereby avoid rerenders.

I've now moved message fetching into the `initialize` method and added
missing event handlers for attaching/removing the occupant from a
message as it comes online or goes offline.

We still avoid (some) rerenders because we fetch and wait for cached
occupants before fetching cached messages and we wait for `fetchMembers`
before triggering `enteredNewRoom` which causes MAM messages to be
fetched.
2019-08-14 11:08:05 +02:00
JC Brand
fa59b22f93 converse-message-view: Move methods from view to model 2019-08-13 15:34:59 +02:00
JC Brand
21a9ea7365 converse-message-view: Add hooks before/after message text transformations 2019-08-13 15:31:05 +02:00
JC Brand
502d2aa064 converse-message-view: Refactor to not use _.partial or _.flow 2019-08-13 11:46:51 +02:00
JC Brand
89ac4a6969 Show error message with option to retry when MAM query times out 2019-08-13 11:08:03 +02:00
JC Brand
cb10c28082 modtools: Test that error renders when not allowed to fetch affiliation list
Also fix scrolling bug
2019-08-12 12:45:12 +02:00
JC Brand
c490ba212d converse-muc: Avoid refetching messages from cache
We want to fetch messages from cache only once. For one-on-one chats
this is the case because messages are fetched only in the `initialize`
method.

This used to be the case for MUCs as well, until we added the option
`clear_messages_on_reconnection`.

Now we only fetch messages after the user has entered the MUC.
2019-08-10 18:47:49 +02:00
JC Brand
e45bd5fc36 converse-roomslist: Handle bookmark not existing 2019-08-10 14:12:20 +02:00
JC Brand
02e50ca3a3 converse-mam: Don't fetch MUC MAM messages on chatReconnected event
By this time the cached messages are not yet fetched, causing the entire
MAM archive to be queried.
2019-08-10 14:12:20 +02:00
JC Brand
ea123e9713 Handle IQ timeouts
* converse-muc: Handle timeout while fetching affiliation list
* converse-omemo: Handle IQ timeout
2019-08-10 14:12:02 +02:00
JC Brand
a407aff33c converse-ping: Refactor and update to reconnect upon ping timeout 2019-08-10 12:26:07 +02:00
JC Brand
aa9aad918f Handle case where bookmark doesn't exist for some reason 2019-08-10 12:06:01 +02:00
JC Brand
aee6a192d1 Add a new command /modtools
in which you can set user affiliations and roles.

Also, let getAffiliationList return an Error instead of `null` if you're
not allowed to fetch a particular affiliation list.
2019-08-09 23:30:14 +02:00
JC Brand
a03e722a24 Add new dev version 2019-08-09 00:58:43 +02:00
JC Brand
bc27b3a36a Release 5.0.0 2019-08-08 18:13:12 +02:00
JC Brand
1bbe52f71c Fixes #1670
Set converse-profile as dependency of converse-omemo
2019-08-08 16:20:55 +02:00
JC Brand
bea073a5a2 Fix erroneous "is no longer an admin/owner" messages in MUCs
Don't remove affiliation for occupants if we weren't allowed to
fetch that particular affiliation list.

Previously, if fetching the list failed, we would return an empty array,
which would imply that the affiliation list is empty and that all
users with the given affiliation should have their affiliations removed.

Instead we now return `null` and properly account for that when setting
affiliations on existing contacts based on the returned member lists.
2019-08-08 16:19:04 +02:00
JC Brand
ade6266de8 Update backbone.overview and strophe.js 2019-08-08 12:45:17 +02:00
JC Brand
720096726d converse-chatboxes: Don't refetch chatboxes upon reconnection
We don't remove the existing chatboxes and upon refetching they
become stale and get removed (by Backbone) and then the UI for
them becomes unresponsive.
2019-08-07 16:12:51 +02:00
JC Brand
c0ef008c4a converse-bookmarks: Call _converse.Collection.prototype.clearSession 2019-08-07 16:12:21 +02:00
JC Brand
b176161ecf converse-roster: Reconnection bugfixes.
Don't remove cached presences in `afterTearDown` event.
We might reconnect again and resume the session, in which case we need
that data still.

Instead, we remove cached presences when `clearSession` fires, because
then we know we're not reconnecting.

When reconnecting, we don't fetch presences from cache, we still have
them (since we no longer remove them in `afterTearDown`).

When reconnecting and not resuming, we clear the presences from cache,
since we're starting a new session.
2019-08-07 16:11:36 +02:00
JC Brand
3dc2b2b695 Bugfix. List of messages need to be passed to api.alert.show 2019-08-07 12:20:20 +02:00
JC Brand
11d8450577 Add note to translators to avoid confusion 2019-08-07 10:52:20 +02:00
JC Brand
dfe8194072 Show spinner when fetching messages by scrolling upwards 2019-08-07 10:47:11 +02:00
JC Brand
271a871a51 Updated i18n po, pot and json files 2019-08-07 10:28:49 +02:00
JC Brand
5cb5ec4640 Fixes #1668. MUC MAM blocked by "info" messages 2019-08-06 23:30:02 +02:00
JC Brand
7bfb172f6e Updates #1548. MAM paging improvements.
* Explicit forwards and backwards paging
* Include upper or lower bound when calling `RSM.prototype.next` or `RSM.prototype.previous`
* Bugfix: Don't override new RSM parameters (caused infinite recursion)
2019-08-06 22:54:51 +02:00
JC Brand
0d2c36dca6 converse-muc: use minimized attr instead 2019-08-06 13:32:52 +02:00
JC Brand
8864925407 Bugfix. Make sure new attrs are applied. 2019-08-06 13:07:41 +02:00
JC Brand
bda567ca01 Fix linting errors 2019-08-05 11:26:48 +02:00
JC Brand
db550b3ec7 Rename controlboxInitialized to controlBoxInitialized
to conform to conventions
2019-08-05 11:10:39 +02:00
JC Brand
ef5ecb2f3a Decouple converse-controlbox and converse-profile 2019-08-05 11:07:38 +02:00
Réda Housni Alaoui
edcb8e28c2 Fix #1664 Blacklisting converse-profile makes the control box totally blank 2019-08-05 11:01:39 +02:00
JC Brand
d90bcd5274 Combine two versions of isOnlyChatStateNotification into one
Also fix a bug in the code dermining whether an XMLElement stanza is only a chat state notification
2019-08-05 10:58:38 +02:00
JC Brand
7a590f7c22 Stop using certain lodash methods.
* _.isNil
* _.noop
* _.isNull
2019-08-05 10:56:22 +02:00
JC Brand
78c7ded2e5 converse-disco: Catch and report errors that happen during tests 2019-08-05 10:33:00 +02:00
JC Brand
021143d6ac Bugfix. Don't clear roster when tearing down
We do that in `clearSession` and otherwise when we auto-reconnect we end
up without a roster.
2019-08-04 01:38:41 +02:00
JC Brand
7861ed7b54 Fixes #1403: Rename show_chatstate_notifications
to `show_chat_state_notifications`
2019-08-03 21:52:14 +02:00
JC Brand
8a9a0a4b19 Add support for paging through MAM results when catching up
Fixes #1548
2019-08-03 21:44:02 +02:00
JC Brand
c7b6bb4773 Only clear messages when clear_messages_on_reconnection is true 2019-08-03 21:43:06 +02:00
JC Brand
c038794fb5 converse-mam: Light refactoring and cleanup 2019-08-03 21:43:06 +02:00
Réda Housni Alaoui
c2db667321 Shadow dom: TypeError: Cannot read property 'parentElement' of null caused by MinimizedChatsToggleView 2019-08-02 16:30:25 +02:00
JC Brand
5f0a0138a0 Finegrained config of XEP-0095 CSNs for MUCs as well 2019-08-02 12:05:19 +02:00
JC Brand
ec85490f1c Allow configuration of which XEP-0095 CSN's may be sent out 2019-08-02 11:34:24 +02:00
JC Brand
550d0ae31b Bugfix. Chat state should be set to active on chat maximized 2019-08-02 11:15:17 +02:00
JC Brand
6dbc0a0637 converse-dragresize: Remove the resize event listener 2019-08-02 10:47:05 +02:00
JC Brand
3b29e5754d Don't unnecessarily fetch the roster
If we've fetched the roster before within this session, then we don't
have to do so again, regardless of whether versioning is supported or
not, otherwise, even if we have a cached roster, we still need to get
the latest one again.
2019-08-02 10:46:30 +02:00
JC Brand
d5ed1bfafe Remove the coupling between converse-controlbox and converse-rosterview 2019-08-02 09:12:04 +02:00
JC Brand
0b43082383 Add check and update changelog 2019-08-01 16:26:29 +02:00
JC Brand
cd392bb197 Fixes #1561 Don't clear localStorage and sessionStorage 2019-08-01 11:34:14 +02:00
JC Brand
1bc9a7f809 Ensure JID is set when userSessionInitialized triggers.
Otherwise `converse.features` cache id contains `null` instead of the
user JID and it doesn't clear correctly.
2019-08-01 08:57:34 +02:00
JC Brand
f0f7cfab42 Make the chatbox messages cache key overridable 2019-07-31 17:19:50 +02:00
JC Brand
5b64b5a0e3 The locales URL should be absolute 2019-07-31 16:13:33 +02:00
JC Brand
1eb2364336 Let sendMessage return the message model, not just the text 2019-07-30 16:15:47 +02:00
JC Brand
afa2543492 Honour the auto_login flag
by not logging in automatically when `auto_login` is `false` and we're
using anonymous, external or prebind authentication.

For `authentication` set to `login` the situation is much more
ambiguous, since we don't have a clear distinction between wether we're
restoring a previous session (`keepalive`) or whether we're
automatically setting up a new session (`auto_login`).

So currently if *either* `keepalive` or `auto_login` is `true` and
`authentication` is set to `login`, then Converse will try to log the
user in.
2019-07-29 16:35:17 +02:00
JC Brand
f12c024b99 Don't query MAM upon every page load.
Instead we should only query for newly created chats.
2019-07-29 15:41:03 +02:00
JC Brand
8bd72eed72 Don't keep on refetching roster if the service is unavailable
`sendIQ` now takes a flag to turn of rejection of the promise and to
resolve on error IQs instead.
2019-07-29 14:33:37 +02:00
JC Brand
bdbcec65c6 Update JSDoc strings. Combine two methods 2019-07-29 11:36:37 +02:00
JC Brand
aa30e4d9e8 Bugfix. Don't unnecessarily fetch roster again when it's empty 2019-07-29 11:20:33 +02:00
JC Brand
e20b654876 Stop using _.isUndefined 2019-07-29 10:32:29 +02:00
JC Brand
caad85f45b Manually remove BOSH session tokens from cache
even if the `_converse.bosh_session` instance does not exist.

We do this to avoid trying to reconnect with stale tokens upon
reconnection. Especially relevant for anonymous connections, but could
also be applicable when switching between websocket and BOSH connections
when reconnecting.

Also renamed `startNewBOSHSession` to `startNewPreboundBOSHSession`
2019-07-29 10:08:38 +02:00
JC Brand
f9cc51b28a Bugfix. Make sure that restoreBOSHSession is always called
I.e. also when we're reconnecting.

Otherwise the `_converse.bosh_session` object doesn't get recreated and
we don't cache the BOSH tokens.
2019-07-29 10:05:31 +02:00
JC Brand
179c0810c7 Prioritise logging in with credentials_url...
above logging in with passed in JID and password, since the password
might be an expired token.
2019-07-26 20:03:32 +02:00
JC Brand
778b4ff131 Bugfix. Fix check for debounced reconnection 2019-07-26 20:02:56 +02:00
JC Brand
5a48f3da23 Clone auto_join_rooms values before passing in
otherwise values get tacked on, causing problems when reconnecting.
2019-07-26 19:30:01 +02:00
JC Brand
6dd4fc5234 Tear down previous session when reconnecting anonymously
Because when we reconnect anonymously, we get a new JID, so it's as if
it's a completely new user.
2019-07-26 19:29:01 +02:00
JC Brand
a1d7076e93 Let initConnection wait for for _converse.api.login
So that the BOSH connection will be restored before we trigger `connectionInitialized`
2019-07-26 18:57:28 +02:00
JC Brand
fd4ba89182 Reconnect when an anonymous connection drops or fails. 2019-07-26 18:50:19 +02:00
JC Brand
ea36d53f78 Re-add the keepalive options.
It's unlikely that `keepalive` needs to be set to `false`, but there are
some edge cases where it might be useful.

Here's a breakdown of the different configurations of `keepalive` and `auto_join`:

---

* auto_login: false, keepalive: true

This is the default config. Users need to log in manually, but then
Converse will try to reconnect them when the page reloads.

* auto_login: true, keepalive: true

Also very popular configuration. Used with `credentials_url` or `prebind_url`.

* auto_login = `true`, keepalive = `false`

Not sure what this could be useful for. No currently known application.

* auto_login = `false`, keepalive = `false`

Useful when you want some kind of specific action to trigger login, but
you don't want to maintain that state across page reloads.

Also relevant when using a websocket connection with anonymous login.
With websocket it's impossible to maintain anonymous sessions across page
reload because the the session gets removed server-side as soon as the
websocket connection drops and the server won't accept a full JID with
password for an anonymous connection anyway (which could happen upon
page reload when Converse tries to login in again if `keepalive` was `true`).
2019-07-26 18:08:38 +02:00
JC Brand
b6b085189b Attempt to restore BOSH session or auto_login before...
triggering connectionInitialized.

That way, when listening for `connectionInitialized`, we'll know when it
fires whether we've attached to a BOSH connection or not.
2019-07-26 16:43:35 +02:00