[IMPROVE] Allow e-mail channel to be used without default department.#23945
Merged
[IMPROVE] Allow e-mail channel to be used without default department.#23945
Conversation
murtaza98
previously requested changes
Dec 15, 2021
Contributor
murtaza98
left a comment
There was a problem hiding this comment.
@cauefcr I found an edge case with your implementation where if the email was first connected to a department, let's say sales, and then a room was closed within this department - Post this, the email was then unassigned from any department on Rocket.Chat, and if the same chat arrives back, ideally I think we shouldn't associate this new chat to the sales department since there is no department connected to the email - but in your implementation, it was still associating it to the Sales department.
Hopefully, this PR should fix this - #23950
Contributor
Author
|
Thanks for the PR! I didn't test this edge case. |
The requested changes were merged
murtaza98
approved these changes
Dec 15, 2021
Merged
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Proposed changes (including videos or screenshots)
Due to a missing condition in the e-mail input processing, Rocket.Chat was unable to receive e-mails from e-mail channels that did not have a default department.
Issue(s)
The following error is raised when an email message is sent to an email account without default department
W20211206-13:46:39.202(-3)? (STDERR) === UnHandledPromiseRejection ===
W20211206-13:46:39.204(-3)? (STDERR) errorClass [Error]: Provided department does not exists [invalid-department]
W20211206-13:46:39.204(-3)? (STDERR) at Object.setDepartmentForGuest (app/livechat/server/lib/Livechat.js:332:10)
W20211206-13:46:39.204(-3)? (STDERR) at getGuestByEmail (server/features/EmailInbox/EmailInbox_Incoming.ts:46:13)
W20211206-13:46:39.204(-3)? (STDERR) at server/features/EmailInbox/EmailInbox_Incoming.ts:134:16
W20211206-13:46:39.204(-3)? (STDERR) at /Users/renatobecker/.meteor/packages/promise/.0.11.2.q9g02k.d69vo++os+web.browser+web.browser.legacy+web.cordova/npm/node_modules/meteor-promise/fiber_pool.js:43:40 {
W20211206-13:46:39.204(-3)? (STDERR) isClientSafe: true,
W20211206-13:46:39.204(-3)? (STDERR) error: 'invalid-department',
W20211206-13:46:39.205(-3)? (STDERR) reason: 'Provided department does not exists',
W20211206-13:46:39.205(-3)? (STDERR) details: { method: 'setDepartmentForGuest' },
W20211206-13:46:39.205(-3)? (STDERR) errorType: 'Meteor.Error'
W20211206-13:46:39.205(-3)? (STDERR) }
W20211206-13:46:39.205(-3)? (STDERR) ---------------------------------
W20211206-13:46:39.205(-3)? (STDERR) Errors like this can cause oplog processing errors.
W20211206-13:46:39.205(-3)? (STDERR) Setting EXIT_UNHANDLEDPROMISEREJECTION will cause the process to exit allowing your service to automatically restart the process
W20211206-13:46:39.205(-3)? (STDERR) Future node.js versions will automatically exit the process
W20211206-13:46:39.205(-3)? (STDERR) =================================
Steps to test or reproduce
By creating an e-mail channel and not giving it a default department the above error would occur, dropping e-mail messages from Rocket.Chat, with only a console log for an error.
Further comments