Commit Graph

105 Commits

Author SHA1 Message Date
JC Brand
1a3526f537 Update openAndEnterChatRoom to take JID 2019-07-04 08:28:12 +02:00
JC Brand
67bcc00f10 Associate ChatRoomOccupant to ChatRoomMessage
and use promises to indicate when an occupant or contact has been set
2019-07-04 08:28:12 +02:00
JC Brand
9430627180 Re-group some message specs 2019-06-26 11:09:07 +02:00
JC Brand
2cbc4aaa50 Fixes #1494. Trim whitespace around messages 2019-06-26 10:59:56 +02:00
JC Brand
681c3a2c12 Corrections bugfix. Don't save new id on message model
otherwise a new cache entry gets created, causing multiple messages to
be restored from cache later on.
2019-06-25 12:06:47 +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
9750dcf3a8 Fixes #1142. Show confirmation dialog for editing messages
when the textarea contains an unsent message
2019-06-19 08:43:42 +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
eeab6e4fca Fix failing test 2019-06-13 17:12:37 +02:00
JC Brand
bbe2a62295 converse-muc: Create info and error messages on the model
instead of on the view.
2019-06-12 06:27:07 +02:00
JC Brand
1d9bbb8ddd Message display improvements
* Checkmark and edit modal button are now on the right
* Instead of showing checkmarks for MUC messages,
  we now show them as light grey before MUC reflection
* Simplify message markup by requiring less `if` statements
2019-06-04 11:12:22 +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
463bc02dd5 Cheat to get two failing test to pass on Travis
Since recently these tests have been failing consistently on Travis,
even though they're passing locally.

Ran out of time debugging the issue, so disabling some stuff for now.
2019-05-24 09:06:24 +02:00
JC Brand
271c79eae8 Refactor message corrections
- Save date for older message versions and display it in the modal
- Properly handle the correction being received *before* the corrected message
2019-05-22 13:26:46 +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
7950f7c2ac Change muc_show_disconnection_status to muc_show_join_leave_status 2019-05-18 06:34:29 +02:00
JC Brand
94bea16cc4 Remove chatBoxOpened event 2019-05-16 11:54:42 +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
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
JC Brand
52ea8d5ab6 Fixes #1550
Legitimate carbons messages blocked due to erroneous forgery check
2019-05-03 14:11:29 +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
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
f84c201437 Hide the textarea when a user is muted in a groupchat 2019-04-11 01:40:16 +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
f897703565 Rename emit to trigger for consistency with Backbone.Events 2019-03-29 21:56:56 +01:00
JC Brand
fb89148b08 Add tests for tricky URLs 2019-03-27 11:39:52 +01:00
JC Brand
03f9eb95da Fixes #1467. Fix rendering of URLs enclosed with sharp brackets
such as <https://example.org>
2019-03-27 11:24:55 +01:00
JC Brand
cbc343115e Remove jquery from spec/messages.js 2019-03-27 09:47:59 +01:00
JC Brand
27557d6a04 Document _converse.ChatBox.prototype.sendMessage as an API method
Until now, we've only been explicitly documenting the `_converse.api`
namespace and only considered the methods under it as forming the API
contract (which determines how we do semver releases).

It appears as if we've reached a point where trying to keep everything
under the `_converse.api` namespace no longer makes sense. Certain
methods are applicable to particular models and trying to shoehorn them
into the `_converse.api` namespace seems clunky and non-intuitive.

I've therefore decided to slightly refactor `sendMessage` to let it take
two simple parameters and to document it with JSDoc so that it's
presented as an API method, albeit only available on a chat model.

updates #1496
updates #1504
2019-03-21 21:03:02 +01:00
Axel Viala
b51d98d6d1 Fix #1327: Refusing url and email as mentions
Before the function `extractReference` in
`/src/headless/converse-muc.js` matched url and email.

Fix: https://github.com/conversejs/converse.js/issues/1327
2019-03-07 16:53:27 +01:00
JC Brand
33600eeece No need for a separate archive_id value.
With MAM2 we can just use stanza-id
2019-03-07 16:45:00 +01:00
JC Brand
49da581d14 Fixes #1400. When chat message is only an emoji, enlarge it 2019-02-27 10:34:47 +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
3e4f4e9436 Use the API in tests 2019-02-22 22:33:34 +01:00
JC Brand
d830bc1250 Also check for duplicates in one-on-one messages 2019-02-14 15:17:49 +01:00
JC Brand
7e34a462c1 Add support for handling multiple stanza-id elements 2019-02-14 12:13:07 +01:00
JC Brand
8d00294681 Use origin-id to check for reflected messages.
Also, store the returned `stanza-id` on the message.
2019-02-14 11:33:28 +01:00
JC Brand
6eb05be4be XEP-0359: Better usage of stanza-id to check for dupes 2019-02-13 22:14:58 +01:00
JC Brand
5b25d5daaa Don't send markers to someone not on your roster
Updates #324
2019-02-13 19:32:02 +01:00
JC Brand
3fe6efc2cf Fix failing tests 2019-02-13 15:25:23 +01:00
JC Brand
4a5603ab2e More specific selector for markers and another test
Updates #1442
2019-02-13 08:58:27 +01:00
JC Brand
dbcf6002ff Fixes #1442 2019-02-12 19:10:46 +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
abe21dce66 Include origin-id in outgoing messages 2019-02-08 15:34:16 -07:00
JC Brand
c023bd1d47 Fix test failures on Chrome 72 2019-02-01 21:37:29 +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