Commit Graph

116 Commits

Author SHA1 Message Date
JC Brand
61e86a3c23 Fixes #1535
Add option to destroy MUC in the dropdown context menu.
Also add a confirmation dialog.
2020-02-22 20:22:02 +01:00
JC Brand
62ef18a027 muc_fetch_members now accepts an array of affiliations 2020-02-20 18:39:56 +01:00
JC Brand
49817a850f MUC: Queue messages received before we're ready 2020-02-20 07:13:04 +01:00
JC Brand
f564a1edaf Show reason and actor for ban/kick events 2020-02-14 13:19:12 +01:00
JC Brand
3400acbfeb Show MUC buttons in a dropdown menu
- Get rid of the ChatBoxHeading class
- Add support for showing standalone buttons in overlay viewmode
2020-02-13 20:57:47 +01:00
JC Brand
0653505a40 tests: Use u.getUniqueId instead of time for message ids 2020-02-07 12:35:54 +01:00
JC Brand
6e8a987694 Fix failing test (when run in isolation) 2020-02-04 13:46:43 +01:00
JC Brand
30d08d2bfe muc-views: Remove features section...
and replace with button to open invite modal
2020-01-30 17:36:55 +01:00
JC Brand
9fb2056753 Move MUC invite widget into a modal 2020-01-30 17:36:55 +01:00
JC Brand
d32c4c1f61 muc-views: replace VDOMView with HTMLView 2020-01-30 17:36:55 +01:00
JC Brand
a8104d7498 Add Skeletor as dependency 2020-01-30 17:36:55 +01:00
JC Brand
b0a9782d31 emoji: Lazy load the emoji JSON
Only load it once the first chat has been opened.
2020-01-21 12:45:34 +01:00
JC Brand
17ef50f662 muc-views: admins can also change the MUC subject 2020-01-17 14:50:25 +01:00
JC Brand
161cbec0d8 For forbidden errors, show error message from server 2020-01-17 14:44:05 +01:00
JC Brand
aa86a8be32 muc: Store room configuration (e.g. disco#info fields) on the MUC
This will make it easier to add config-based functionality, such as
allowing/showing the `/topic` slash command only to those users who are
allowed to set the subject.
2020-01-16 15:28:02 +01:00
JC Brand
d17ae811d7 More CSS and test fixes 2020-01-15 15:48:31 +01:00
JC Brand
8a4c71305f Fix failing tests 2020-01-15 14:23:05 +01:00
JC Brand
9ce315dece Bugfix. Handle stanza that clears the MUC subject 2020-01-14 10:07:23 +01:00
JC Brand
a4567ee075 muc: Store connection_status in session storage
Otherwise we might run into a situation where a very old,
cached MUC that's being restored has `connection_status` set to ENTERED
(and the user happens to be in the MUC via another client)
and then restores cached messages without taking
`clear_messages_on_reconnection` into account.
2019-12-11 08:10:27 +01:00
JC Brand
3d3738f3be muc: refactor MUC joining
We now distinguish more clearly between joining and re-joining a MUC.

The `enterRoom` method has been refactored away.

Instead, `join` or `rejoin` should be used, depending on the circumstances.

Don't fetch cached occupants in the `initialize` function, instead, only fetch
them if we're restoring a MUC that we're still connected to.

If we're not restoring a still-connected MUC, then we clear the
occupants cache, and the messages cache if `clear_messages_on_reconnection` is `true`.

updates #1807
updates #1808
2019-12-09 17:17:33 +01:00
JC Brand
7bf39a092f muc: move message handler into own method 2019-12-06 13:09:09 +01:00
Dele Olajide
890db3427f Handle message notifications about affiliation change for users not in a room
See https://git.happy-dev.fr/startinblox/components/sib-chat/issues/96
2019-12-06 12:55:07 +01:00
JC Brand
d7d810ba89 Improvements to rendering MUC MAM logs before joining
- Add config variable `muc_show_logs_before_join`
- Restore nickname form for the original use-case (when not showing MAM logs before joining).
- Render nickname form in the `.muc-bottom-panel` when showing MAM logs (instead of in a modal)
- Show a message when there aren't any archived messages to show
- Fix converse-mam so that chat logs are properly fetched before entering a MUC

closes #1266
2019-11-29 09:23:15 +01:00
JC Brand
adf2e97ea1 Fix failing tests 2019-11-22 13:50:36 +01:00
JC Brand
b4dafcc45b Add support for XEP-0424 and XEP-0425
- Add support for switching ephemerality after message creation
- Move more methods from ChatBox and ChatRoom to utils/stanza.js
- Rename 'ephemeral' to 'is_ephemeral' since it's a boolean
2019-11-22 13:50:36 +01:00
JC Brand
e915321e33 Group MUC utility methods in muc_utils object
as opposed to having them in the `u` object
2019-11-22 13:50:36 +01:00
JC Brand
879e165ae5 Refactoring
- Move headless one-on-one chat functionality into converse-chat
- Split converse-headline into converse-headlines and converse-headlines-views
- Add api in `_converse.api.chatboxes` for creating chatboxes
- Add `_converse.api.controlbox.get` method
2019-11-04 15:05:50 +01:00
JC Brand
1fa203c990 Support for IndexedDB. updates #1105
Depend on latest backbone.browserStorage which has support for IndexedDB
via localforage.

Storage operations are now asynchronous and transactional.

Bugs fixed (mostly by waiting for operations to complete):

* Rooms are now fetched asynchronously, so wait before triggering `show`
  or when closing.
* Make sure chat create/update transactions complete before firing events
* Make sure chats and messages have been fetched before creating new ones.
* When doing a `fetch` with `wait: false` on a collection and then
  creating a model in that collection, then once the read
  operation finishes (after creating the model), the collection is emptied again.
* Patch and wait when saving.
  Otherwise we have previously set attributes overriding later ones.
* Make sure api.roomviews.close returns a promise

Test fixes:

* Chats are now asynchronously returned, so we need to use `await`
* Wait for the storage transaction to complete when creating and updating messages
* Wait for all chatboxes to close
    Otherwise we get sessionStorage inconsistencies due to the async nature of localforage.
* Wait for room views to close in spec/chatroom.js

In the process, remove the `closeAllChatBoxes` override in
converse-controlbox by letting the `close` method decide whether it
should be closed or not.
2019-10-30 13:02:23 +01:00
JC Brand
66c052f3fd Remove saveAffiliationAndRole method. Doesn't appear to be necessary. 2019-10-30 09:38:22 +01:00
JC Brand
b71500104b Move emoji-picker out so that its width can expand 2019-10-29 17:19:33 +01:00
JC Brand
877e07775a Remove need to pass in spies to initConverse
They aren't used anymore.
2019-10-11 17:46:13 +02:00
JC Brand
b63b080419 chatboxes: wait until messages are fixed before returning new chatbox
Fixes #1691
2019-10-10 14:44:13 +02:00
JC Brand
2b268c92bb Fix linting error 2019-10-09 17:08:28 +02:00
JC Brand
8780f7a128 Fix linting errors (no-unused-vars) 2019-10-09 16:27:58 +02:00
Licaon_Kter
a69ebcbdf6 Capitalize "groupchat" (#1707)
* Capitalize "groupchat"

* Also locale

* Also muc spec
2019-09-11 14:17:23 +02:00
JC Brand
90ef4b0c9d Don't let non-mods open the modtools modal
Bugfix: fall back to nick if the JID is not available.
2019-09-08 00:15:05 +02:00
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
2c48096664 Add new spec with emoji tests 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
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
89ac4a6969 Show error message with option to retry when MAM query times out 2019-08-13 11:08:03 +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
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
c7b6bb4773 Only clear messages when clear_messages_on_reconnection is true 2019-08-03 21:43:06 +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
c4ad02d4e3 New config setting: muc_fetch_members 2019-07-26 13:32:21 +02:00