Commit Graph

1385 Commits

Author SHA1 Message Date
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
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
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
c41bdac6c8 Some work on componentizing the minimized chats UI 2020-09-03 13:06:17 +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
JC Brand
ac31d41c85 Test string value for filter_url_query_params 2020-09-01 07:26:20 +02:00
Ariel Fuggini
3535d05ff5 Removes query params from urls as set in config 2020-09-01 07:12:52 +02:00
JC Brand
d83d0158e2 Properly test for show_images_inline 2020-08-31 21:02:07 +02:00
JC Brand
831a9fa224 Append .png to failed image URLs without extensions
Otherwise Imgur URLs don't render
2020-08-31 20:43:54 +02:00
Ariel Fuggini
6adec9a8d2 adds option to whitelist image domains 2020-08-31 20:38:09 +02:00
Ariel Fuggini
f88960c561 Added tests and documentation 2020-08-31 17:13:24 +02:00
JC Brand
8c799efc58 Don't minimize chats by clicking the header
This prevents the burger menu from opening
2020-08-24 11:28:48 +02:00
JC Brand
f7ef334fac Rename method to better describe what it does 2020-08-18 21:09:39 +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
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
JC Brand
1898e7865d Move the MUC list modal to its own file 2020-07-28 13:07:33 +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
1419b4fc96 MUC: Add support for status code 333 2020-07-22 10:11: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
91c130752c chatview: Scroll down on image load 2020-07-14 14:17:54 +02:00
JC Brand
282ffc622f Emoji picker fixes
- Don't replace entire textarea when entering a second emoji
- Focus emoji picker on tab completion when it's already opened
2020-07-14 11:38:00 +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
e6d8634194 Emoji picker: properly insert emoji upon click 2020-07-13 10:59:57 +02:00
JC Brand
756a85fb53 Emoji picker: make sure search results get properly updated 2020-07-13 09:55:01 +02:00
JC Brand
d0ba94e9df Replace lodash templates with lit-html 2020-07-09 22:08:23 +02:00
JC Brand
a014eca9e7 Add a renderImage directive which handles errors 2020-07-09 20:51:32 +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
bb9ee4caab Enable all tests again 2020-07-09 11:15:28 +02:00
JC Brand
34c0c248be Move mentions tests into their own file 2020-07-08 14:32:06 +02:00
JC Brand
4bf823f6cd Fix show/hide of spoilers 2020-07-08 10:22:20 +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
a36ba22676 Test message stanza with spoiler 2020-07-01 09:25:22 +02:00
JC Brand
f8efd94249 Don't smooth-scroll upon first appearance of the chat
it's annoying in overlayed view-mode where the user might be navigating
around the site.

Fixes #2091
2020-06-30 14:11:53 +02:00
JC Brand
9026062a32 Render chatbox message form via lit-html 2020-06-26 16:08:34 +02:00
JC Brand
22b2875b52 emoji-picker: Move picker content into another component
to avoid re-rendering them when non-relevant properties change
2020-06-25 14:31:01 +02:00
JC Brand
b3e34a0636 Turn the emoji picker into a web component 2020-06-25 10:27:29 +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
JC Brand
e2fbfa7470 modtools: Better error reporting 2020-06-22 13:13:44 +02:00
JC Brand
a31d245136 Update to eslint 7.3.0 2020-06-22 11:01:19 +02:00
JC Brand
0120f78c87 modtools: Don't show admin...
as assignable affiliation when the current user is an admin.

