Skip to content

Commit

Permalink
Add comment for patching
Browse files Browse the repository at this point in the history
  • Loading branch information
compulim committed Jan 12, 2019
1 parent 94a8026 commit 535d675
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/core/src/sagas/incomingActivitySaga.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ function* observeActivity(directLine, userID) {
}

function patchActivityWithFromRole(activity, userID) {
// Some activities, such as "ConversationUpdate", does not have "from" defined.
// And although "role" is defined in Direct Line spec, it was not sent over the wire.
// We normalize the activity here to simplify null-check and logic later.

// Patch activity.from.role to make sure its either "bot", "user", or "channel"
if (!activity.from) {
activity = updateIn(activity, ['from', 'role'], () => 'channel');
Expand Down

0 comments on commit 535d675

Please sign in to comment.