Commit Graph

1008 Commits

Author SHA1 Message Date
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
8b93e0f70a Move MUC message tests to spec/muc_messages.js 2019-08-14 10:34:56 +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
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
a407aff33c converse-ping: Refactor and update to reconnect upon ping timeout 2019-08-10 12:26:07 +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
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
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
bda567ca01 Fix linting errors 2019-08-05 11:26:48 +02:00
JC Brand
7a590f7c22 Stop using certain lodash methods.
* _.isNil
* _.noop
* _.isNull
2019-08-05 10:56:22 +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
ec85490f1c Allow configuration of which XEP-0095 CSN's may be sent out 2019-08-02 11:34:24 +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
cd392bb197 Fixes #1561 Don't clear localStorage and sessionStorage 2019-08-01 11:34:14 +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
bdbcec65c6 Update JSDoc strings. Combine two methods 2019-07-29 11:36:37 +02:00
JC Brand
e20b654876 Stop using _.isUndefined 2019-07-29 10:32:29 +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
JC Brand
c4ad02d4e3 New config setting: muc_fetch_members 2019-07-26 13:32:21 +02:00
JC Brand
9be43ccea7 Don't inform of role change which accompanies an affiliation change
given that it's implicit and can cause confusion
2019-07-22 18:45:30 +02:00
JC Brand
38d1e4e3d2 Bugfix. Sometimes when trimming chats, minimized chats go off screen 2019-07-12 12:50:20 +02:00
JC Brand
2849adf857 Stop debouncing show
Instead optimize in other ways.

Also:
- Don't fade in when `animate` is false.
- `trimChats` now gets called in `afterShown`.
- Add now event `beforeShowingChatView`
2019-07-12 12:42:41 +02:00
JC Brand
3a2bf766a0 Add new test utility waitUntilBookmarksReturned 2019-07-12 10:38:07 +02:00
JC Brand
a1630b5c1f Replace wait-until-promise with utility method
and bump default timeout

Also let `_converse.api.waitUntil` use it if a function is passed in.
2019-07-11 23:34:27 +02:00
JC Brand
8a98ef87fe Various small fixes. (Unused imports, unused vars etc). 2019-07-11 12:37:17 +02:00
JC Brand
8a405ee88c Various bugfixes based on the previous refactoring.
These two commit should ideally be one, but I inadvertently pushed to
remote too early.
2019-07-10 16:55:55 +02:00
JC Brand
ded9945ed9 MUC: Don't send XEP-0085 CSNs when we don't have voice
Includes some refactoring:

- Don't send an `active` chat state notification when entering a MUC
  I can't think of a good reason why this might be necessary or desired.
- Move `setChatState` form the view to the model
- Remove unused method `handleChatStateNotification`
- Don't store `role` and `affiliation` for the current user on the
  ChatRoom object, but instead on the ChatRoomOccupant object representing
  the user.
2019-07-10 14:24:00 +02:00
JC Brand
5c88d3e836 Add role and affiliation classes to message DOM element 2019-07-08 13:58:15 +02:00
JC Brand
3ca6ac7f50 Fixes #1524 Don't include own device in OMEMO message
This change reverts the significant part of 1dfdb36d20

I can't say that I understand why libsignal throws `Error: Invalid signature`
when you try to build a session for your own (sending) device, but given that
messages can only be decrypted once, I guess it isn't really necessary
to encrypt for your own device, since you already have the plaintext.

In addition I've added some error handling so that we can recover
gracefully when session building fails for a subset of devices.
2019-07-05 19:21:05 +02:00
JC Brand
e5188d8b10 Bugfix. Remove affiliation based on updated members lists 2019-07-04 08:28:12 +02:00
JC Brand
1a3526f537 Update openAndEnterChatRoom to take JID 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
3bd8c6dbec Fix failing test on Travis 2019-07-01 18:07:08 +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
615b5b08a2 Fix failing test on Travis 2019-06-28 13:14:40 +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
98215deb21 Update to latest backbone.overview which debounces sorting on add event 2019-06-27 13:15:55 +02:00
JC Brand
9ee0b68133 Fix failing test 2019-06-26 17:31:53 +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
9430627180 Re-group some message specs 2019-06-26 11:09:07 +02:00
JC Brand
2cbc4aaa50 Fixes #1494. Trim whitespace around messages 2019-06-26 10:59:56 +02:00
JC Brand
c759112cf3 Fix failing test 2019-06-25 22:53:39 +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
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
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
7455ce1b07 Fixes #1579 and fixes #1538 2019-06-19 09:24:44 +02:00