Commit Graph

2639 Commits

Author SHA1 Message Date
JC Brand
e5188d8b10 Bugfix. Remove affiliation based on updated members lists 2019-07-04 08:28:12 +02:00
JC Brand
da1d87648c New config option clear_messages_on_reconnection
In some cases, it might be desirable to clear cached chat messages once you've
reconnected to the XMPP server.

For example, if you want to prevent the chat history from getting too long or
if you want to avoid gaps in the chat history (for example due to MAM not
returning all messages since the last cached message).

If you're using OMEMO, then you probably don't want to set this setting to
``true``. OMEMO messages can be decrypted only once, so if they then
subsequently get cleared, you won't get the plaintext back.
2019-07-04 08:28:12 +02:00
JC Brand
67bcc00f10 Associate ChatRoomOccupant to ChatRoomMessage
and use promises to indicate when an occupant or contact has been set
2019-07-04 08:28:12 +02:00
JC Brand
e7178fed31 Fetch messages after fetching members.
This is done to avoid unnecessary repaints and reflows (caused when a
message has already rendered and then an occupant is created and
attached to that message, cauring a re-render).

Related to #1266
2019-07-04 07:58:24 +02:00
JC Brand
cd6b5143c6 Create separate models for MUC messages and their container 2019-07-04 07:58:24 +02:00
Kim Alvefur
28b51f75ce Support sending files from clipboard (fixes #1585) 2019-07-03 23:46:24 +02:00
JC Brand
0d75cc5235 Fixes #1622
Make selector more general because Ejabberd returns `error[type="modify"]` instead of `error[type="cancel"]`.
2019-07-01 17:59:02 +02:00
JC Brand
34a404eecc URI encode query string values 2019-07-01 17:21:49 +02:00
JC Brand
63d258a00a Use findWhere when looking for only one instance 2019-07-01 17:21:47 +02:00
JC Brand
bb94891621 Only remove non-members when reconnecting to a MUC
to avoid unnecessarily destroying and then recreating ChatRoomOccupant
instances for room members.
2019-07-01 09:16:15 +02:00
JC Brand
f1f641ce61 Makes more sense to destroy a message outside of showMessage
Also ensures that we don't trigger `messageAdded` for a destroyed
message.
2019-06-28 15:24:08 +02:00
JC Brand
8db839b4cf Send a XEP-0410 ping when we restore a MUC from cache
and re-enter if necessary.

This solves the problem where we "clone" a tab (e.g. middle-click) and
then restore a MUC from cache which we haven't actually entered (given
that the new tab represents a new device and session).

Also... add `await` in a test to try and fix Travis flakiness
2019-06-27 16:50:44 +02:00
JC Brand
836d3946e8 Ignore keycodes if meta key is also pressed 2019-06-27 16:09:11 +02:00
JC Brand
0d928edf7e Disconnect MUCs when we don't have a resumable SMACKS session 2019-06-27 15:49:19 +02:00
JC Brand
ec68dc1cf0 Always set JID on the connection
So that the resource is passed along when we manually bind.

Related to bd81b89724
2019-06-27 15:19:48 +02:00
JC Brand
119966d902 Set flag to indicate user session is active
We then use this flag to determine whether we should use the values from
sessionStorage.

This appears to fix the problem I originally tried to fix in 607d798665.

When "cloning" a tab (e.g. via middle-click), the `active` flag will be
set and we'll create a new empty user session, otherwise it'll be false
and we can re-use the user session.
2019-06-27 15:13:04 +02:00
JC Brand
8d9d0a1ef4 Revert "Store session per full JID"
This reverts commit 607d798665.

Unfortunately this doesn't solve the issue because we have a
chicken-and-egg problem due to not knowing the resource beforehand.

