-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix/get all reacted users #18
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
少しコメントしました。
そもそもなんだけど、この処理は GetParentMessage
の中でやっても良いかなと思うんだけど、どう思う?
ドメインとしては不完全な message 受け取っても仕方ないし、API の仕様気にしてそれの refetch とかドメインで考えたくない気もする。
func (s *slackReactionUsersService) getFullReactions(ctx context.Context, channelID, ts string) ([]*model.SlackReaction, error) { | ||
return s.slackRepository.GetReactions(ctx, channelID, ts, true) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
この処理 func に切り出すほどの処理だった?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
true
を直で引数に指定するのが、マジックナンバーみたいに見えるから関数に切り出した感じ(意味がわかるように)。
どっちでも良いとは思ってるけどどうでしょう?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ここでture直書きにしておきました
fix implementation
return reactedUserEmails, nil | ||
} | ||
|
||
// isReactionRefetchNeeded returns true if more fetches is required |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
どういう時に refetch が必要なのか、軽くコメント入れておいてくれると助かる。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ありがとう!入れておきました
add comment
UserIDs: []string{"user02", "user03"}, | ||
Count: 4, // number of counts that need to be re-fetched |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
これって len(UserIDs) > Count のパターンってありえないんだっけ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ありえないと思う。APIドキュメントには明示されていなかったけど、実データとして確認しているのは
len(UserIDs) =< Count
の時だけかな。
判定部分が !=
になっていたから、判定部を修正しておきました
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fix implementation でisIncompleteReaction
にロジックを移したので、ここのコメントと判定部を修正しておきました
@hotakahattori repository層、まだテスト全然書けていないから、serviceに載せて保護しようかなと思ったけど、確かにそんな気がする。修正しました |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
少しコメントしたけど、approve しておきます!
app/internal/repository/slack.go
Outdated
} | ||
for _, reaction := range parentMessage.Reactions { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
変数宣言と使用箇所が無駄に離れてる
} | |
for _, reaction := range parentMessage.Reactions { | |
} | |
var reactions []*model.SlackReaction | |
for _, reaction := range parentMessage.Reactions { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
対応しておきました move reactions(var)
app/internal/repository/slack.go
Outdated
@@ -18,7 +18,8 @@ package repository | |||
|
|||
import ( | |||
"context" | |||
"fmt" | |||
|
|||
slack2 "github.com/slack-go/slack" | |||
|
|||
"github.com/moneyforward/auriga/app/pkg/slack" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
こっち pkgslack とかにしとく?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
直したのでマージします |
Overview
Changes
ListUsersEmailByReaction
to judge whether it has to usereactions.get
API for fetching full reactions and to fetch all reactions as necessary before filtering reacted users using getReactionUserIDs.model.SlackReaction
to allow this determine.Operation check