Commit Graph

903 Commits

Author SHA1 Message Date
JC Brand
59e216ad34 muc: no need for message_queue...
since we create the `fetched` promise earlier
2020-10-29 10:36:28 +01:00
JC Brand
c750748b8d Only create new message models once messages have been fetched
Fixes #2241
2020-10-29 10:36:28 +01:00
JC Brand
c08ee00fcd Enforce uni-view in headless code
When we're showing only one chat at a time, we want to make sure that
all other chats have their `hidden` flag set to `true`.

Previously this was done in chatboxviews, but given that we want to
render UI based on state, this should be done in the headless part of
Converse.

As a result of the changes, the `beforeShowingChatView` has been
removed.
2020-10-27 13:00:43 +01:00
JC Brand
00466cd550 Let the converse-loaded event conform to the CustomEvent spec
https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/CustomEvent
2020-10-26 13:09:15 +01:00
JC Brand
5a2d361c81 Fixes #2293: Message carbons not re-enabled when reconnecting 2020-10-23 21:58:47 +02:00
JC Brand
4252a17f62 Fixes #1642 Add option to hide participant list by default
In the process, turn it into a component
2020-10-23 21:18:05 +02:00
JC Brand
8c1e886af9 Fixes #2302 Bookmarks get duplicated on server push 2020-10-23 16:22:40 +02:00
Xavi
15f5b185c3
Fix message reorder issue after edit (#2300)
* keep message in place after edition by assigning previous message original timestamp
* update time displayed to keep current behaviour
* add test to check a message remains in the same position of the history after being edited
* briefly describe pr changes in changelog
2020-10-23 15:07:56 +02:00
Dele Olajide
646542602f fix #2304 - Custom emojis (stickers) images not shown 2020-10-21 11:01:08 +02:00
JC Brand
7803fd2335 Clear chat boxes when clearing cache 2020-10-20 14:28:09 +02:00
JC Brand
19dc66900d Split the trusted setting into two new ones:
- `allow_user_trust_override`
- `clear_cache_on_logout`

The `persistent_store` setting can now also be set to `sessionStorage`

The `trusted` settings was in effect playing the role of two separate settings
and implicitly affecting a third ('persistent_store').

By breaking it up, we make things more explicit and allow for new
configurations. For example, clearing the cache on logout, while using
some kind of persistent store.
2020-10-20 11:29:03 +02:00
JC Brand
5341a1ea49 MUC: warn instead of error when we're no longer connected 2020-10-19 12:07:28 +02:00
Bernard Ngandu
e49f97472a
#2280 notify changes to client on bookmark-update (#2287)
* notify changes to client on bookmark-update
* update XEP-115 caps verification string
2020-10-14 13:09:33 +02:00
JC Brand
48f119b673 MAM: use bare JID as by attribute for archive-id
in 1:1 chats.

See: https://xmpp.org/extensions/xep-0313.html#archives_id
2020-10-13 04:48:21 +02:00
JC Brand
fb773d5d9b smacks: Unregister smack stanza handlers on disconnect 2020-10-09 15:26:29 +02:00
JC Brand
ab0521ebfb smacks: move functions out of plugin's initialize method 2020-10-09 14:52:56 +02:00
ChaosKid42
c9ba42d0a0
regression of #1317: Don't show errors for CSI messages (#2276)
* regression of #1317: Don't show errors for CSI messages
* fix failing tests
2020-10-08 12:13:04 +02:00
JC Brand
af4fd3b0c2 MUC: connect with stored password, if available 2020-10-07 15:42:17 +02:00
JC Brand
7aee9c4432 muc: simplify api.rooms methods.
- Let `api.rooms.open` call `api.rooms.get` directly, instead of indirectly via `api.rooms.create`
- Remove the `createChatRoom` function
- Also strip URI parts from JID in `api.rooms.get` and use utility method for doing so
2020-10-07 15:31:13 +02:00
Xavi
86c04b876b
Allow mention autocomplete to trigger right after a new line (#2267)
* catch all whitespace characters instead of just new line
2020-10-07 11:05:18 +02:00
Christoph Scholz
f68eb65cd7 check against own jid when detecting forged mam messages 2020-10-06 20:30:40 +02:00
JC Brand
30d550596b Remove converse-rsm as whitelisted plugin and dependency 2020-10-05 21:09:02 +02:00
JC Brand
8ef3b10d39 Don't hide chats when singleton is true 2020-10-01 13:43:42 +02:00
JC Brand
6d9752645f Replace lodash methods with native ones
filter
find
has
isEmpty
isString
isUndefined
noop
reject
uniq
2020-10-01 12:56:00 +02:00
JC Brand
e761923cc9 Bump @converse/skeletor and localForage 2020-09-30 18:51:21 +02:00
JC Brand
02a9126ab6 Log errors when failing to save a message to storage 2020-09-30 18:51:21 +02:00
JC Brand
b5783c0668 Refactor converse-api.query and the RSM class
- The `converse.api.query` method now no longer accepts an RSM instance.
- The RSM class now separates `query` parameters from `result` attributes
- Improve JSDoc docs and remove need to make `converse-rsm` a plugin
- Add typedefs for the options expected by RSM and `api.archive.query`
2020-09-30 18:51:21 +02:00
Christoph Scholz
ff5a046922 Revert "fix i18n of label group name"
This reverts commit 5a874a4956.
2020-09-30 10:59:39 +02:00
Christoph Scholz
5ea2ccfc17 fixes #2238 i18n not working reliably 2020-09-28 13:31:19 +02:00
Kim Alvefur
76b488a672 Bugfix. Promise.resolve is not a constructor 2020-09-28 10:49:14 +02:00
JC Brand
0ca2e5ae08 Remove need for lodash templates in headless build 2020-09-26 09:58:34 +02:00
JC Brand
3fc6f7fa23 Fixes #1924 2020-09-25 18:46:45 +02:00
JC Brand
3a88831b9d Bugfix. MUC tries multiple times to register nick 2020-09-25 15:30:53 +02:00
JC Brand
5350cb107f Don't throw timeout errors for sent IQ#result or IQ#error stanzas 2020-09-25 14:12:12 +02:00
JC Brand
78f8f73fea Get rid of converse-uniview plugin
Instead of overriding createChatBox, set 'hidden' flag via defaults
2020-09-21 18:08:48 +02:00
Christoph Scholz
5a874a4956 fix i18n of label group name 2020-09-18 21:13:08 +02:00
JC Brand
0a7dff442c Fixes #2235 2020-09-18 15:09:55 +02:00
JC Brand
7330530d13 omemo: better error handling when some bundles can't be fetched 2020-09-18 15:09:55 +02:00
JC Brand
32847e860f pubsub: await IQ response when publishing 2020-09-18 15:09:23 +02:00
JC Brand
2e393d260b Update to @converse/skeletor 0.0.2 2020-09-18 11:34:14 +02:00
JC Brand
5162f3f674 connection: Fix typo
This fixes anonymous logins
2020-09-18 11:34:03 +02:00
JC Brand
a0ae8135ce Fixes #1481
For OMEMO in MUC, use the real JID of the user, not the MUC JID
2020-09-17 17:12:06 +02:00
JC Brand
ccbf049000 emoji: raise an error if getShortnameReferences is called too soon 2020-09-17 12:24:18 +02:00
JC Brand
49cda74971 Update package-lock 2020-09-17 10:42:57 +02:00
JC Brand
0a82a177c4 OMEMO: ensure reflected encrypted MUC messages are identified 2020-09-17 10:37:09 +02:00
JC Brand
9fe7bfcd64 Include chatbox in 'message' event data 2020-09-16 19:08:56 +02:00
dependabot[bot]
522e7706c1 Bump lodash from 4.17.15 to 4.17.19
Bumps [lodash](https://github.com/lodash/lodash) from 4.17.15 to 4.17.19.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](https://github.com/lodash/lodash/compare/4.17.15...4.17.19)

Signed-off-by: dependabot[bot] <support@github.com>
2020-09-15 15:43:41 +02:00
JC Brand
8d3cd687e7 Pass chatbox or _converse as context 2020-09-11 16:44:28 +02:00
JC Brand
bbcfc9f998 Bugfix. 2nd parameter for api.hook is the context 2020-09-11 16:23:51 +02:00
JC Brand
71cfc7aba1 Bugfix. Include model when manually triggering change event 2020-09-11 16:01:15 +02:00
JC Brand
c0fc3c38f3 Bump to strophe 1.4 and add sprintf 2020-09-10 14:08:43 +02:00
JC Brand
543a29bcce Fixes #2116 2020-09-10 11:08:27 +02:00
JC Brand
0e03640ebe Fixes #2195 2020-09-10 10:17:13 +02:00
JC Brand
5d8e5468ba Refactor converse-notifications to used parsed message attributes
instead of querying the stanza.

Also fixes a bug where typing notifications triggered an AttributeError
inside `shouldNotifyOfGroupMessage`
2020-09-10 10:10:59 +02:00
JC Brand
1873003624 Add new plugin converse-carbons
Fixes a bug whereby carbons weren't being enabled because the listener
for `afterResourceBinding` was registered before `converse.initialize`
was called,(which means it was removed as soon as `cleanup` was called
inside `converse.initialize`).

This shows that event `api.listen` API calls can/should only be called
inside the `initialize` method of a plugin (or at least once plugins
have been initialized).
2020-09-10 09:27:27 +02:00
JC Brand
2c042cc3fa Fixes #2184: Headless build relies on locale directory
Removed Jed from the headless build and instead let `__` call sprintf.

It's now up to downstream users for `@converse/headless` to decide
whether they want i18n support for the few translatable strings in that package
and to implement it themselves.
2020-09-10 08:55:38 +02:00
JC Brand
ffbab33a26 Create own occupant before setting connection_status to ENTERED
This makes it possible to wait for the connection_status before trying
to call `getOwnOccupant` in plugins
2020-09-09 15:33:50 +02:00
JC Brand
7c43d0435c Refactor OMEMO.
- Add hooks to the stanza parsers so that plugins can do additional parsing.
- Change ChatBox instance methods to functions and use them for stanza parsing.
- Move encrypt and decrypt messages to `converse.env.omemo`

Apparently, when receving a 1:1 carbon message, a device was wrongly created
for the contact's device list, instead of our own.
2020-09-09 14:04:24 +02:00
Ariel Fuggini
fce337e352 New configuration setting: notify_nicknames_without_references 2020-09-09 13:11:45 +02:00
Christoph Scholz
6319f566dd fix emojis in case use_system_emojis == false 2020-09-05 11:33:25 +02:00
JC Brand
0594c480ff Only consider chat 'hidden' flag in relevant view modes 2020-09-04 13:13:07 +02:00
JC Brand
c3d8f12050 Make api.user.status API methods async
So that `_converse.xmppstatus` is defined before trying to set the
status.
2020-09-04 13:13:07 +02:00
JC Brand
4e7b29e417 Make sure initialize can be awaited...
before `converse.initialize` has been called

In the process, remove other "core" promises. There is no core or
community plugins code awaiting on them and since it's possible to
call `converse.initialize` twice, I'm not sure it makes sense to even have them.

Also removed unused error class IllegalMessage.
2020-09-03 17:07:44 +02:00
JC Brand
d5c93eb024 Create converse-root custom element
This element can be used to declaratively insert Converse into the DOM.

You can put `<converse-root>` into the DOM (e.g. by rendering it inside
a React component) before or afer Converse has loaded and/or has been
initialized.
2020-09-03 13:06:17 +02:00
Christoph Scholz
4d9d391365 add CustomElement to env 2020-08-31 17:03:23 +02:00
JC Brand
9348ac80b5 Override isHidden in converse-minimize
Otherwise `isHidden` might return true because `minimized` is set to
`true` but `converse-minimize` is not enabled.
2020-08-28 15:32:58 +02:00
Christoph Scholz
823134d762 add html to converse.env 2020-08-24 23:48:24 +02:00
Xavi Ferrer
d50151c9dd fix BOSH session restore 2020-08-24 11:46:24 +02:00
JC Brand
9f0dfcdbdb Wait before firing roomsAutoJoined event 2020-08-24 11:05:51 +02:00
JC Brand
f7ef334fac Rename method to better describe what it does 2020-08-18 21:09:39 +02:00
JC Brand
11cd6b8321 Fixes #2193.
Translations called at the top of template files don't apply, since the
trnaslations aren't yet fetched at that point.
2020-08-16 23:45:53 +02:00
JC Brand
3e8b3f73bd Move pot and po files to src/i18n and regenerate 2020-08-16 22:54:45 +02:00
JC Brand
d615cebcfe Use proper i18n func 2020-08-13 15:37:50 +02:00
JC Brand
6e86fe3300 Fixes #1913. Can't connect to non-ascii JID 2020-08-13 11:26:02 +02:00
JC Brand
09371712b0 Updates #1896: Properly identify archived one-on-one messages
Also, rename attribute from `is_receipt_request` to `is_valid_receipt_request` to avoid confusion.
2020-08-13 11:09:22 +02:00
JC Brand
cd84feefff connection: Re-add debouncedReconnect 2020-08-12 17:50:18 +02:00
JC Brand
6fbb9463ee Bugfix. Include nick in output messages 2020-08-12 14:39:10 +02:00
Xavi
7cdc592ed9
merge only relevant settings when calling api.settings.extend (#2187)
* merge only relevant settings when calling api.settings.extend
* test behaviour is the one expected and change doesn't break previous tests
2020-08-12 10:12:10 +02:00
Xavi
bd21f27f4f
fix api.settings.update warning message (#2182) 2020-08-10 08:06:24 +02:00
JC Brand
696c8e3522 Don't clear #conversejs via innerHTML
It appears to break subsequent lit-html `render` calls on the
`#conversejs` element because lit-html still remembers parts from before
the element was cleared.
2020-07-30 12:17:23 +02:00
JC Brand
2fcce78144 Add a cleanup hook
- Move view-related cleanup code out of core.
- Call `remove` on `_converse.chatboxviews` during cleanup
2020-07-30 11:04:07 +02:00
JC Brand
16ca8044f8 Add experimental support for running the XMPP conneciton inside a shared worker
Still lacks inter-tab communication to update state across tabs, i.e.
when sending a 1-on-1 message in one tab, it doesn't appear in another,
because that information is not available via the websocket connection.

- Create a new `Connection` class that extends Strophe.Connection and
    move related code from `converse-core.js` into this class.
- Store the session in localStorage when using a worker
- Move XEP-0156 code to connection.js
    This allows us to initialize the connection without needing to know the
    domain.
2020-07-27 12:43:47 +02:00
JC Brand
a6c821be95 Use optional chaining 2020-07-24 11:50:54 +02:00
JC Brand
1419b4fc96 MUC: Add support for status code 333 2020-07-22 10:11:05 +02:00
JC Brand
cb50de16e2 Update 3rd party dependencies 2020-07-20 13:19:12 +02:00
JC Brand
1335a96dad Bugfix. Handle emojis for which we don't have shortnames 2020-07-17 12:59:05 +02:00
JC Brand
0da8067129 MAM: Fix a MUC timing issue.
If a message comes in after joining the MUC but before the MAM messages
have been fetched, then converse-mam will query for MAM messages newer
than that message, causing an empty history (except for that one message).
2020-07-14 22:41:26 +02:00
JC Brand
4de9816f24 Make sure emojis are initialized before parsing a message
for emoji related data
2020-07-13 15:45:37 +02:00
JC Brand
d7bc129ce3 Get rid of Twemoji as a dependency
Fixes #2126
2020-07-10 11:21:45 +02:00
JC Brand
1269cb7252 Don't attempt to fetch a VCard if we don't have a JID 2020-07-09 22:29:06 +02:00
JC Brand
8943609d10 Refactor the body directive
Changes how rich message markup is generated and kept track of.
We now have a MessageText class which subclasses String and which keeps
track of the rich markup associated with the message.
2020-07-09 20:50:25 +02:00
JC Brand
78925b011d Updates #2126
Wait for emojis to be initialized before parsing MAM messages
2020-07-08 14:08:08 +02:00
JC Brand
c3d6b64f4b Turn the chat toolbar into a component
- Declaratively render the emoji picker dropup
- Got rid of converse-emoji-views
- Adapt OMEMO to the new buttons stuff
- Make emojis json global, to try and speed up tests
- omemo: Move functions to the top of the module
2020-07-08 10:17:06 +02:00
JC Brand
b7a40dad41 Add a title attribute to emojis in messages
so that you can see the shortname when you hover your mouse over an emoji.
2020-06-25 11:19:07 +02:00
JC Brand
be20b8e1a0 emojis: fix rendering of custom emojis 2020-06-25 10:24:45 +02:00
Ariel Fuggini
77a0a01eff
Makes message with errors non-editable (#2089)
* Makes message with errors non-editable
2020-06-25 10:22:44 +02:00
JC Brand
b6dabf7381 muc: Ensure that exact nicknames (and not substrings) are matched 2020-06-22 13:57:44 +02:00
Ariel Fuggini
73d33e1161
Makes mentions case-insensitive, plus parsing functionality refactor (#2061) 2020-06-18 11:19:01 +02:00
JC Brand
2009a94ba4 Update to Strophe 1.3.6
Fixes #2067
2020-06-15 15:39:33 +02:00
JC Brand
6b55907ddd Bugfix. Don't remove affiliated members on probe response
by checking for the affiliation data on the probe response presence and
not on the occupant model (which might be created from a message and
therefore not yet have up to date affiliation data).
2020-06-15 12:42:20 +02:00
JC Brand
80c955f267 Fix "retry" feature for message errors.
By registering a one-time event handler for a unique event name
2020-06-11 17:29:44 +02:00
JC Brand
b0cb489769 Use @converse/skeletor, lodash-es and latest webpack-dev-server 2020-06-08 19:38:16 +02:00
JC Brand
b511f1d950 Updates #1896: Use right flag to checked if message is archived 2020-06-08 12:25:49 +02:00
JC Brand
dd7bb28d86 Report traceback when waitUntil times out 2020-06-05 15:49:18 +02:00
JC Brand
95b015f01a Allow disabling of the bosh plugin 2020-06-03 17:43:57 +02:00
JC Brand
c82e3e9bda Update api.vcard.set to also update the VCard model 2020-06-03 13:32:44 +02:00
JC Brand
b4e4248f40 Fixes #1960 2020-06-03 13:26:38 +02:00
JC Brand
9f7b6d6fa1 Fixes #2035 2020-06-03 10:56:38 +02:00
JC Brand
85e9169b35 Use the API to read settings 2020-06-03 10:15:05 +02:00
JC Brand
830e060568 Rename api.settings.update to api.settings.extend
This is to try and make it clearer that this method won't override
initialization settings, and is instead simply to add to the default
settings.
2020-06-03 09:32:16 +02:00
JC Brand
1ff6ced3ab Don't override initialization settings via api.settings.update
This is a problem that could occur when calling converse.initialize twice
2020-06-03 09:15:35 +02:00
JC Brand
5a57ded243 Add support for the XEP-0333 displayed chat marker
Credit for this work goes to @deleolajide
2020-06-01 18:01:02 +02:00
JC Brand
ac36adddfe Re-add support for a new messages indicator
Fixes #2040
2020-06-01 16:52:12 +02:00
JC Brand
7651d58470 Render chat messages as web components
- Render chat content as a <converse-chat-content> component
- Create new component for rendering the message body
- Get rid of `showMessage` method
2020-06-01 09:53:19 +02:00
JC Brand
ca7adeedbd Save hat URI, not id 2020-05-20 13:44:29 +02:00
JC Brand
1e44f45a68 core: Don't expect Strophe.BOSH to be defined 2020-05-18 18:51:40 +02:00
JC Brand
bf4b3efa5b Import _converse and api 2020-05-18 10:54:37 +02:00
JC Brand
3cca2fdb7f roster: Filter contacts via all available information 2020-05-14 12:20:23 +02:00
JC Brand
35cde98e71 Fix i18n string parsing error 2020-05-14 11:18:13 +02:00
JC Brand
b8f2db6e33 Move ModeratorToolsModal to separate file 2020-05-13 15:16:46 +02:00
Dele Olajide
cae5e9c875 Updates #1999 - Demarcate first unread message 2020-05-13 13:39:33 +02:00
JC Brand
2f60c4399a core: SimplifyonDisconnected 2020-05-12 14:52:21 +02:00
JC Brand
2e6bfb6717 Set connection status values via constants 2020-05-12 14:51:34 +02:00
JC Brand
c2143f617a Bugfix. Converse.js stopped reconnecting
When `_doDisconnect` is called in Strophe, `authentication` is set to
`false`, so reconnection wouldn't happen anymnore

Updates #1490
2020-05-12 11:50:13 +02:00
JC Brand
2b5aeb5ed1 Document interaction between muc_send_probes and muc_fetch_members 2020-05-12 11:23:35 +02:00
JC Brand
555c0966cc muc: save error response to a sent message onto the original model 2020-05-07 13:32:56 +02:00
JC Brand
3319398f17 muc: Don't show unnecessary affiliation change message 2020-05-07 10:03:28 +02:00
JC Brand
b64b20c44d muc: fall back to finding occupant by nick 2020-05-06 18:01:59 +02:00
JC Brand
d49b630bdc Enable sending of MUC presence probes 2020-05-06 18:01:59 +02:00
JC Brand
98faa71e65 muc: Ensure message rerenders when occupant is added 2020-05-06 18:01:59 +02:00
JC Brand
e621362471 mam: include chatbox in data sent via MAMResult 2020-05-06 18:01:59 +02:00
JC Brand
fa30563937 Don't assume that window.converse is always defined 2020-04-30 13:27:01 +02:00
JC Brand
089a54281e Bump various 3rd party dependencies 2020-04-29 16:01:33 +02:00
JC Brand
5546085f0d Add keywords 2020-04-29 11:17:21 +02:00
JC Brand
f20e14282a Re-add log to _converse object 2020-04-29 10:19:57 +02:00
JC Brand
2963830916 Trigger sendMessage event 2020-04-28 17:46:57 +02:00
JC Brand
b5eea12d49 Refactor so that message attributes are parsed early
It's better to parse an incoming message stanza early, than to have
all kinds of methods throughout the codebase that does querySelector
etc.

Firstly, it allows us to catch and report errors and malicious stanzas early on.
It also simplifies programming because you don't need to try and
remember how to properly parse a stanza, all the work is done upfront
for you.
2020-04-27 16:34:37 +02:00
JC Brand
27008aff66 Bugfix. Add missing variable for string interpolation 2020-04-27 16:30:46 +02:00
JC Brand
bad815b429 Bugfix. Don't create multiple RosterContactView objects 2020-04-27 16:30:33 +02:00
JC Brand
958379682a muc: Render role change messages as ephemeral notifications 2020-04-23 15:11:36 +02:00
JC Brand
c6f8ef0c46 Various JSDoc related fixes and improvements
Using the `@method` directive on a `@class` means that the method
doesn't appear.
2020-04-23 13:55:08 +02:00
JC Brand
b44c0c266c mam: Add MAMResult hook 2020-04-23 13:55:08 +02:00
JC Brand
ad4999384d Reduce unnecessary logging in tests 2020-04-23 13:52:21 +02:00
JC Brand
7e2552bd8c core: Allow multiple imports 2020-04-23 13:50:35 +02:00
JC Brand
7eb6a17fd2 Add the ability to run tests via the webpack devserver 2020-04-21 20:18:43 +02:00
JC Brand
ac3e87965f Remove unused import 2020-04-20 19:48:09 +02:00
JC Brand
d9c41f62cf Add install recipe as alias to build and dist 2020-04-20 18:49:02 +02:00
JC Brand
c1efb0d2b4 Add an external API for sending presences 2020-04-19 09:41:38 +02:00
JC Brand
5e91adbf4e Update various 3rd party dependencies 2020-04-17 11:40:14 +02:00
JC Brand
78b60a3bd9 Fixes #515 Add support for XEP-0050 Ad-Hoc commands 2020-04-17 11:01:44 +02:00