So what happens after this change is that we never resume XEP-0198
sessions but instead always start a new one.
2019-06-27 15:11:14 +02:00
JC Brand
98215deb21 Update to latest backbone.overview which debounces sorting on add event 2019-06-27 13:15:55 +02:00
JC Brand
11da69b0d7 Use native methods instead of DayJS
Results in a 4x speedup
2019-06-26 17:52:48 +02:00
JC Brand
824b2c81b4 converse-minimize: Rename view methods to clarify
that they are in response to a change and not meant as an API.
2019-06-26 16:52:51 +02:00
JC Brand
bd81b89724 Ensure current resource is bound when manually calling connection.bind 2019-06-26 13:48:10 +02:00
JC Brand
2cbc4aaa50 Fixes #1494. Trim whitespace around messages 2019-06-26 10:59:56 +02:00
JC Brand
83bc851f20 Fixes #1455. Updates #1619
Avatar didn't update a second time due to `canvas` element being expected
2019-06-26 10:24:27 +02:00
JC Brand
b69440f875 converse-smacks: Ensure default session values are set 2019-06-25 23:58:45 +02:00
JC Brand
c759112cf3 Fix failing test 2019-06-25 22:53:39 +02:00
JC Brand
607d798665 Store session per full JID
Otherwise we run into a bug where two tabs with Converse.js share the
same XEP-0198 SM-ID, causing both to go into a reconnection-loop as
the XMPP server switches XEP-0198 sessions between them.

