-
Notifications
You must be signed in to change notification settings - Fork 11.4k
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
[FIX] LiveChat switch department not working #11011
Merged
sampaiodiego
merged 19 commits into
develop
from
fix-changing-livechat-visitor-department
Aug 21, 2018
Merged
Changes from 9 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
6dc4bc5
When a livechat visitor attempted to change the current department, t…
renatobecker 0ee4d79
Merge branch 'develop' into fix-changing-livechat-visitor-department
renatobecker 4c980c7
Merge branch 'develop' into fix-changing-livechat-visitor-department
renatobecker b4deb6e
Fixed the behaviour of the LiveChat department change.
renatobecker cdc7a4d
Merge branch 'develop' into fix-changing-livechat-visitor-department
ggazzo 38872a0
Merge branch 'develop' into fix-changing-livechat-visitor-department
renatobecker cf34fb9
Merge branch 'fix-changing-livechat-visitor-department' of github.com…
renatobecker 08e2df1
Invalid comments removed.
renatobecker f03652e
Merge branch 'develop' into fix-changing-livechat-visitor-department
renatobecker aee97ea
Merge branch 'develop' into fix-changing-livechat-visitor-department
renatobecker d6c795a
Fixed `RocketChat.Livechat.stream.emit` that was not being emitted.
renatobecker 247db3e
Merge branch 'develop' into fix-changing-livechat-visitor-department
renatobecker 19205b6
Merged `develop` into current branch.
renatobecker 8592c7e
Merge branch 'develop' into fix-changing-livechat-visitor-department
renatobecker 92f75c1
Fix eslint new rules.
renatobecker 3353332
Fix eslint new rules.
renatobecker 583317d
Fix eslint new really rules.
renatobecker 9a98faa
Fix eslint new rules.
renatobecker 3b5c72f
Merge branch 'develop' into fix-changing-livechat-visitor-department
sampaiodiego File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
this.showError = msg => { | ||
$('.error').addClass('show').find('span').html(msg); | ||
}; | ||
|
||
this.hideError = () => { | ||
$('.error').removeClass('show'); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 20 additions & 7 deletions
27
packages/rocketchat-livechat/server/methods/setDepartmentForVisitor.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,26 @@ | ||
import LivechatVisitors from '../models/LivechatVisitors'; | ||
|
||
Meteor.methods({ | ||
'livechat:setDepartmentForVisitor'({ token, department } = {}) { | ||
RocketChat.Livechat.setDepartmentForGuest.call(this, { | ||
token, | ||
department | ||
}); | ||
'livechat:setDepartmentForVisitor'({ roomId, visitorToken, departmentId } = {}) { | ||
check(roomId, String); | ||
check(visitorToken, String); | ||
check(departmentId, String); | ||
|
||
const room = RocketChat.models.Rooms.findOneById(roomId); | ||
const visitor = LivechatVisitors.getVisitorByToken(visitorToken); | ||
|
||
if (!room || room.t !== 'l' || !room.v || room.v.token !== visitor.token) { | ||
throw new Meteor.Error('error-invalid-room', 'Invalid room'); | ||
} | ||
|
||
// update visited page history to not expire | ||
RocketChat.models.Messages.keepHistoryForToken(token); | ||
RocketChat.models.Messages.keepHistoryForToken(visitorToken); | ||
|
||
const transferData = { | ||
roomId, | ||
departmentId | ||
}; | ||
|
||
return true; | ||
return RocketChat.Livechat.transfer(room, visitor, transferData); | ||
} | ||
}); |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 think we updated the sweetalert and now its promise based, we should change to