https://xmpp.org/extensions/xep-0045.html#affil-priv
2020-06-22 10:50:49 +02:00
Ariel Fuggini
73d33e1161
Makes mentions case-insensitive, plus parsing functionality refactor (#2061) 2020-06-18 11:19:01 +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
Ariel Fuggini
48fcbfa5ea Finds names by RegExp with i param for case insensitive 2020-06-09 10:33:21 +02:00
JC Brand
c2c1db587f Create a component which renders message actions in a dropdown 2020-06-05 16:02:58 +02:00
JC Brand
6ad76c14ef Fix test failure on travis 2020-06-05 16:02:23 +02:00
JC Brand
18b0d8db3f Don't indent followup messages when messages don't have avatars 2020-06-04 15:29:06 +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
279a6e6cb8 Increase test timeouts 2020-06-03 09:15:35 +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
deb7c63910 Add test for the /clear command 2020-06-01 15:42:37 +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
Dele Olajide
cae5e9c875 Updates #1999 - Demarcate first unread message 2020-05-13 13:39:33 +02:00
Ariel Fuggini
c70a256eb1 Added mailto protocol to safe list 2020-05-13 11:18:39 +02:00
JC Brand
efb486511c Add another test for registration errors and fix bug 2020-05-12 15:32:52 +02:00
Ariel Fuggini
5674056c3f Fixes, added tests 2020-05-07 18:28:19 +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
e67230633f Add test for muc_send_probe setting 2020-05-07 10:54:03 +02:00
JC Brand
6cd2fac33c Set more test timeouts 2020-04-28 12:19:22 +02:00
JC Brand
0c5593ed75 Various smaller fixes
- Fix failing tests.
- Bump timeout for emoji tests
- Remove unused files.
- Update features section.
2020-04-28 10:42:20 +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
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
4b270359f6 Use Karma as test runner 2020-04-23 11:55:51 +02:00
JC Brand
7e23adf26f Remove the need for require.js to run tests 2020-04-22 12:10:39 +02:00
JC Brand
c1efb0d2b4 Add an external API for sending presences 2020-04-19 09:41:38 +02:00
JC Brand
8a7b25584d Show error messages via objects
Instead of injecting them directly into the DOM.
2020-04-19 08:03:44 +02:00
JC Brand
60b3f7ae25 Add an autocomplete component 2020-04-17 11:01:44 +02:00
Dele Olajide
f97d827280
fix #1963 - Mentions are visually incorrect when used in message replies (#1968)
* fix #1963 - Mentions are visually incorrect when used in message replies
2020-04-15 12:25:53 +02:00
JC Brand
c9084e4ed5 muc-views: Present challenge to destroy confirmation
And also allow the user to specify the JID to where the conversation has
moved to.
2020-04-15 09:30:10 +02:00
JC Brand
df9612f937 Add support for XEP-0317 MUC Hats 2020-04-13 22:57:29 +02:00
JC Brand
a1d5563963 Move OMEMO-related message parsing to utils/stanza.js 2020-04-13 17:44:47 +02:00
JC Brand
e91a38547a MUC: create role/affiliation change message objects
in @converse/headless instead of injecting HTML via the view
2020-04-13 11:21:40 +02:00
JC Brand
4ef5363024 Fix failing tests 2020-04-10 16:59:34 +02:00
JC Brand
4425c3dde7 Always show a new topic, even if the previous one was hidden 2020-04-08 14:31:18 +02:00
JC Brand
bc4d016557 Don't show duplicate topic change notifications 2020-04-08 13:08:15 +02:00
JC Brand
5fd316816d MUC: Don't show topic change notification for old changes.
Also, show topic by creating a message object, instead of directly
inserting HTML into the DOM. This is a necessary precursor to being able
to render chat messages via lit-html/lit-element.
2020-04-07 11:49:12 +02:00
JC Brand
e18fe5e212 Use the getHeadingButtons hook instead of overrides 2020-04-07 10:20:43 +02:00
JC Brand
531ebf335c Properly test and fix show/hide of MUC topic 2020-04-06 15:27:32 +02:00
JC Brand
bb9e394e93 muc: handle join/leave notifications similarly to CSNs
Remove the `muc_show_join_leave_status` config setting.
We don't show the optional statuses at all now.
2020-04-01 14:34:11 +02:00
JC Brand
c20dbbbbbd Store in user settings whether a MUC topic is hidden or not 2020-03-31 22:57:22 +02:00
JC Brand
6391cc0803 Rename applyUserSettings to applySiteSettings 2020-03-31 14:08:34 +02:00
JC Brand
631b9bb438 Use the settings API for setting and getting config settings
This is an initial step towards no longer storing and accessing settings
directly via the `_converse` object
2020-03-31 11:57:03 +02:00
JC Brand
321a54323e Allow moderators to retract their own messages...
when retractions are restricted to mods only
2020-03-26 10:35:08 +01:00
JC Brand
6865a73f46 Fix failing tests 2020-03-25 12:18:19 +01:00
JC Brand
e3bd7b45f5 Distinguish between chat content and messages content.
Fixes a bug that prevented scrolling from working correctly
2020-03-24 14:34:57 +01:00
JC Brand
7812d4e7b6 Show chat state notifications inside the scrollable area
Rename CSS class to conform to convention
2020-03-24 11:28:50 +01:00
JC Brand
5e27579ebe Don't ignore groupchat messages that also contain a CSN 2020-03-23 20:54:27 +01:00
JC Brand
57709b2e78 Sort modtools search results by nickname 2020-03-23 18:06:36 +01:00
JC Brand
00cac6d250 Add the ability to filter the results in the modtools modal 2020-03-23 14:34:19 +01:00
JC Brand
b215c59bd0 Add more XSS tests 2020-03-21 21:43:29 +01:00
JC Brand
540a85e8db Move XSS tests into a separate spec 2020-03-21 21:12:36 +01:00
JC Brand
b5d57f0ef8 Handle and render chat state notifications separately from messages 2020-03-21 17:21:53 +01:00
JC Brand
ca012d4479 Update to newer Skeletor.js
`.forEach` on a Collection no longer returns the models, so need to
update some tests.
2020-03-12 15:24:29 +01:00
JC Brand
c9f29f76e5 Use lit-html to render URLs 2020-03-06 12:24:23 +01:00
JC Brand
366dee0aa5 Bugfix. Allow moderators to retract their own messages 2020-03-05 13:42:58 +01:00
JC Brand
a7f28cd61d When creating message objects, wait for confirmation from storage
Queue messages and handle them sequentially, each time waiting for promises to
resolve before handling the next message.

Updates #1899, which likely happens because an error message is received
before messages have been fetched.
2020-03-04 15:14:57 +01:00
Lance Stout
a6aaf3f595 Update chat state notifications when message is edited. 2020-03-03 15:24:15 +01:00
JC Brand
f34cc63d4c Log out before running test
To avoid one test which times out, causing subsequent tests to not be
run (and therefore also time out).
2020-03-03 15:12:20 +01:00
JC Brand
831e59c1a7 controlbox: Wait when saving while closing
Otherwise we run into race conditions while testing
2020-03-03 14:38:29 +01:00
JC Brand
8aaa1a6417 core: Make clearSession a synchronous event
In order to give plugins time to properly clear data from the browser storage.
2020-03-03 10:23:46 +01:00
JC Brand
9295850789 controlbox Only call show/hide callback when the action was actually done 2020-03-03 08:21:55 +01:00
JC Brand
2af93f4492 modtools: settings for which roles/affiliations may be queried or assigned 2020-02-22 23:16:22 +01:00
JC Brand
e5341d54a9 Bugfix. Dangling moderation messages not applied 2020-02-22 22:59:30 +01:00
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
3c9ec96350 MUC: create references for nicks gathered from messages 2020-02-21 12:30:40 +01:00
JC Brand
d361d1d0a3 MUC: Include nicks from messages in the mentions auto-complete list 2020-02-20 19:14:34 +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
0137eb88ae Smacks: Handle MUC messages received before the MUC exists 2020-02-19 13:39:07 +01:00
JC Brand
ce08819a43 Retracted moderated sent message should not be editable. 2020-02-18 16:47:52 +01:00
JC Brand
ead8cdbcd6 Retracted moderated message should not be editable.
Also, don't set retracted MUC messages as ephemeral, we want to keep on
showing them to provide context in a MUC.
2020-02-18 16:06:59 +01:00
JC Brand
227b70339c Bugfix. Retracted messages shouldn't be editable. 2020-02-18 15:45:55 +01:00
JC Brand
004d2b7f23 Fix method name in log 2020-02-18 15:45:55 +01:00
JC Brand
f564a1edaf Show reason and actor for ban/kick events 2020-02-14 13:19:12 +01:00
JC Brand
39d140005e Change when/how chats are shown
Goal is to fix a timing bug that results in `show` being triggered
before the `ChatBoxView` has been initialized, which means that 1:1
chats aren't opened when you reload the page.
2020-02-14 11:06:04 +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
2235d4c432 Use lit-html to render MUC heading 2020-02-07 14:58:26 +01:00
JC Brand
7d91b17552 Rename methods to clarify their purpose 2020-02-07 12:42:19 +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
fb9fe280ac Updates to how dupes are detected.
- Collapse 3 different loops into one.
- Check all saved stanza ids in the parsed attrs, not just the archive id
- Remove check for archive id in converse-mam since it just duplicates what's now being done in converse-chat
- Don't use disco to check for support, XEP-359 mandates that services SHOULD advertise support,
  which is not a strong enough guarantee that they do.

updates #1856
2020-02-07 12:35:45 +01:00
JC Brand
6e8a987694 Fix failing test (when run in isolation) 2020-02-04 13:46:43 +01:00
JC Brand
7d7c41a135 OMEMO: fix timing errors
- Use async/await
- Wait for devices to be created before continuing
2020-02-03 23:24:44 +01:00
JC Brand
f78837cbc5 Refactor identification of duplicates...
to rely on the parsed stanza attributes

This was to fix a bug whereby a full stanza was used to query for 1:1
messages with a full JID when the bare JID is stored.

We now are sure that the attributes we're using to query for duplicates
are the same attributes that get saved for a messages.
2020-02-03 23:24:44 +01:00
JC Brand
e3708bd598 Refactor headlines list to render everything with one view 2020-01-30 19:57:04 +01:00
JC Brand
73fa24a844 headlines: move view code into converse-headlines-view.js 2020-01-30 18:18:27 +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
d310f1e3e4 emoji-views: use lit-html for templating
* declare picker events in lit-html
* init intersection observer only once
* don't set value manually
* don't manually add classes
* avoid x-scrollbar and 'undefined' in search input
2020-01-30 17:36:55 +01:00
JC Brand
ad93407907 Replace modal templates with lit-html components 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
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