Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

- **RTM support for `user_status_changed`, `user_huddle_changed`, `user_profile_changed`
events** — these events are now mapped in `EventMapping` with dedicated structs
(`UserStatusChangedEvent`, `UserHuddleChangedEvent`, `UserProfileChangedEvent`).
Previously they triggered `UnmarshallingErrorEvent`. ([#1541])
- **`CacheTS` and `EventTS` fields on `UserChangeEvent`** — these fields were sent by Slack
but silently dropped during unmarshalling.
- **`workflows.featured` API support** — add, list, remove, and set featured workflows on
channels via `WorkflowsFeaturedAdd`, `WorkflowsFeaturedList`, `WorkflowsFeaturedRemove`,
and `WorkflowsFeaturedSet`
Expand Down Expand Up @@ -326,6 +332,7 @@ for details.
[#1533]: https://github.com/slack-go/slack/pull/1533
[#1534]: https://github.com/slack-go/slack/pull/1534
[#1536]: https://github.com/slack-go/slack/pull/1536
[#1541]: https://github.com/slack-go/slack/issues/1541

[Unreleased]: https://github.com/slack-go/slack/compare/v0.20.0...HEAD
[0.20.0]: https://github.com/slack-go/slack/compare/v0.19.0...v0.20.0
Expand Down
5 changes: 4 additions & 1 deletion websocket_managed_conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,10 @@ var EventMapping = map[string]interface{}{

"manual_presence_change": ManualPresenceChangeEvent{},

"user_change": UserChangeEvent{},
"user_change": UserChangeEvent{},
"user_status_changed": UserStatusChangedEvent{},
"user_huddle_changed": UserHuddleChangedEvent{},
"user_profile_changed": UserProfileChangedEvent{},

"emoji_changed": EmojiChangedEvent{},

Expand Down
2 changes: 1 addition & 1 deletion websocket_managed_conn_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ func TestRTMSingleConnect(t *testing.T) {
}

func TestRTMUnmappedError(t *testing.T) {
const unmappedEventName = "user_status_changed"
const unmappedEventName = "some_unknown_event"
// Set up the test server.
testServer := slacktest.NewTestServer()
go testServer.Start()
Expand Down
30 changes: 28 additions & 2 deletions websocket_misc.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,34 @@ type ManualPresenceChangeEvent struct {

// UserChangeEvent represents the user change event
type UserChangeEvent struct {
Type string `json:"type"`
User User `json:"user"`
Type string `json:"type"`
User User `json:"user"`
CacheTS int64 `json:"cache_ts"`
EventTS string `json:"event_ts"`
}

// UserStatusChangedEvent represents the user status changed event
type UserStatusChangedEvent struct {
Type string `json:"type"`
User User `json:"user"`
CacheTS int64 `json:"cache_ts"`
EventTS string `json:"event_ts"`
}

// UserHuddleChangedEvent represents the user huddle changed event
type UserHuddleChangedEvent struct {
Type string `json:"type"`
User User `json:"user"`
CacheTS int64 `json:"cache_ts"`
EventTS string `json:"event_ts"`
}

// UserProfileChangedEvent represents the user profile changed event
type UserProfileChangedEvent struct {
Type string `json:"type"`
User User `json:"user"`
CacheTS int64 `json:"cache_ts"`
EventTS string `json:"event_ts"`
}

// EmojiChangedEvent represents the emoji changed event
Expand Down
Loading