Commit Graph

226 Commits

Author SHA1 Message Date
JC Brand
3530ccc35d Add initial TypeScript support and declaration files 2023-02-23 09:38:11 +01:00
JC Brand
05c5cd1046 Remove call to api.confirm in @converse/headless 2023-02-22 15:21:56 +01:00
JC Brand
16b442ac19 Occupant modal: Only show role/affiliation forms for moderators 2023-02-22 09:32:20 +01:00
JC Brand
56259fd22e Add the role form to the occupant modal 2023-02-21 23:14:16 +01:00
JC Brand
85181053e6 Make the role form a custom element
So that it can be used in the occupant modal as well.
2023-02-21 23:14:16 +01:00
JC Brand
d4cb67dc5f Add affiliation form to the occupant modal 2023-02-21 23:14:16 +01:00
JC Brand
ad7b4ae343 Add affiliation form to the occupant modal 2023-02-21 20:18:59 +01:00
JC Brand
57f489f61b Turn the MUC affiliation form into a component
So that it can be used elsewhere, for example in the occupant modal.
2023-02-21 20:18:16 +01:00
JC Brand
6ce8879e9c CSS: fix MUC textarea color when correcting a message 2023-02-21 17:41:39 +01:00
JC Brand
1ee4cce2fd Modtools: fix wrench icon not visible in dracula theme
Also fix spacing of buttons
2023-02-21 09:30:29 +01:00
JC Brand
b69e5b5482 Create occupants based on messages
That way the occupant modal can still be shown in MUCs even if the user
is no longer online.
2023-02-20 22:02:13 +01:00
JC Brand
15c10376b0 Rename all templates to camelCase
To conform with naming conventions regarding functions, which the
templates are.
2023-02-15 14:29:07 +01:00
JC Brand
5029d93523 XML stanza parsing fixes
- Add a `Stanza` class which can be used by Strophe because it has a
  `tree()` function. This is what gets returned by the `stx` tagged
  template.

- Throw an error when no valid namespace is on the stanza.
    Strophe.Builder used to automatically add the `jabber:client` namespace,
    but that doesn't happen with `toStanza`, so we need to fail if it's not
    specified by the user.

- Use the Strophe XML Parser
    This opens the door to NodeJS support
2023-02-14 11:50:38 +01:00
JC Brand
e63ba2075f Use repeat directive to render roster and MUC occupant items
If we don't use `repeat`, a DOM node may be reused with different state
(e.g. the `model` it receives originally changes upon next render).

https://lit.dev/docs/templates/lists/#when-to-use-map-or-repeat

Fixes #2816
2022-12-13 10:04:13 +01:00
JC Brand
78a7841afb Don't duplicate disco items across two collections
We now no longer have an `.items` collection on a disco entity.
Instead, add a new API method `api.disco.entities.items` should be used.

This should solve the issue of the entities disappearing when reloading
the page.

Updates #2925
2022-12-02 22:50:06 +01:00
JC Brand
a251608fc5 Fix race condition where waitUntilFeaturesDiscovered was resolved too early
When calling `api.supports(feature, entity_jid)`, it checks whether the entity
supports the feature or whether any of the sub-items on the entity
supports that feature.

However, on `DiscoEntity`, the `waitUntilFeaturesDiscovered` promise
didn't wait for the items on the entity to be fetched, and was therefore
resolved too quickly.

This caused the file upload button to not render.

Updates #2925
2022-11-08 20:03:37 +01:00
JC Brand
659a69e7b7 Make sure a moderator can also add contacts...
since they can see real JIDs, even if the room is semi-anonymous.

Also made changes regarding programming style and conventions:

- Pass in `this` to the template
    Recently I've started simplifying the `render` method by just
    passing `this` into the template and letting the template calculate
    what it needs from that.
- Don't use `bind()`
    It's slow and arrow functions can be used instead.
- Don't use an i18n string inside a tagged template literal
    Due to limitations with `xgettext` which cannot parse properly
    inside tagged template literals
- Use snake-case for variables
2022-11-03 10:14:12 +01:00
Simon Lipp
b0b8a3f89d muc: add a add to contacts button 2022-11-03 09:46:06 +01:00
JC Brand
b2ad6e844c Fix chat head buttons not showing
We need to use `converse-icon` now that the fontawesome fonts aren't
included
2022-10-30 16:51:15 +01:00
JC Brand
4531dd4363 Move Add-Hoc commands UI code into its own plugin 2022-10-18 09:33:28 +02:00
JC Brand
1a8ae3dcbe Make roster contacts toggleable 2022-10-02 15:52:01 +02:00
JC Brand
bd60861c1e Don't import plugins' index.js file from other plugins
Importing a plugin's `index.js` file from other plugins means that it's no
longer possible to remove that plugin by removing it from `src/converse.js`.