This bug is due to a distinction in how sessionStorage behaves when you
open the existing site in a new tab (e.g. middle-click or
`target="_blank"), as opposed to creating a new tab
and then opening the site in that tab.

In the latter case, the newly created sessionStorage object is empty.
In the former, the contents of sessionStorage of the current page is
copied over to the new page!
2019-06-25 21:40:28 +02:00
JC Brand
54804b5b89 Performance fix. Only set height when necessary 2019-06-25 17:24:07 +02:00
JC Brand
e83b0ff39e Update wording to clarify what /revoke means 2019-06-25 16:59:00 +02:00
JC Brand
681c3a2c12 Corrections bugfix. Don't save new id on message model
otherwise a new cache entry gets created, causing multiple messages to
be restored from cache later on.
2019-06-25 12:06:47 +02:00
JC Brand
1bc3f28e6f Update refreshFeatures
Distinguish between getting an existing entity and
creating a new one.

When creating a new one, ensure that we don't fetch from the cache.

New API method for creating a disco entity.
2019-06-25 11:43:59 +02:00
JC Brand
1a23ec1462 Move line from parent method into showMessage 2019-06-25 11:43:59 +02:00
JC Brand
996a43792e converse-mam depends on converse-rsm 2019-06-20 16:51:50 +02:00
JC Brand
29b6a6724d Need to explicitly fetch messages now when restoring a MUC from cache 2019-06-20 16:36:26 +02:00
JC Brand
40469a9787 MUC: Refresh room features when re-entering a cached room
Only fetch messages after we have the latest room features
Otherwise we run into race conditions where MAM messages are fetched
before we know whether (updated) the room supports MAM or not.
2019-06-20 14:04:46 +02:00
JC Brand
ac007bb527 converse-disco: don't replace a pending promise
I'm not sure how much this is an issue outside of tests, where we might
run into race conditions arising to the fact that we don't always
respond to every IQ stanza
2019-06-20 14:04:46 +02:00
JC Brand
c5309f9210 Add attributes to resolveable promise to detect its resolved state 2019-06-20 14:04:46 +02:00
JC Brand
c32070c9bb Autocomplete fixes
- Fixes #1575. Height not properly set on MUC invitation list
- Add new configuration setting: `muc_mention_autocomplete_min_chars`
- Bugfix. `min_chars` setting for MUC mentions wasn't having an effect
2019-06-19 15:01:30 +02:00
JC Brand
36549bf61d Revert flexbox, column-reverse changes
Unfortunately this doesn't work on Firefox and there's no proper
workaround. https://github.com/philipwalton/flexbugs/issues/108

Reverts:

Revert "Bugfix. Properly insert error messages and spinner"
This reverts commit 6a419cc145.

Revert "Use flexbox to keep the chat scrolled down"
This reverts commit dd91d3cc55.
2019-06-19 11:45:54 +02:00
JC Brand
303a8b63af Fixes #1495. Mentions should always include a URI attribute 2019-06-19 09:35:39 +02:00
JC Brand
7455ce1b07 Fixes #1579 and fixes #1538 2019-06-19 09:24:44 +02:00
JC Brand
30d110434f Bugfix. Properly resize textarea when text gets removed. 2019-06-19 09:03:52 +02:00
JC Brand
9750dcf3a8 Fixes #1142. Show confirmation dialog for editing messages
when the textarea contains an unsent message
2019-06-19 08:43:42 +02:00
JC Brand
1dc73c1c31 For chatboxes, use the web storage determined by _converse.trusted 2019-06-18 16:46:55 +02:00
JC Brand
b2553a44e1 New configuration setting: auto_focus 2019-06-18 14:04:26 +02:00
JC Brand
536b42697c Manually scroll down when switching fullscreen chats 2019-06-18 13:59:55 +02:00
JC Brand
4f67f352f5 Fix /${command} parsing bug 2019-06-18 13:01:38 +02:00
JC Brand
6a419cc145 Bugfix. Properly insert error messages and spinner
now that messages appear in reverse order due to flexbox
2019-06-18 12:35:58 +02:00
JC Brand
dd91d3cc55 Use flexbox to keep the chat scrolled down
By using `display: flex` and `flex-direction: column-reverse`, the chat
now automatically scrolls down when loaded, without requiring any
extra JavaScript.

We still need to scroll down with JavaScript when sending a message.

By using `column-reverse`, the messages container now works in reverse.
So the newest message is the first element in the container and the
oldest message is the last. This is the reverse of before.

Due to this, this change will likely break some plugins.
2019-06-18 11:37:07 +02:00
JC Brand
21b0f2464d Clear received field for corrected messages
It gets populated again upon MUC reflection or chat marker
2019-06-17 12:14:31 +02:00
JC Brand
9c66302c4a Bugfix. Error responses weren't being shown for corrections 2019-06-17 12:07:33 +02:00
JC Brand
19f6bce246 Message correction improvements. Updates #1142
Up and down arrows only serve as message correction shortcuts if the
textarea is empty.

This means that:

- Up arrow doesn't start correction of previous message if we're currently writing a message
- Down arrow doesn't erase currently written message

This is based on user-feedback and is also how Slack handles these
shortcuts.
2019-06-17 09:04:03 +02:00
JC Brand
38d0d8360b New config setting message_limit
for limiting messages to a certain number of characters.
2019-06-16 21:52:56 +02:00
JC Brand
de3099a9d8 converse-muc: Show <text> content of error presences 2019-06-16 12:14:32 +02:00
JC Brand
1d6ee5bf58 No need to mention 'permanent' 2019-06-16 11:23:36 +02:00
JC Brand
a19e35d101 Use setTimeout instead of listening for animationend
For some reason the latter causes extreme lag when switching rooms
2019-06-14 13:46:53 +02:00
JC Brand
83201e7c02 Reconnection fixes.
When reconnecting with a new transport, we call setUserJID
so that a new resource is generated, to avoid multiple
server-side sessions with the same resource.

We also call `_proto._doDisconnect` so that connection event handlers
for the old transport are removed.
2019-06-14 12:00:49 +02:00
JC Brand
9635f53dad converse-smacks: 2 bugfixes.
- Don't ever resume SMACKS stream when using BOSH
- Clear SMACKS session data when using BOSH
2019-06-14 12:00:49 +02:00
JC Brand
d3692755d0 Consolidate changed event handler that renders MUC heading 2019-06-14 09:27:10 +02:00
JC Brand
946394928b Fixes #1601 Message corrections should get their own origin id 2019-06-13 16:31:02 +02:00
JC Brand
22bdccc775 Bugfix.
https://xmpp.org/extensions/xep-0198.html#resumption

The <resume/> element MUST include a 'previd' attribute whose value
is the SM-ID of the former stream and MUST include an 'h' attribute
that identifies the sequence number of the last handled stanza sent
over the former stream from the server to the client.
2019-06-13 13:54:58 +02:00
JC Brand
f3c4dbc344 Avoid unnecessarily sending out a presence stanza
- Set roster_fetched flag when we get an empty IQ[type="result"] stanza
- Set `restored` flag when resuming in converse-smacks
- Don't trigger change event when fetching xmppstatus values
- Removed two events, since we can just listen to `change` on `_converse.xmppstatus`.
2019-06-13 13:33:01 +02:00
JC Brand
ba9d28b5c2 Two MUC tests
- Test for info message indicating a configuration change
- Test that the MUC reconnects when a `not-acceptable` error is returned
2019-06-12 18:39:24 +02:00
JC Brand
ca4b509d87 Log MUC connection status 2019-06-12 10:55:01 +02:00
JC Brand
5362156731 While connecting, treat "modify" error as a disconnection event 2019-06-12 10:15:55 +02:00
JC Brand
73fd3d6a5f Fade out ephemeral messages 2019-06-12 07:09:22 +02:00
JC Brand
9d3dfa831a Fixes #1599 2019-06-12 06:40:53 +02:00
JC Brand
e1ca02d94a converse-disco: don't call onInfo on undefined 2019-06-12 06:27:07 +02:00
JC Brand
bbe2a62295 converse-muc: Create info and error messages on the model
instead of on the view.
2019-06-12 06:27:07 +02:00
JC Brand
970ba96ce1 Bugfix. Only create VCards for chat and groupchat messages
Other types of messages such as `error` don't necessarily have a JID
tied to them.
2019-06-11 14:05:30 +02:00
JC Brand
a0f0240b92 Don't set nick before confirmation that it was successful 2019-06-11 14:05:30 +02:00
JC Brand
d385452a7d Use _converse.getDefaultMUCNickname 2019-06-11 14:05:30 +02:00
JC Brand
599f7596f6 Show policy violation errors to the user and make them ephemeral
Also, remove ephemeral messages after 10 seconds, not 20
2019-06-11 14:05:07 +02:00
JC Brand
3cc1b40aad Apparently no model triggers showHelpMessages anymore 2019-06-11 10:34:23 +02:00
JC Brand
dc0085bff3 All received MUC messages are "received" by definition 2019-06-06 16:17:51 +02:00
JC Brand
690052e1c2 Call setUserJID when we get JID from credentials_url 2019-06-06 13:41:52 +02:00
JC Brand
789b47ddb3 Bugfix. Don't create view for chat which fails validation
Use-case is when an invalid MUC gets opened in singleton mode.
Without this fix a new chat with spinner appears, even though it
shouldn't.
2019-06-06 08:34:56 +02:00
JC Brand
a656750459 Only fetch presences when we're resuming an existing session.
updates #555
2019-06-05 11:47:23 +02:00
JC Brand
a7184fab41 Bugfix. Need to wait for setUserJID 2019-06-05 11:38:14 +02:00
JC Brand
38a232fd45 Move BOSH code into a plugin
- Remove the `keepalive` configuration setting. It is now always implicitly `true`.
- Remove the `expose_rid_and_sid` configuration setting.
- A `prebind_url` is now mandatory when setting `authentication` to `prebind`.
- It's no longer possible to pass in `rid` and `sid` values to `converse.initialize.
2019-06-05 11:35:48 +02:00
JC Brand
01fce55733 Add prettierx and tentatively use it for some formatting
I'm using prettierx, which is a fork of prettier so that we can have
spaces before the brackets in a function declaration.

I don't like how restrictive prettier is concerning its configuration
and formatting.

- it messes up some indentation in specs/
- it removes a second newline when I specifically want to have two
- it doesn't allow spaces before brackets in function declarations (hence prettierx)
- it adds spaces for function parameters with default values

None of this is configurable.

So auto-formatting is not turned on by default, but it might be a useful
tool in some cases.

Fixes an issue where indentation was off in converse-core.js, causing
vim-sleuth to wrongly indent by three spaces only.
2019-06-05 10:25:31 +02:00
JC Brand
085a4c6535 Small config fixes
- fix import path
- remove unnecessary lines in webpack config
- remove unused file
2019-06-04 20:35:09 +02:00
JC Brand
51f2ab9100 Fixes #1196. Use alternative connection method upon connfail 2019-06-04 15:11:32 +02:00
JC Brand
297f3d9efb The list of core plugins doesn't have to be an attribute of _converse 2019-06-04 14:27:25 +02:00
JC Brand
b57e3e49c1 Fixes #1330. Missing room name in MUC invitation popup 2019-06-04 12:08:14 +02:00
JC Brand
b128286410 Don't disconnect MUC on unload when using SMACKS
updates #1111
2019-06-04 11:12:22 +02:00
JC Brand
1d9bbb8ddd Message display improvements
* Checkmark and edit modal button are now on the right
* Instead of showing checkmarks for MUC messages,
  we now show them as light grey before MUC reflection
* Simplify message markup by requiring less `if` statements
2019-06-04 11:12:22 +02:00
JC Brand
f2ac9ef4d7 converse-muc: Support for XEP-0410 to check whether we're joined 2019-06-03 11:41:34 +02:00
JC Brand
68d4a71c75 Fix _converse.api.user.login to handle auto_login case
Also, set the resource in `setUserJID`
2019-06-03 11:40:26 +02:00
JC Brand
3c6a17f85c Update to latest Strophe commit with explicit bind support 2019-06-03 10:02:57 +02:00
JC Brand
699fe0df63 Initial support for the CredentialsContainer web API 2019-06-03 09:43:24 +02:00
JC Brand
737e27c726 Use shakespearean character names in tests 2019-06-03 09:43:24 +02:00
JC Brand
5738b3748a Use getDisplayName for roster contacts 2019-06-03 09:43:24 +02:00
JC Brand
1fb5378524 Throw error on parser error in toStanza 2019-06-03 09:43:24 +02:00
JC Brand
f30d415f76 Refactor reconnection 2019-06-03 09:43:24 +02:00
JC Brand
55cffab594 Destroy session objects in clearSession, not in tearDown 2019-06-03 09:43:24 +02:00
JC Brand
dc58e6d47f Make teardown a function 2019-06-03 09:43:24 +02:00
JC Brand
7b11d85503 Add support for XEP-0198 Stream Management
- New plugin `converse-smacks`
- New config option `enable_smacks`
- Rename session cache id from `converse.bosh-session` to `converse.session`
- Refactor logout and login as consistently used api methods
- Refactor session cache to store per JID

Fixes #316
2019-06-03 09:43:12 +02:00
JC Brand
a46ee4dfe1 Buttons aren't always there 2019-06-03 09:41:29 +02:00
JC Brand
7c7002ebf9 Add _converse.default_connection_options
So that we can specify defaults
2019-06-03 09:41:29 +02:00
JC Brand
eafe995f95 Rename variable for clarity 2019-06-03 09:41:29 +02:00
JC Brand
24956d8dca Execute manual resource binding if necessary 2019-06-03 09:41:29 +02:00
JC Brand
0688907e0d Allow events to be synchronous
When a synchronous event is fired, Converse will wait for all
promises returned by the event's handlers to finish before continuing.
2019-06-03 09:41:29 +02:00
JC Brand
6dea4eabe7 Ensure nickname form is rendered across page loads
if the page is reloaded while the nickname form is shown
2019-06-01 16:16:34 +02:00
JC Brand
267fb38e0c Remove the forward_messages config option 2019-05-31 16:07:51 +02:00
JC Brand
e362776b9f converse-muc-views: Don't prematurely insert MUC into the DOM 2019-05-31 09:14:42 +02:00
JC Brand
d86a657a66 converse-controlbox: No need anymore to override insertIntoDOM
We now use CSS to make sure that the controlbox and toggle is always on the far right.
2019-05-31 09:14:07 +02:00
JC Brand
aece956281 Refactor strophe usage
- Upgrade to latest commit in Strophe
- Import individual Strophe dependencies
- Replace strophe plugins with code in Converse
2019-05-29 18:27:34 +02:00
JC Brand
7a18f59f8f Simplify rendering of trimmed chats
Also fix issue where trimmed headline chatboxes don't show the proper
color
2019-05-29 13:28:45 +02:00
JC Brand
da713f3162 Improve chatroom name rendering
- Take locked_muc_domain into consideration in chatroom display name
- Use getDisplayName when rendering the heading name
- Give preference to bookmark name if it exists
2019-05-29 13:27:41 +02:00
JC Brand
2834e8d678 Bugfix. Single emoji messages don't display larger when restored from cache 2019-05-28 15:38:55 +02:00
JC Brand
7511d8c35e Always clear messages and occupants cache before (re)entering a room 2019-05-28 14:30:55 +02:00
JC Brand
e053b97043 Set room `connection_status' to DISCONNECTED...
when receiving an `unavailable` presence for ourselves.
2019-05-28 14:30:55 +02:00
JC Brand
85c4d144ed Only show mention autocomplete suggestions for MUC occupants with nicks 2019-05-27 22:45:54 +02:00
JC Brand
fcc9e8c31b Also allow @ in moderator commands 2019-05-27 12:27:24 +02:00
JC Brand
be0274f1f0 Fixes #1586. Not possible to kick someone with space in nick
Refactored moderation by moving certain methods to the model and
consolidating setting of roles and affiliations into new methods.
2019-05-27 12:27:12 +02:00
JC Brand
5e6c2b9982 Move role modifying method to the model
and also first check whether we have an occupant with that nickname.

Since roles are session based, it doesn't make any sense to try to
modify the role for a user not in the room.
2019-05-27 12:27:03 +02:00
JC Brand
f20aee6906 Fixes #1576
When using `auto_login` and logging out, Converse gets stucks with an infinite spinner.
2019-05-26 15:30:15 +02:00
JC Brand
22e3c49660 Terminology fix 2019-05-26 11:20:31 +02:00
JC Brand
e1762a1bb5 Rename key event handler methods to avoid confusion 2019-05-26 11:09:43 +02:00
JC Brand
5054ecca08 Check whether controlbox exists before assigning 2019-05-24 20:50:30 +02:00
JC Brand
f387c947f5 Allow the full app to be embedded.
- new config option `singleton`.
- new plugin `converse-uniview`
- removed `converse-embedded`.
- various CSS changes, to properly render an embedded full app
- don't re-open cached and non-autojoined chats in singleton mode

The goal here is to extend the `embedded` `view_mode` so that the full app can
also be embedded, not just a single MUC or private chat.

To do this, we'll need to differentiate between multi and singleton chat apps.

* A singleton chat app contains only a single chat.
* A multi-chat app can contain zero or more chats

So we introduce a new config option, `singleton`, which when used with
`view_mode` set to `embedded` will determine whether a single chat or the full
app is embedded.

Similarly, in `overlayed`, `fullscreen` and `mobile` view modes, `singleton`
set to true will allow only one chat within the parameters of that view mode.

We're appropriating the word `singleton` and introducing the concepts of
`uniview` and `multiview` (see a785ca8) to cover what was
previously meant with `singleton`.

updates #1297
2019-05-24 20:39:19 +02:00
JC Brand
2d507c68c9 Always debounce trimChats 2019-05-24 16:02:07 +02:00
JC Brand
1ef29bee4e Use composition instead of overrides 2019-05-24 16:02:07 +02:00
JC Brand
f0a680e492 Remove animate config settings.
Also update tests
2019-05-23 22:02:08 +02:00
JC Brand
04af3eb029 Always try to reserve nickname when entering room
Allows for simpler code, especially making `getReservedNick` easier to override
2019-05-23 16:04:55 +02:00
JC Brand
b876500865 Update to latest backbone.overview 2019-05-23 14:44:10 +02:00
JC Brand
7032ded53f cleanup 2019-05-22 19:45:00 +02:00
JC Brand
a1c33d2140 No need to explicitly call refreshFeatures
`initializeDisco` already gets called upon reconnection which
accomplishes this.
2019-05-22 19:30:22 +02:00
JC Brand
9167128d8e Bugfix. 2019-05-22 19:28:09 +02:00
JC Brand
429c320a79 Also clear MUC occupants upon reconnection 2019-05-22 19:27:53 +02:00
JC Brand
7ab59ad63e Refactor MAM and clear private chats upon reconnection
- Add `onReconnected` method for chatboxes to clear messages
- Move MAM models to headless build.
- New event `onChatReconnected`
2019-05-22 14:10:19 +02:00
JC Brand
271c79eae8 Refactor message corrections
- Save date for older message versions and display it in the modal
- Properly handle the correction being received *before* the corrected message
2019-05-22 13:26:46 +02:00
JC Brand
53520317fc Move locked_muc_domain and muc_domain to model 2019-05-21 13:05:58 +02:00
JC Brand
1269d53e02 Move enterRoom method to the model 2019-05-21 12:04:55 +02:00
JC Brand
4c924a66df Split bookmarks plugin into headless and views
Fixes #1577
2019-05-21 11:35:00 +02:00
JC Brand
0e49ebf695 Rename method to clarify that it's not simply an accessor 2019-05-21 11:33:01 +02:00
JC Brand
d1d81bf933 Bugfix. Remove condition before fetching members 2019-05-21 11:33:01 +02:00
JC Brand
bb0c0fcd81 Remove message views when messages get reset 2019-05-21 09:56:27 +02:00
JC Brand
b4b7fedf0f Bugfix. Add id to outgoing MUC messages 2019-05-20 17:16:16 +02:00
JC Brand
5f04176929 Clear messages when converse reconnects 2019-05-20 17:10:34 +02:00
JC Brand
886ff1bd19 Don't debounce reconnect on leading edge
Otherwise we can get into a situation where Converse stops trying to
reconnect.
2019-05-20 15:16:36 +02:00
JC Brand
7e515dd4b1 Move all MUC joining logic to the model 2019-05-20 10:06:37 +02:00
JC Brand
39363d495f Fetch messages in MUC model 2019-05-20 09:25:11 +02:00
JC Brand
46fef28601 Clear messages when closing a chat 2019-05-19 22:11:37 +02:00
JC Brand
3085c5d408 Catch errors when destroy is called for already removed message 2019-05-19 21:43:03 +02:00
JC Brand
84bde6e766 Move some close logic to the model 2019-05-18 07:09:53 +02:00
JC Brand
0426898c23 Store chat messages in sessionStorage
so that they're cleared when the last tab closes
2019-05-18 06:57:48 +02:00
JC Brand
7950f7c2ac Change muc_show_disconnection_status to muc_show_join_leave_status 2019-05-18 06:34:29 +02:00
JC Brand
f7b19053ec Use origin_id as id for outgoing messages as well 2019-05-18 05:32:04 +02:00
JC Brand
a0f1a5cfaf Fetch chat messages in the model, not the view 2019-05-17 14:45:37 +02:00
JC Brand
e7ceb22a56 Avoid duplication by keeping track of message views 2019-05-17 14:45:37 +02:00
JC Brand
0fa6bcdcc2 Reduce debounce time for scrolling down. 2019-05-17 14:45:37 +02:00
JC Brand
bad9b08b61 disable_mam should now be set on the model 2019-05-17 13:53:31 +02:00
Christoph Scholz
038359c74f fix foreach in fileupload 2019-05-16 15:22:35 +02:00
JC Brand
16db6195d3 Move MAM methods to the model 2019-05-16 12:01:46 +02:00
JC Brand
94bea16cc4 Remove chatBoxOpened event 2019-05-16 11:54:42 +02:00
supun19
d1572f3506 iOS viewport was less than 100vh so had to redefine vh units
fixes #1571
2019-05-15 18:32:11 +02:00
JC Brand
ceb9d12957 Don't store ChatRoomOccupants on ChatRoomView
Helps with enforcing discipline of keeping them separate
2019-05-15 15:55:47 +02:00
JC Brand
7cd69726a8 Loosen coupling between ChatRoomOccupantsView and ChatRoomView
Hide/show the sidebar based on state and not imperatively in ChatRoomView
2019-05-15 14:50:12 +02:00
JC Brand
9a94e5b47e Bugfixes in fetching of occupants 2019-05-15 14:30:43 +02:00
JC Brand
385a82f432 Bump strophe.js to 1.3.3 2019-05-15 09:50:17 +02:00
JC Brand
1bc425e596 Fetch cached occupants in the model instead of the view 2019-05-15 09:34:52 +02:00
JC Brand
69e8b071d8 Minor cleanups 2019-05-14 20:31:43 +02:00
JC Brand
12989ab241 New event: chatBoxBlurred 2019-05-14 16:26:25 +02:00
JC Brand
86f3399dc0 Also trigger 'chatboxFocused' when user manually focuses 2019-05-14 16:24:16 +02:00
supun19
dd0821076d Groupchat auto-configuration now supports list-multi fields 2019-05-14 15:28:06 +02:00
JC Brand
1d9e1a62df Only show new moderator status when not already admin or owner 2019-05-14 13:55:19 +02:00
JC Brand
14708af715 Refactor callback method into instance method 2019-05-14 13:54:19 +02:00
JC Brand
d0ddda8244 New config option muc_show_disconnection_status 2019-05-14 13:29:43 +02:00
JC Brand
6193a9dc80 Replace lodash methods with native ones and remove lodash.fp 2019-05-14 12:41:47 +02:00
JC Brand
d98b33de0a Trigger will-connect event inside reconnect method.
Also add docstrings.
2019-05-14 10:31:41 +02:00
JC Brand
4f705369bd Replace _.each and _.map with native methods 2019-05-13 20:16:39 +02:00
JC Brand
ca5b6f9fde Add class on MUC message to indicate author's role 2019-05-13 20:10:48 +02:00
JC Brand
d91a5ca6de Remove alias for xss. Upgrade pluggable.js to version 2.0.1 2019-05-13 18:54:00 +02:00
JC Brand
7a990ae0b9 Fixes #1558, this.get is not a function 2019-05-13 14:37:48 +02:00
JC Brand
84472ab752 Bugfix. npm install converse.js failed
because @converse-headless wasn't available
2019-05-10 15:26:50 +02:00
JC Brand
587dddd81d Update to latest version of Strophe
which logs less on the INFO loglevel
2019-05-10 13:26:30 +02:00
JC Brand
0e7d64818d Add NPM scripts so that we can build dist files 2019-05-10 12:57:30 +02:00
JC Brand
145ee88213 Start handling error presences in MUC model 2019-05-09 12:18:36 +02:00
JC Brand
c520a4e39b Trim nickname 2019-05-08 21:37:47 +02:00
JC Brand
77e58bff5f Test that MAM messages are fetched when a chatbox is opened
This is a precursor to also testing (and implementing) that a chat pages
through MAM results (see #1549)

Remove unused method.
2019-05-07 10:27:51 +02:00
JC Brand
2526d80464 Change api.disco.supports to resolve to a Boolean
Also add a new API method `api.disco.features.get` for the use-case
where you still want the feature object to be returned.
2019-05-07 10:27:25 +02:00
JC Brand
c3dac272f8 Replace moment with DayJS 2019-05-06 14:27:18 +02:00
JC Brand
9528276be2 Use native Date methods instead of moment
- Use native `getTime` method instead of moment's `valueOf`
- Use toISOString() instead of moment().format()
  This makes the code timezone independent since we're now globally using UTC.
2019-05-06 10:28:03 +02:00
laszlovl
565f7d9f74 Make sure the time attribute for MAM message is parsed through moment
Messages (received directly or via MAM) are stored in a backbone
collection that's kept sorted by the message's "time" attribute.
Various parts of the codebase rely on this behavior.

For regular messages, the time attribute is generated by
`moment().format()`, which generates a timestamp in the browser's
local timezone, for example "...+02:00".

For MAM messages, we would previously copy the "delay.stamp" value
into the "time" attribute verbatim. However, that value is generated
by the server and is unlikely to be in the same timezone locale.

ISO timestamps expressed in different timezones cannot be sorted
lexicographically, breaking the premise of keeping the messages
collection sorted by time.
2019-05-05 15:44:20 +02:00
JC Brand
15b2273631 _converse.api.archive.query now returns a Promise
instead of accepting a callback functions.
2019-05-03 19:47:49 +02:00
JC Brand
8bb852b139 Updates #1554
Room auto-configuration broke if the config form contained fields with type `fixed`
2019-05-03 18:04:03 +02:00
JC Brand
346baa686f Refactor room auto-configuration 2019-05-03 18:01:07 +02:00
JC Brand
273b9584c0 Refactor onMessage to use const instead of let 2019-05-03 14:12:26 +02:00
JC Brand
52ea8d5ab6 Fixes #1550
Legitimate carbons messages blocked due to erroneous forgery check
2019-05-03 14:11:29 +02:00
supun19
eec51f9d62 Doc rooms api (#1551)
* Rooms Api
number of parameters in the documentation was made 2 from 3 as api which is used to open a room with default configuration has only 2 parameters.
2019-05-03 11:38:05 +02:00
JC Brand
9c4f8aef23 Bugfix. Call _converse.reconnect regardless
it is debounced and otherwise we might enter a state where reconnection
no longer happens.
2019-05-02 16:50:58 +02:00
JC Brand
d868b9a9f7 Continuously retry to fetch login credentials 2019-05-02 14:53:42 +02:00
JC Brand
3290d6659f Bugfix. validation message should be set on the model 2019-05-02 14:53:07 +02:00
JC Brand
969f902d4a Playing around with removing more lodash calls 2019-04-29 09:47:46 +02:00
JC Brand
ba6de8844e Use Object.keys instead of _.keys 2019-04-29 09:29:40 +02:00
JC Brand
34469425d6 Use Object.assign instead of _.extend 2019-04-29 09:07:15 +02:00
JC Brand
51d0dc8d23 No such method disconnect 2019-04-27 18:09:59 +02:00
JC Brand
b9e5658112 Message deduplication bugfixes and improvements.
- Add a new method to check for dupes based on the message text.
- When checking for dupes based on origin_id, no need to restrict to
  only our own.
2019-04-27 18:09:58 +02:00
JC Brand
dedede56f8 Rename muc_disable_moderator_commands to muc_disable_slash_commands
Since those commands aren't only about moderation
2019-04-25 11:32:07 +02:00