Commit Graph

238 Commits

Author SHA1 Message Date
JC Brand
38d1e4e3d2 Bugfix. Sometimes when trimming chats, minimized chats go off screen 2019-07-12 12:50:20 +02:00
JC Brand
2849adf857 Stop debouncing show
Instead optimize in other ways.

Also:
- Don't fade in when `animate` is false.
- `trimChats` now gets called in `afterShown`.
- Add now event `beforeShowingChatView`
2019-07-12 12:42:41 +02:00
JC Brand
a1630b5c1f Replace wait-until-promise with utility method
and bump default timeout

Also let `_converse.api.waitUntil` use it if a function is passed in.
2019-07-11 23:34:27 +02:00
JC Brand
8a98ef87fe Various small fixes. (Unused imports, unused vars etc). 2019-07-11 12:37:17 +02:00
JC Brand
ded9945ed9 MUC: Don't send XEP-0085 CSNs when we don't have voice
Includes some refactoring:

- Don't send an `active` chat state notification when entering a MUC
  I can't think of a good reason why this might be necessary or desired.
- Move `setChatState` form the view to the model
- Remove unused method `handleChatStateNotification`
- Don't store `role` and `affiliation` for the current user on the
  ChatRoom object, but instead on the ChatRoomOccupant object representing
  the user.
2019-07-10 14:24:00 +02:00
JC Brand
98215deb21 Update to latest backbone.overview which debounces sorting on add event 2019-06-27 13:15:55 +02:00
JC Brand
824b2c81b4 converse-minimize: Rename view methods to clarify
that they are in response to a change and not meant as an API.
2019-06-26 16:52:51 +02:00
JC Brand
36549bf61d Revert flexbox, column-reverse changes
Unfortunately this doesn't work on Firefox and there's no proper
workaround. https://github.com/philipwalton/flexbugs/issues/108

Reverts:

Revert "Bugfix. Properly insert error messages and spinner"
This reverts commit 6a419cc145.

Revert "Use flexbox to keep the chat scrolled down"
This reverts commit dd91d3cc55.
2019-06-19 11:45:54 +02:00
JC Brand
dd91d3cc55 Use flexbox to keep the chat scrolled down
By using `display: flex` and `flex-direction: column-reverse`, the chat
now automatically scrolls down when loaded, without requiring any
extra JavaScript.

We still need to scroll down with JavaScript when sending a message.

By using `column-reverse`, the messages container now works in reverse.
So the newest message is the first element in the container and the
oldest message is the last. This is the reverse of before.

Due to this, this change will likely break some plugins.
2019-06-18 11:37:07 +02:00
JC Brand
38d0d8360b New config setting message_limit
for limiting messages to a certain number of characters.
2019-06-16 21:52:56 +02:00
JC Brand
737e27c726 Use shakespearean character names in tests 2019-06-03 09:43:24 +02:00
JC Brand
e1762a1bb5 Rename key event handler methods to avoid confusion 2019-05-26 11:09:43 +02:00
JC Brand
94bea16cc4 Remove chatBoxOpened event 2019-05-16 11:54:42 +02:00
JC Brand
86f3399dc0 Also trigger 'chatboxFocused' when user manually focuses 2019-05-14 16:24:16 +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
f897703565 Rename emit to trigger for consistency with Backbone.Events 2019-03-29 21:56:56 +01:00
JC Brand
d7db4df468 Remove jquery from spec/chatbox.js 2019-03-26 11:06:33 +01:00
Emmanuel Gil Peyrot
3aa9ee1ba0 Replace http: with https: in xmpp.org links 2019-03-04 17:49:44 +01:00
JC Brand
59c43a23f0 Two changes, see below
* Add new test helper to create contacts via IQ exchange
* Use roster nickname to set message fullname
2019-02-24 20:27:41 +01:00
JC Brand
3fe6efc2cf Fix failing tests 2019-02-13 15:25:23 +01:00
JC Brand
9f5031c278 Make converse.initialize an async function
- Combine all test init functions into `initConverse`
- Use `async` functions in more tests
- Replace `var` with `let` and `const` in more tests
- New utils method `toStanza` which converts a string to a Node
2019-02-12 15:34:50 +01:00
JC Brand
e1f8d53c46 Initial support for chat markers. Updates #324 2019-02-01 15:05:13 +01:00
JC Brand
3c0e3d3fab Refactor out createMessage.
Changes:

* Avoids leaky abstraction of MUC code into converse-chatboxes
* Avoid creating unnecessary message objects (e.g. without <body)
* Add fix for #1369.
* Rename spec/chatroom.js to spec/muc.js
2019-01-28 13:27:25 +01:00
JC Brand
dc07440de8 Bugfix. Don't create chats for messages without body 2019-01-10 21:47:50 +01:00
JC Brand
d051085626 Only clear textarea once message was sent
This now requires `sendMessage` to return a boolean to indicate success.
Disable the textarea while message is being sent.
2018-12-21 05:58:22 +01:00
JC Brand
d5485d09ae Always render the OMEMO lock icon
When OMEMO isn't possible, render it as grey.

This change makes OMEMO for MUCs easier, since there I anticipate that
OMEMO support might change dynamically based on who enters/exits the
room.

updates #1180
2018-12-14 11:25:57 +01:00
JC Brand
2857293ad1 Fix failing tests by waiting and slightly improve code 2018-12-06 13:10:34 +01:00
JC Brand
cb3ba7bdf6 Use async/await in spec/chatbox.js 2018-11-22 09:31:00 +01:00
Emmanuel Gil Peyrot
87c77385d8 Improve XEP-0245 support.
Namely:
- Only match messages which start with exactly "/me ".
- Simplify the match, checking a string instead of a complex regex.
- Always remove the first four characters in the case of a match, to not
leave an extra leading space.
2018-11-05 14:02:14 +01:00
JC Brand
9a4bceba60 Add make recipes for zip files of webfonts and locales 2018-10-29 22:11:01 +01:00
JC Brand
53b3f2d0d6 Fix failing tests and rewrite to use async/await 2018-10-26 12:53:24 +02:00
JC Brand
6ebf6f6ecc Fix failing test by making sure notifications are cleared 2018-10-25 08:21:38 +02:00
JC Brand
e181aaf99b Make the message view's render method async
So that we first render dynamic content (e.g. images) before inserting
it into the chat.

Also, add the `show_images_inline` setting (which is the cause of this
whole change).

Updated tests to handle this new change and start using async/await
instead of promise callbacks.
2018-10-15 22:19:04 +02:00
JC Brand
9e240c5647 Increase timeouts to try and avoid timing issues on Travis 2018-08-25 00:43:05 +02:00
JC Brand
fa0e7aeff5 Updated so that own device is properly created and published
Based on live testing. Updated tests accordingly.
2018-08-22 18:16:36 +02:00
JC Brand
ca9229a906 createMessage now returns a promise.
Also, fix all broken tests, mostly related to this.
2018-08-18 17:12:22 +02:00
JC Brand
33cd23c529 Minor idiomatic changes 2018-08-16 15:17:53 +02:00
JC Brand
2d05487862 More code reuse between chatboxview and chatroomview 2018-08-07 15:32:13 +02:00
JC Brand
890dbca8b8 Fix tests failing on Travis 2018-08-02 08:30:37 +02:00
JC Brand
506aa33131 Wait for promises before opening chats in API methods 2018-08-01 11:12:00 +02:00
JC Brand
1443fdd447 (WIP) Wait for promises before opening chats in API methods 2018-08-01 11:10:43 +02:00
JC Brand
acd9a18696 Update with new message markup 2018-07-21 07:34:03 +02:00
JC Brand
2929647e16 Add support for correcting the last message sent
fixes #421
2018-07-08 00:39:28 +02:00
JC Brand
083f191ead Consider delayed, non-archived messages as "new"
New in the sense that we haven't seen them before
2018-06-07 13:06:32 +02:00
JC Brand
bc872ee2cb Fix various failing tests and update Makefile 2018-06-04 11:20:34 +02:00
JC Brand
596082eecc Get tests to run agains the webpack build 2018-06-03 16:40:20 +02:00
JC Brand
c920725832 Add a clearSession event to avoid using overrides. 2018-05-18 15:44:42 +02:00
JC Brand
270c9b7c0e Bump timeouts in a desperate attempt to appease the CI gods 2018-05-09 15:42:57 +02:00
JC Brand
8bd968a03b Also use the VCard cache for the user's own status 2018-05-08 19:24:50 +02:00
JC Brand
b8679063c5 Use the VCards collection for roster contacts
Instead of saving the vcard data on the contact model itself
2018-05-05 20:51:14 +02:00