Commit Graph

2398 Commits

Author SHA1 Message Date
JC Brand
7e515dd4b1 Move all MUC joining logic to the model 2019-05-20 10:06:37 +02:00
JC Brand
39363d495f Fetch messages in MUC model 2019-05-20 09:25:11 +02:00
JC Brand
46fef28601 Clear messages when closing a chat 2019-05-19 22:11:37 +02:00
JC Brand
3085c5d408 Catch errors when destroy is called for already removed message 2019-05-19 21:43:03 +02:00
JC Brand
84bde6e766 Move some close logic to the model 2019-05-18 07:09:53 +02:00
JC Brand
0426898c23 Store chat messages in sessionStorage
so that they're cleared when the last tab closes
2019-05-18 06:57:48 +02:00
JC Brand
7950f7c2ac Change muc_show_disconnection_status to muc_show_join_leave_status 2019-05-18 06:34:29 +02:00
JC Brand
f7b19053ec Use origin_id as id for outgoing messages as well 2019-05-18 05:32:04 +02:00
JC Brand
a0f1a5cfaf Fetch chat messages in the model, not the view 2019-05-17 14:45:37 +02:00
JC Brand
e7ceb22a56 Avoid duplication by keeping track of message views 2019-05-17 14:45:37 +02:00
JC Brand
0fa6bcdcc2 Reduce debounce time for scrolling down. 2019-05-17 14:45:37 +02:00
JC Brand
bad9b08b61 disable_mam should now be set on the model 2019-05-17 13:53:31 +02:00
Christoph Scholz
038359c74f fix foreach in fileupload 2019-05-16 15:22:35 +02:00
JC Brand
16db6195d3 Move MAM methods to the model 2019-05-16 12:01:46 +02:00
JC Brand
94bea16cc4 Remove chatBoxOpened event 2019-05-16 11:54:42 +02:00
supun19
d1572f3506 iOS viewport was less than 100vh so had to redefine vh units
fixes #1571
2019-05-15 18:32:11 +02:00
JC Brand
ceb9d12957 Don't store ChatRoomOccupants on ChatRoomView
Helps with enforcing discipline of keeping them separate
2019-05-15 15:55:47 +02:00
JC Brand
7cd69726a8 Loosen coupling between ChatRoomOccupantsView and ChatRoomView
Hide/show the sidebar based on state and not imperatively in ChatRoomView
2019-05-15 14:50:12 +02:00
JC Brand
9a94e5b47e Bugfixes in fetching of occupants 2019-05-15 14:30:43 +02:00
JC Brand
385a82f432 Bump strophe.js to 1.3.3 2019-05-15 09:50:17 +02:00
JC Brand
1bc425e596 Fetch cached occupants in the model instead of the view 2019-05-15 09:34:52 +02:00
JC Brand
69e8b071d8 Minor cleanups 2019-05-14 20:31:43 +02:00
JC Brand
12989ab241 New event: chatBoxBlurred 2019-05-14 16:26:25 +02:00
JC Brand
86f3399dc0 Also trigger 'chatboxFocused' when user manually focuses 2019-05-14 16:24:16 +02:00
supun19
dd0821076d Groupchat auto-configuration now supports list-multi fields 2019-05-14 15:28:06 +02:00
JC Brand
1d9e1a62df Only show new moderator status when not already admin or owner 2019-05-14 13:55:19 +02:00
JC Brand
14708af715 Refactor callback method into instance method 2019-05-14 13:54:19 +02:00
JC Brand
d0ddda8244 New config option muc_show_disconnection_status 2019-05-14 13:29:43 +02:00
JC Brand
6193a9dc80 Replace lodash methods with native ones and remove lodash.fp 2019-05-14 12:41:47 +02:00
JC Brand
d98b33de0a Trigger will-connect event inside reconnect method.
Also add docstrings.
2019-05-14 10:31:41 +02:00
JC Brand
4f705369bd Replace _.each and _.map with native methods 2019-05-13 20:16:39 +02:00
JC Brand
ca5b6f9fde Add class on MUC message to indicate author's role 2019-05-13 20:10:48 +02:00
JC Brand
d91a5ca6de Remove alias for xss. Upgrade pluggable.js to version 2.0.1 2019-05-13 18:54:00 +02:00
JC Brand
7a990ae0b9 Fixes #1558, this.get is not a function 2019-05-13 14:37:48 +02:00
JC Brand
84472ab752 Bugfix. npm install converse.js failed
because @converse-headless wasn't available
2019-05-10 15:26:50 +02:00
JC Brand
587dddd81d Update to latest version of Strophe
which logs less on the INFO loglevel
2019-05-10 13:26:30 +02:00
JC Brand
0e7d64818d Add NPM scripts so that we can build dist files 2019-05-10 12:57:30 +02:00
JC Brand
145ee88213 Start handling error presences in MUC model 2019-05-09 12:18:36 +02:00
JC Brand
c520a4e39b Trim nickname 2019-05-08 21:37:47 +02:00
JC Brand
77e58bff5f Test that MAM messages are fetched when a chatbox is opened
This is a precursor to also testing (and implementing) that a chat pages
through MAM results (see #1549)

Remove unused method.
2019-05-07 10:27:51 +02:00
JC Brand
2526d80464 Change api.disco.supports to resolve to a Boolean
Also add a new API method `api.disco.features.get` for the use-case
where you still want the feature object to be returned.
2019-05-07 10:27:25 +02:00
JC Brand
c3dac272f8 Replace moment with DayJS 2019-05-06 14:27:18 +02:00
JC Brand
9528276be2 Use native Date methods instead of moment
- Use native `getTime` method instead of moment's `valueOf`
- Use toISOString() instead of moment().format()
  This makes the code timezone independent since we're now globally using UTC.
2019-05-06 10:28:03 +02:00
laszlovl
565f7d9f74 Make sure the time attribute for MAM message is parsed through moment
Messages (received directly or via MAM) are stored in a backbone
collection that's kept sorted by the message's "time" attribute.
Various parts of the codebase rely on this behavior.

For regular messages, the time attribute is generated by
`moment().format()`, which generates a timestamp in the browser's
local timezone, for example "...+02:00".

For MAM messages, we would previously copy the "delay.stamp" value
into the "time" attribute verbatim. However, that value is generated
by the server and is unlikely to be in the same timezone locale.

ISO timestamps expressed in different timezones cannot be sorted
lexicographically, breaking the premise of keeping the messages
collection sorted by time.
2019-05-05 15:44:20 +02:00
JC Brand
15b2273631 _converse.api.archive.query now returns a Promise
instead of accepting a callback functions.
2019-05-03 19:47:49 +02:00
JC Brand
8bb852b139 Updates #1554
Room auto-configuration broke if the config form contained fields with type `fixed`
2019-05-03 18:04:03 +02:00
JC Brand
346baa686f Refactor room auto-configuration 2019-05-03 18:01:07 +02:00
JC Brand
273b9584c0 Refactor onMessage to use const instead of let 2019-05-03 14:12:26 +02:00
JC Brand
52ea8d5ab6 Fixes #1550
Legitimate carbons messages blocked due to erroneous forgery check
2019-05-03 14:11:29 +02:00
supun19
eec51f9d62 Doc rooms api (#1551)
* Rooms Api
number of parameters in the documentation was made 2 from 3 as api which is used to open a room with default configuration has only 2 parameters.
2019-05-03 11:38:05 +02:00
JC Brand
9c4f8aef23 Bugfix. Call _converse.reconnect regardless
it is debounced and otherwise we might enter a state where reconnection
no longer happens.
2019-05-02 16:50:58 +02:00
JC Brand
d868b9a9f7 Continuously retry to fetch login credentials 2019-05-02 14:53:42 +02:00
JC Brand
3290d6659f Bugfix. validation message should be set on the model 2019-05-02 14:53:07 +02:00
JC Brand
969f902d4a Playing around with removing more lodash calls 2019-04-29 09:47:46 +02:00
JC Brand
ba6de8844e Use Object.keys instead of _.keys 2019-04-29 09:29:40 +02:00
JC Brand
34469425d6 Use Object.assign instead of _.extend 2019-04-29 09:07:15 +02:00
JC Brand
51d0dc8d23 No such method disconnect 2019-04-27 18:09:59 +02:00
JC Brand
b9e5658112 Message deduplication bugfixes and improvements.
- Add a new method to check for dupes based on the message text.
- When checking for dupes based on origin_id, no need to restrict to
  only our own.
2019-04-27 18:09:58 +02:00
JC Brand
dedede56f8 Rename muc_disable_moderator_commands to muc_disable_slash_commands
Since those commands aren't only about moderation
2019-04-25 11:32:07 +02:00
JC Brand
c72dc74022 In the menu, only show allowed commands 2019-04-25 10:48:33 +02:00
JC Brand
3bd9e09fd7 Don't wipe the nickname value when rerendering the form
Ideally Snabbdom wouldn't completely replace the input when we add the
`error` class, because that's what's causing the input value to be
cleared.
2019-04-25 08:35:44 +02:00
JC Brand
3ad93b56b3 Clicking the wrench icon again closes the config form 2019-04-24 14:51:12 +02:00
JC Brand
d311e14013 Render MUC forms with Backbone.VDOMView
That way we don't lose the user's input values, we avoid flashing and we
avoid unnecessary rendering.

In the process, fixed an annoying issue where Chrome auto-completes
what it thinks is the username into the "Language Tag" field of the MUC
config form.

Instead we tell Chrome that the MUC JID is the username, thereby also
letting it save the password to to that JID.
2019-04-24 14:51:12 +02:00
JC Brand
66adf03557 Bugfix. Order of operations. 2019-04-24 10:05:18 +02:00
JC Brand
e189acc8c9 Returning nick with credentials_url complicates things too much 2019-04-23 14:53:48 +02:00
JC Brand
741be5cc04 converse-muc: Handle VCards not being available 2019-04-23 12:32:59 +02:00
JC Brand
624cf4f435 Allow nickname to be provided by the credentials_url 2019-04-23 12:06:40 +02:00
JC Brand
cf75946e7b Make fetchLoginCredentials a function 2019-04-23 10:50:48 +02:00
JC Brand
e9e17cb293 Fixes #1543 2019-04-23 10:47:17 +02:00
JC Brand
5ead9796cc Set the JID in the session 2019-04-22 14:44:40 +02:00
JC Brand
25a0a898f2 Don't restore a BOSH session without knowing the JID 2019-04-22 14:33:49 +02:00
JC Brand
f8fcdc7eb8 Explicitly log out after each test. 2019-04-22 14:04:21 +02:00
JC Brand
cf32119c53 Make browserStorage key more readable 2019-04-19 11:18:34 +02:00
JC Brand
0288ef437e Fixes #1542 2019-04-19 10:55:06 +02:00
JC Brand
1251f395b1 Use webpack to generate css/converse.css 2019-04-18 17:50:05 +02:00
JC Brand
e1392895b0 Fix: when closing a modal the overlay doesn't get removed
Looks like the `webkitTransitionEnd` event doesn't fire because `fade`
is already on the modal, so there's no transition, which means that in
bootstrap.native the event doesn't get fired to remove the overlay.
2019-04-18 16:14:51 +02:00
JC Brand
8bc3aaa224 Upgrade to Webpack 4.28.1 2019-04-18 16:14:51 +02:00
JC Brand
725a382e3b Refactor initialization and defaults for chat boxes
- Let box_id start with char for valid HTML.
- No need to use SHA1 for box id
- No need for the user_id attribute.
- Set nickname when we set the roster contact.

Also...

- _converse.api.contacts.get is now async
- _converse.api.chats.create is now async
2019-04-18 16:14:51 +02:00
JC Brand
d2166ce3dd Remove deprecated API methods
since the next release will be a major one.
2019-04-16 16:57:55 +02:00
JC Brand
ee78ec1333 Add force parameter to _converse.chats.open
This changes the API method's current behavior by not automatically
maximizing (in `overlayed` view mode) or bringing a background chat into
foreground (in `fullscreen` view mode). Instead `force` needs to be set
to `true` for that to happen.
2019-04-16 16:42:15 +02:00
JC Brand
3c988240d1 Don't check for debug mode too early
Otherwise we can't enable it during operation
2019-04-16 13:59:04 +02:00
JC Brand
4eb6df92c6 Bugfix. Controlbox closed state not remembered
in overlay view mode.

Also refactored a bit to put the method, which determines whether a
chatbox may be shown, on the chatbox itself.
2019-04-16 13:38:46 +02:00
JC Brand
1dd2c4ce7b Reconnect if we can't send a message due to dropped connection 2019-04-16 13:01:47 +02:00
JC Brand
1328168d1e Fixes #1532 Converse reloads on enter pressed in the filter box 2019-04-11 23:44:16 +02:00
JC Brand
06f53e7f18 Add some padding to form error message 2019-04-11 23:42:19 +02:00
JC Brand
b593b8deb6 Fixes #1533
Users can only be muted in moderated rooms
2019-04-11 23:10:57 +02:00
JC Brand
76a7c3fa9b Bugfix. Update to new function which has been renamed. 2019-04-11 20:08:53 +02:00
JC Brand
f84c201437 Hide the textarea when a user is muted in a groupchat 2019-04-11 01:40:16 +02:00
JC Brand
aa90ebd7f0 Bugfix. Don't delete JID or resource...
when an affiliation change presence is received.
2019-04-11 01:39:06 +02:00
JC Brand
234556793f Provide a more user-friendly error message to muted users 2019-04-10 22:03:00 +02:00
JC Brand
f1899d0977 Looser coupling with converse-vcard
To make it easier to remove it without breaking stuff.
2019-04-10 19:35:35 +02:00
JC Brand
36761f290e Don't show checkmark for /me messages 2019-04-10 19:34:31 +02:00
JC Brand
d3a80e804f Move converse-caps into the headless build 2019-04-10 19:22:11 +02:00
JC Brand
a75c118a2c Prioritize roster nickname as message and chatbox display name
Set reference to roster contact on the message and chatbox object and
listen for changes to the nickname.

Currently, because chat boxes are fetched and initialized before the
roster, messages and chats are repainted with the correct display name
only later, causing a "flash" effect.

Ideally we would only initialize the chat boxes after the roster
contacts have been fetched, but this is currently not easily possible
because we need the control box to render before everything else.
2019-04-09 17:20:41 +02:00
JC Brand
d450ab5868 For a message, get VCard based on bare jid of sender 2019-04-09 13:54:55 +02:00
JC Brand
87337eaeef Bugfix. Modal auto-closes when you open it a second time 2019-04-08 21:45:09 +02:00
JC Brand
5532a9ec63 Remove jquery from tests 2019-04-08 21:45:09 +02:00
JC Brand
487114568a OAuth is not a core plugin 2019-04-05 14:04:50 +02:00
JC Brand
eb67f10371 Handle case where there isn't a MUC close button 2019-04-05 14:04:00 +02:00
JC Brand
e987214555 For roomspanel, don't set muc_domain if its locked 2019-04-05 13:14:57 +02:00