Skip to content

Commit

Permalink
TW-81171: allow unlimited notifications from Slack notifier
Browse files Browse the repository at this point in the history
  • Loading branch information
Fedor Rumyantsev committed May 18, 2023
1 parent b01a9e1 commit 1fef160
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,10 @@ class SlackNotifier(

val descriptors = oauthManager
.getAvailableConnectionsOfType(project, SlackConnection.type)
.filter { desc -> getMaxAdHocNotificationsPerBuild(desc) > 0 }
.filter { desc ->
getMaxAdHocNotificationsPerBuild(desc) > 0 // non-default limit
|| getMaxAdHocNotificationsPerBuild(desc) == -1 // no limit
}

when {
descriptors.size == 1 -> {
Expand Down Expand Up @@ -435,10 +438,14 @@ class SlackNotifier(
runningBuild: SRunningBuild,
connectionDescriptor: OAuthConnectionDescriptor
) {
val buildPromotion = runningBuild.buildPromotion

val limit = getMaxAdHocNotificationsPerBuild(connectionDescriptor)

if (limit == -1) { // no limit, no need to keep track of current count
return
}

val buildPromotion = runningBuild.buildPromotion

val notifierId = "${serviceMessageNotifierType}_${connectionDescriptor.id}"

val currentCount = notificationCountHandler.getCounter(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@
value="${empty propertiesBean.properties[\"serviceMessageMaxNotificationsPerBuild\"]
? propertiesBean.defaultProperties[\"serviceMessageMaxNotificationsPerBuild\"]
: propertiesBean.properties[\"serviceMessageMaxNotificationsPerBuild\"]}"/>
<bs:smallNote>Limits the number of service message notifications per build run. Set to '0' to disable service message notifications.</bs:smallNote>
<bs:smallNote>Limits the number of service message notifications per build run. Set to '0' to disable service message notifications, or '-1' to allow unlimited notifications.</bs:smallNote>
<span class="error" id="error_serviceMessageMaxNotificationsPerBuild"></span>
</td>
</tr>
Expand Down

0 comments on commit 1fef160

Please sign in to comment.