Instead, all plugins need to be imported in proper order from
`src/headless/headless.js` and `src/converse.js`.

Updates #3026
2022-09-20 14:48:20 +02:00
JC Brand
fbe86e5af8 Create an ElementView base modal and use it for all modals
Modals are now all web components and are opened by component name.
2022-09-16 10:33:47 +02:00
JC Brand
927add0707 Wrap requestUpdate in an arrow function
Otherwise parameters from the event handler might be passed in to it,
causing potential weirdness.
2022-09-16 10:26:21 +02:00
JC Brand
8378ce739b Remove unfurls for hyperlinks removed in a message correction 2022-09-12 10:05:54 +02:00
JC Brand
f1734dbb40 Bugfix. Trim whitespace after JID 2022-09-06 13:45:30 +02:00
JC Brand
a74bbd093f Improve rendering of add-muc autocomplete suggestions 2022-08-26 22:58:46 +02:00
JC Brand
8ae4b6abd4 MUC: Set occupant ID from reflected message 2022-08-21 17:33:35 +02:00
JC Brand
de72d6bae3 MUC: Move constants to separate file 2022-08-17 12:53:41 +02:00
JC Brand
7028286855 Restrict editing of MUC messages...
to ones with the same XEP-0421 occupant ID
2022-08-11 22:44:11 +02:00
JC Brand
f1cc8c85f4 Rename the stanza TTL to stx to avoid name clashes 2022-08-11 15:30:51 +02:00
JC Brand
3d19def3e7 Wait for emojis to be initialized before sending a message 2022-08-11 14:31:28 +02:00
JC Brand
f014db8b7a Update nick attr on ChatRoom when user nick changes 2022-08-11 10:23:16 +02:00
JC Brand
fe9345b7fc MUC: only allow corrections with a matching sender occupant-id
Also, don't render messages from a sender with a different `occupant-id`
as a followup message.
2022-08-10 14:53:18 +02:00
JC Brand
d8ea42a845 Add XEP-372 URI as data attribute to mention element 2022-07-19 11:59:55 +02:00
JC Brand
605c02901a Fix yet more tests 2022-07-14 21:17:32 +02:00
JC Brand
8dc8b1d564 Insert only the MUC JID when clicking an auto-complete suggestion 2022-06-12 10:25:41 +02:00
JC Brand
d2b4f2e0f6 MUC search: no need to first fetch the form 2022-06-12 09:59:50 +02:00
JC Brand
320f11f795 Use XMPP to search for MUCs via search.jabber.network
Also refactor AutoComplete somewhat to not compute `this._list` too
eagerly and to also pass the query string to `this._list`.
2022-06-11 23:43:43 +02:00
JC Brand
4237e5b3ae Style the add-muc modal autocomplete
- Let it drop down to the bottom
- Add a border
- Let it scroll
2022-06-11 23:42:47 +02:00
JC Brand
8671afc4b1 Document converse-autocomplete and always add closing tag
Weird parsing issues happen when a closing tag is not present.
2022-06-11 23:42:47 +02:00
JC Brand
0316f073e0 Replace font icons with svg icons 2022-06-11 23:42:47 +02:00
JC Brand
1744dbc420 Move roomslist tests to the right plugin 2022-06-11 23:42:47 +02:00
Sanskar Bajpai
1ad6de2dd6 AutoComplete: added converse-autocomplete suggestion to group chat query
this commit introduces autocomplete feature to the muc-list group chat dialog,
previously there was only an input field which displayed hardcoded servers.
2022-05-24 17:31:24 +02:00
Sanskar Bajpai
795a9a7e3e add-modal-test: replaced a mistyped jid 2022-05-24 17:04:38 +02:00
JC Brand
12a0d0e3cc Show roster contacts with subscription set to none
Remove the `allow_chat_pending_contacts` config option.
2022-05-13 10:19:52 +02:00
JC Brand
a57853156e Use our own confirm dialog consistently 2022-05-12 23:23:24 +02:00
JC Brand
ebd9474ac1 Add more ways to get VCard for occupant modal 2022-04-26 20:41:04 +02:00
JC Brand
b71a7ae2ac Turn ChatRoomOccupants and ChatRoomOccupant into classes 2022-04-26 20:33:54 +02:00
JC Brand
0a07cad2cb Move connection api into separate file 2022-04-25 09:48:08 +02:00