Skip to content
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

feat: fixed audience counter permission problem #208

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

Mirai1129
Copy link
Collaborator

@Mirai1129 Mirai1129 commented Oct 19, 2023

Why need this change? / Root cause:

The counter command should be used by Alpha.

Changes made:

  • fixed command permission issue

Test Scope / Change impact:

if user is Alpha -> run the counter
if user isn't Alpha -> tell the user "You should be the Alpha."

@Mirai1129 Mirai1129 linked an issue Oct 19, 2023 that may be closed by this pull request
@Mirai1129 Mirai1129 linked an issue Oct 19, 2023 that may be closed by this pull request
Copy link
Contributor

@shmily7829 shmily7829 left a comment

Choose a reason for hiding this comment

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

Review done.

Comment on lines 44 to 47
val userRoles = member?.roles?.map { it.id } ?: emptyList()
val requiredRole = wsa.wsaAlphaRoleId

reply("counter start!!!").queue {
scheduledRecordHighestAudience(startRecordTime, endRecordTime)
if (userRoles.contains(requiredRole)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

  1. Member 取出的 Id 列表應該是 memberRoleIds
  2. wsa.wsaAlphaRoleId 已經是具有意義的屬性,可以不用再包成一個變數
  3. 可以再思考這三行程式碼能不能再簡化成更語意化的方法

@Mirai1129 Mirai1129 self-assigned this Oct 20, 2023
@sonarcloud
Copy link

sonarcloud bot commented Oct 20, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

0.0% 0.0% Coverage
0.0% 0.0% Duplication

Comment on lines +49 to +51
val currentTime = now()
val startRecordTime = currentTime.truncatedTo(ChronoUnit.MINUTES).toDate()
val endRecordTime = currentTime.plusMinutes(recordPeriodTime).toDate()
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit: 把 currentTimestartRecordTimeendRecordTime 封裝成一個具有領域意義類別,程式會更乾淨整潔

請參考 message-cherry-pickDateTimeRange

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Audience counter權限
3 participants