New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed typing status for typing from different device #802
Conversation
Also, @jcbrand, I was unsure of the particular the UI will be modified, so just kept the messages I felt would be suitable into the fix. Do review it and suggest improvements. |
I didn't notice that you worked on the same ticket as @saganshul I already merged his pull request. However, I like the change you made to show a different status message. Can you please rebase your commits onto master, check whether the tests pass and then push again? |
okay, sure @jcbrand |
@jcbrand I've rebased the commits on master... |
No, something went wrong. If you look at the commits, there are now many more commits and two commits for This is not how it's supposed to look after rebasing. Instead after rebasing there should just be your one commit to be merged into master. |
Yes, I also think something went wrong somewhere. Basically, my typing-status branch was outdated, and upstream/master was ahead by several commits because I haven't worked on this branch after making the PR. So, with my updated master, and while being in typing-status branch, I did Where did this go wrong? |
The oldest commit in this PR is a merge you made. I think that's the problem. I suspect because of your merge your master was different and so you rebased onto a changed master. There are a few ways to fix this. I think easiest to explain is to do:
And then Make sure to back up your work before you do this. |
src/converse-chatview.js
Outdated
this.showStatusNotification(message.get('fullname')+' '+__('is typing')); | ||
if(message.get('sender') === 'me') { | ||
this.showStatusNotification('Typing from another device'); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
User-facing strings should be wrapped in __( )
so that they will get translated.
src/converse-chatview.js
Outdated
@@ -532,7 +542,7 @@ | |||
* See XEP-0085 Chat State Notifications. | |||
*/ | |||
_converse.connection.send( | |||
$msg({'to':this.model.get('jid'), 'type': 'chat'}) | |||
$msg({'to':this.model.get('jid'), 'type': 'chat', 'from': _converse.connection.jid}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this 'from' attribute is necessary because it gets added automatically by strophe.js AFAICR. You can remove it. Unless you have a clear reason why it's needed.
@jcbrand This one is still lying unreviewed. If the changes are ok, I'll move on to writing tests and updating changelogs. |
@smitbose yes please |
@jcbrand I was wondering what kind of test sould I write for this one. Basically, the way I'm testing this is openning up chatbox for the same receiver from two different resources and then trying to type something, and checking the typing status rendered. How can I simulate the same behaviour in a spec. Can you help me out here? |
Open a chat box with a contact. Then receive a |
@smitbose You can copy/paste this test and modify it to send a |
ok, right, thanks. |
Add another line referencing the same issue. |
@jcbrand PR updated with final modifications, specs and changelog edits. Please review. |
docs/CHANGES.md
Outdated
@@ -3,6 +3,7 @@ | |||
## 3.0.1 (Unreleased) | |||
|
|||
- #585 Duplicate contact created due to JID case sensivity [saganshul] | |||
- #628 Fixes typing status for typing from different devices. [smitbose] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not descriptive of what was done. It's not a bugfix, you simply changed the message that gets displayed. Also please put it after saganshul's message.
@smitbose Almost done! A few small changes, then I'll merge. |
@jcbrand I don't see any reviews asking for changes. I did the previous changes asked. Can you specify the small changes required? |
spec/chatbox.js
Outdated
it("can be a composing carbon message that this user sent from a different client, as defined in XEP-0280", mock.initConverse(function (_converse) { | ||
test_utils.createContacts(_converse, 'current'); | ||
test_utils.openControlBox(); | ||
test_utils.openContactsPanel(_converse); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lines 1399 and 1400 are not needed AFAIK.
spec/chatbox.js
Outdated
var chatbox = _converse.chatboxes.get(recipient_jid); | ||
var chatboxview = _converse.chatboxviews.get(recipient_jid); | ||
expect(chatbox).toBeDefined(); | ||
expect(chatboxview).toBeDefined(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The above two checks aren't necessary within this test.
spec/chatbox.js
Outdated
@@ -1393,6 +1393,47 @@ | |||
var $events = chatboxview.$el.find('.chat-event'); | |||
expect($events.text()).toEqual(mock.cur_names[1] + ' is typing'); | |||
})); | |||
|
|||
it("can be a composing carbon message that this user sent from a different client, as defined in XEP-0280", mock.initConverse(function (_converse) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove the , as defined in XEP-0280
part
spec/chatbox.js
Outdated
@@ -1477,6 +1518,47 @@ | |||
var $events = chatboxview.$el.find('.chat-event'); | |||
expect($events.text()).toEqual(mock.cur_names[1] + ' has stopped typing'); | |||
})); | |||
|
|||
it("can be a paused carbon message that this user sent from a different client, as defined in XEP-0280", mock.initConverse(function (_converse) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove the , as defined in XEP-0280
part
spec/chatbox.js
Outdated
it("can be a paused carbon message that this user sent from a different client, as defined in XEP-0280", mock.initConverse(function (_converse) { | ||
test_utils.createContacts(_converse, 'current'); | ||
test_utils.openControlBox(); | ||
test_utils.openContactsPanel(_converse); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lines 1524 and 1525 aren't needed AFAIK.
spec/chatbox.js
Outdated
var chatbox = _converse.chatboxes.get(recipient_jid); | ||
var chatboxview = _converse.chatboxviews.get(recipient_jid); | ||
expect(chatbox).toBeDefined(); | ||
expect(chatboxview).toBeDefined(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unnecessary checks in the context of this test.
Sorry, I forgot to submit my review. |
@jcbrand made final changes. Please check... |
Looks good, thanks! |
This fixes the bug #628 .
While writing from another device, logged in with the same JID, the current code shows a different user is typing. This commit fixes that to show status message "Typing from another device" and "Stopped typing on the other device" in those cases.
It however leaves the previous behaviour unchanged in case of other users.