Commit Graph

1144 Commits

Author SHA1 Message Date
JC Brand
a8104d7498 Add Skeletor as dependency 2020-01-30 17:36:55 +01:00
JC Brand
b08f5d355b roster: avoid race-condition by waiting for contacts to be fetched
before creating any new ones
2020-01-30 17:36:55 +01:00
Christoph Scholz
a472a0806e show headline messages in controlbox 2020-01-23 11:32:15 +01:00
JC Brand
464c68a3b6 Fix typo 2020-01-22 15:58:28 +01:00
JC Brand
bda704901f emoji-views: lazily render picker only once user clicks to open 2020-01-22 15:00:16 +01:00
JC Brand
f3472e1b9f emoji: Add initialize API method and call when chat view gets created 2020-01-22 13:20:59 +01:00
JC Brand
901f70272e message-view: Re-use image element and fix autoscroll after image loads 2020-01-21 15:32:34 +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
4018dd959e Fixes #1764: Incorrect URI encoding in references 2020-01-09 14:59:45 +01:00
JC Brand
17654aaf40 emoji-views: incorporate tab-based navigation 2020-01-08 11:38:31 +01:00
JC Brand
995f2a9997 Add arrow navigation to the emoji picker 2020-01-07 15:47:05 +01:00
JC Brand
8b6c902c4c Set VCards via events, thereby reducing coupling
- Rename `chatRoomOpened` event to `chatRoomViewInitialized`
- Rename `chatBoxInitialized` to `chatBoxViewInitialized` and trigger only for `ChatBoxView` instances.
- New event `headlinesBoxViewInitialized`
- Trigger the `chatBoxInitialized` event when a new `_converse.ChatBox` is opened.
2019-12-18 15:20:51 +01:00
JC Brand
c3102561f4 updates #1795: Only download metadata for video files 2019-12-18 15:20:51 +01:00
JC Brand
b0e66232d3 Fixes #1253: Show contacts with unread messages at the top of the roster 2019-12-18 11:42:26 +01:00
JC Brand
03b7ae0a30 Improvements to how things are stored.
- Use the bare JID as indexedDB dataStore
- Collapse localStorage and indexedDB stores into one `persistent` store.
- When testing, only clear test data
2019-12-17 13:59:43 +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
1c116b0385 mam: distinguish between messages fetched before and after MUC join 2019-11-29 16:17:48 +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
e23c7ce543 More retraction updates
- Retracted moderated message are not editable
- Use "removed" for user-facing text
2019-11-26 22:04:38 +01:00
JC Brand
adf2e97ea1 Fix failing tests 2019-11-22 13:50:36 +01:00
JC Brand
025cdbf18f Check for support before allowing message moderation 2019-11-22 13:50:36 +01:00
JC Brand
1b9ba58aca Rename variable to be more accurate 2019-11-22 13:50:36 +01:00
JC Brand
99f539b3cb MUC: Don't show duplicate subsequent info messages 2019-11-22 13:50:36 +01:00
JC Brand
3d4bad4b19 Don't mark info messages as followups 2019-11-22 13:50:36 +01:00
JC Brand
657dd1e6d1 Add /close command for chats 2019-11-22 13:50:36 +01:00
JC Brand
d895c7fc16 Bugfix. Leave space between classes 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
4b3d427cff muc: only create view once model has finished initialization 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
8523cae8d0 Move message parsing code out of ChatBox into new stanza-utils plugin 2019-11-22 13:50:36 +01:00
JC Brand
caadb24310 Refactor logging out into its own module
So that we don't need to `_converse` obj in order to log messages
2019-11-22 13:50:36 +01:00
JC Brand
88ea9f8b61 Match a message of only emojis (instead of just a single emoji) 2019-11-18 12:51:18 +01:00
JC Brand
eae878e766 Fix failing test 2019-11-12 16:21:47 +01:00
JC Brand
e22923d546 Fix failing test 2019-11-05 09:53:41 +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
17dfa3d7ba Avoid race-condition that destroys vcards
VCards were being created before `fetch` was completed, so once fetch
was done those VCards were unset from their collection.

Add a new event and promise `VCardsInitialized` that triggers after
successful fetching and wait for it before creating VCards.
2019-10-30 13:02:23 +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
b6d5077d04 Refactor _converse.XMPPStatus out into headless/converse-status.js
Also move some other methods out of `converse-core` into the plugins
that use them.
2019-10-18 11:13:09 +02:00
JC Brand
1a7f58b578 Fix linting error 2019-10-17 17:27:41 +02:00
JC Brand
aae7e111eb Fix roster caching and versioning issue.
- Always try to first get local cache before requesting the roster.
- Rename `roster_fetched` with `roster_cached`
2019-10-17 16:19:14 +02:00
JC Brand
e6e23a1a82 Add initial support for custom emojis 2019-10-17 12:12:08 +02:00
JC Brand
99805d2510 Make sure the roster is fetched again if stream resumption fails 2019-10-15 14:30:04 +02:00
JC Brand
f21abc60f5 roster: Only fetch from browser storage if already cached 2019-10-15 13:09:34 +02:00
JC Brand
bcd39a7ff4 Use utility method in tests 2019-10-13 19:51:44 +02:00
JC Brand
91397125ba roomslist: Refactor to use VDOMView instead of OrderedListView 2019-10-13 16:59:31 +02:00
JC Brand
28d0e88565 Update test to wait for IQ stanzas 2019-10-11 21:13:45 +02: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
9d77a4ef97 Fixes #129 Add support for XEP-0156.
Only XML is supported for now.
2019-10-11 17:46:13 +02:00
JC Brand
445ff4f8aa Rewrite test to avoid connection spy 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
JC Brand
68e34351ed Reject unencapsulated forwarded messages
since we don't support XEP-0297 on its own
2019-09-13 13:05:21 +02:00
JC Brand
fe34b7eaa0 Fix failing test 2019-09-13 06:29:47 +02:00
JC Brand
37d052ad9e Verify that Converse is not susceptible to CVE-2015-8688
https://gultsch.de/gajim_roster_push_and_message_interception.html
2019-09-12 19:46:09 +02:00
JC Brand
c6f3da5887 Clean up test 2019-09-12 19:15:13 +02:00
JC Brand
251061fad6 Fix failing tests 2019-09-12 12:11:27 +02:00
JC Brand
35e97c2353 Ignore MAM chat messages not sent from yourself 2019-09-11 14:18:21 +02:00
JC Brand
0af9bc8ffc Fixes #1704
Ignore carbon groupchat messages
2019-09-11 14:18:21 +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
e305cc35b0 Remove --larger class on a edited message that's no longer just emojis 2019-09-10 16:54:32 +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
42ec0037c6 Fix failing test 2019-09-05 15:17:23 +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
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
3cc993740e Fix failing tests 2019-08-23 21:36:53 +02:00
JC Brand
d619012b6b Emojis: Fix failing tests 2019-08-23 07:05:00 +02:00
JC Brand
c01d110501 Avoid interference between username and emoji autocomplete 2019-08-22 14:30:02 +02:00
JC Brand
2c48096664 Add new spec with emoji tests 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
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