Skip to content

Commit

Permalink
Merge pull request #18 from x-qdo/bugfix/multi_assignee
Browse files Browse the repository at this point in the history
add list of assignees to task model
  • Loading branch information
astreter committed Apr 2, 2021
2 parents 9189a8c + 36added commit e295b70
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
10 changes: 3 additions & 7 deletions pkg/handler/clickup.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ func (h *clickUpWebhooks) doAction(event *clickup.WebhookEvent, tenant string) e
return errors.Wrap(err, "ClickUp webhook: slackChannel is not defined")
}

changes = generateTaskChangesByEvent(event)
changes = generateTaskChangesByEvent(event, task)
err = h.publisher.ClickUpTaskUpdated(changes, slackChannel)
if err != nil {
return errors.Wrap(err, "ClickUp webhook: can't trigger changes event")
Expand All @@ -110,7 +110,7 @@ func (h *clickUpWebhooks) doAction(event *clickup.WebhookEvent, tenant string) e
return nil
}

func generateTaskChangesByEvent(event *clickup.WebhookEvent) model.TaskChanges {
func generateTaskChangesByEvent(event *clickup.WebhookEvent, task *clickup.Task) model.TaskChanges {
changes := model.TaskChanges{
Type: string(event.Type),
ClickupID: event.TaskID,
Expand All @@ -129,11 +129,7 @@ func generateTaskChangesByEvent(event *clickup.WebhookEvent) model.TaskChanges {
value = after["priority"]
}
case clickup.TaskAssigneeUpdated:
if after, ok := historyItem.After.(map[string]interface{}); ok {
value = after["username"]
} else {
value = nil
}
value = task.Assignees
}
changes.AddChange(historyItem.Field, value)
changes.Username = historyItem.User.Username
Expand Down
1 change: 1 addition & 0 deletions pkg/provider/clickup/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ type Task struct {
Archived bool `json:"archived"`
TeamID string `json:"team_id"`
CustomFields []CustomField `json:"custom_fields,omitempty"`
Assignees []User `json:"assignees"`

List struct {
ID string `json:"id"`
Expand Down

0 comments on commit e295b70

Please sign in to comment.