Skip to content

Comments

Added Feature to handle reaction add & get message text of a reaction #28

Draft
songupta7 wants to merge 5 commits intoExpediaGroup:masterfrom
songupta7:list-reactions-msg-txt
Draft

Added Feature to handle reaction add & get message text of a reaction #28
songupta7 wants to merge 5 commits intoExpediaGroup:masterfrom
songupta7:list-reactions-msg-txt

Conversation

@songupta7
Copy link
Contributor

@songupta7 songupta7 commented Feb 23, 2022

What has been changed?

  1. Added the ReactionAdded Event in the flyte slack pack
  2. Added GetReactionMessageInfo Command from the flyte

Please see the documentation for understanding the usage of these features.

@songupta7 songupta7 requested a review from a team as a code owner February 23, 2022 15:00
Comment on lines +84 to +92
```
{ "count": 50 , //default value is 100 mandatory
"message": "" ,
"threadTimestamp":"...",
"reactionUser":"...", // mandatory list of reactions for a user
"channelId": "...",
"threadTimestamp":"..."
}
```
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tabs/spaces seem to be off on this one. can you align to left with just one tab pelase?

"threadTimestamp":"...",
"reactionUser":"...", // mandatory list of reactions for a user
"channelId": "...",
"threadTimestamp":"..."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

threadTimestamp is mentioned twice 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this is typo I would rectify this.

This command would retrieve the message text of reaction sent by a user.

```
{ "count": 50 , //default value is 100 mandatory
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure yet what this is doing. What count means?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The count of reactions in list sorted via timestamp. Hope this clarifies.

```


### GetReactionMessageInfo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trying to understand use case for this one and what it actually does 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

problem with the previous implementation: JSON standard does not allow such tokens.
To fix this, I have removed the ... token.

Trying to understand use case for this one and what it actually does 🤔

}
func (m *MockClient) ListReactions(params slack.ListReactionsParameters) ([]slack.ReactedItem, *slack.Paging, error) {
params = params
//TODO mock the list reactions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No TODOs please. Please add tests for new functionality.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this is still hasn't been dealt with

Copy link
Contributor

@pamelin pamelin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add relevant tests in the slack_test.go

}

### ReactionAdded
{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to be wrong according to

type reactionAddedEvent struct {
	ReactionUser   user   `json:"user"`
	ReactionName   string `json:"reaction"`
	EventTimestamp string `json:"eventTimestamp"`
	ItemType       string `json:"type"`
	ItemTimestamp  string `json:"itemTimestamp"`
	ItemUser       user   `json:"itemUser"`
	ChannelId      string `json:"channelId"`
}

There is no such thing as item and users are not simple string but objects/structs in itself

Copy link
Contributor Author

@songupta7 songupta7 Apr 5, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is some reason, which go slack module version are you referring to? I am referring to slack@v0.9.1>websocket_reactions.go contains below definition. Can you please cross check again?

// reactionItem is a lighter-weight item than is returned by the reactions list. type reactionItem struct { Type stringjson:"type"Channel stringjson:"channel,omitempty"File stringjson:"file,omitempty"FileComment stringjson:"file_comment,omitempty"Timestamp stringjson:"ts,omitempty"`
}

type reactionEvent struct {
Type string json:"type"
User string json:"user"
ItemUser string json:"item_user"
Item reactionItem json:"item"
Reaction string json:"reaction"
EventTimestamp string json:"event_ts"
}

// ReactionAddedEvent represents the Reaction added event
type ReactionAddedEvent reactionEvent

// ReactionRemovedEvent represents the Reaction removed event
type ReactionRemovedEvent reactionEvent
`

songupta7 and others added 2 commits April 20, 2022 12:38
Co-authored-by: pamelin <pamelin@hotels.com>
Co-authored-by: pamelin <pamelin@hotels.com>
@pamelin
Copy link
Contributor

pamelin commented May 9, 2022

@songupta7 this has conflicts with master. Can you please pull the latest and update accordingly?

One of the changes to pay attention to is removal of github.com/HotelsDotCom/go-logger which has been replaced with the zerolog. You should find some examples of how logging framework is being used. You will have to update parts of your code dealing with logging. If you want you can use structured logging with zerolog.

@pamelin
Copy link
Contributor

pamelin commented May 9, 2022

This should be 2 separate PRs:

  • ReactionAdded
  • GetReactionMessageInfo

There is no shared functionality between these 2. It is harder to review due to the need to switch context. Can they be split in 2 please? This way we can release quicker since both of them might have its own quirks which needs to be resolved. It will be quicker to handle one at the time. And when we relase these if anything wrong we know which part to blame for.

@songupta7
Copy link
Contributor Author

ok @pamelin, I will split the PR in two parts and close this PR. I will also pull-in the changes recently done for zerologger.
I have added the test cases for GetReactionMessageInfo and ReactionAdded , would be check-in in the new PR.

@pamelin
Copy link
Contributor

pamelin commented May 12, 2022

cool 👍

@songupta7
Copy link
Contributor Author

@pamelin : I have created the PR #33 for GetReactionMessageInfo functionality. Please review the same .

@songupta7 songupta7 marked this pull request as draft May 12, 2022 14:48
@pamelin
Copy link
Contributor

pamelin commented May 13, 2022

@songupta7 can this PR be closed now?

@songupta7
Copy link
Contributor Author

Hi @pamelin I can close this after I get the review inputs on PR-33 which is created after breaking this PR into two parts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants