Skip to content

Commit

Permalink
enhance(gchat)!: assign email to unique field (#494)
Browse files Browse the repository at this point in the history
BREAKING CHANGE

for google chat only. if you depend on _user.id returning email, be aware that this change would
require you to use _user.email instead. _user.id will continue to hold the user name.
  • Loading branch information
wass3r authored Nov 21, 2023
1 parent 45127e0 commit 2f82cec
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions remote/gchat/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,12 @@ func toMessage(m *pubsub.Message) (models.Message, error) {
if event.User != nil {
message.Vars["_user.name"] = event.User.DisplayName
message.Vars["_user.id"] = event.User.Name
message.Vars["_user.internal_id"] = event.User.Name
message.Vars["_user.displayname"] = event.User.DisplayName

// Try parsing as a domain message to get user email
var domainEvent DomainEvent
if err := json.Unmarshal(m.Data, &domainEvent); err == nil {
message.Vars["_user.id"] = domainEvent.User.Email
message.Vars["_user.email"] = domainEvent.User.Email
}
}

Expand Down

0 comments on commit 2f82cec

Please sign in to comment.