Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
佳 邓
Gitlab4j Api
Commits
0955e34c
Unverified
Commit
0955e34c
authored
Nov 15, 2021
by
Gautier de Saint Martin Lacaze
Committed by
GitHub
Nov 15, 2021
Browse files
Merge pull request #763 from hansson/master
Adding branches_to_be_notified to SlackService
parents
a7991ddc
18ecca31
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/main/java/org/gitlab4j/api/services/EmailOnPushService.java
View file @
0955e34c
...
...
@@ -9,7 +9,6 @@ public class EmailOnPushService extends NotificationService {
public
static
final
String
RECIPIENT_PROP
=
"recipients"
;
public
static
final
String
DISABLE_DIFFS_PROP
=
"disable_diffs"
;
public
static
final
String
SEND_FROM_COMMITTER_EMAIL_PROP
=
"send_from_committer_email"
;
public
static
final
String
BRANCHES_TO_BE_NOTIFIED_PROP
=
"branches_to_be_notified"
;
@Override
public
GitLabApiForm
servicePropertiesForm
()
{
...
...
src/main/java/org/gitlab4j/api/services/NotificationService.java
View file @
0955e34c
...
...
@@ -13,6 +13,7 @@ public abstract class NotificationService {
public
static
final
String
NOTIFY_ONLY_BROKEN_PIPELINES_PROP
=
"notify_only_broken_pipelines"
;
public
static
final
String
NOTIFY_ONLY_DEFAULT_BRANCH_PROP
=
"notify_only_default_branch"
;
public
static
final
String
BRANCHES_TO_BE_NOTIFIED_PROP
=
"branches_to_be_notified"
;
public
static
final
String
PUSH_CHANNEL_PROP
=
"push_channel"
;
public
static
final
String
ISSUE_CHANNEL_PROP
=
"issue_channel"
;
public
static
final
String
CONFIDENTIAL_ISSUE_CHANNEL_PROP
=
"confidential_issue_channel"
;
...
...
src/main/java/org/gitlab4j/api/services/SlackService.java
View file @
0955e34c
...
...
@@ -139,19 +139,50 @@ public class SlackService extends NotificationService {
}
@JsonIgnore
@Deprecated
public
Boolean
getNotifyOnlyDefaultBranch
()
{
return
((
Boolean
)
getProperty
(
NOTIFY_ONLY_DEFAULT_BRANCH_PROP
,
Boolean
.
FALSE
));
}
/**
* @deprecated use {@link SlackService#setBranchesToBeNotified(BranchesToBeNotified)}
* @param notifyOnlyDefaultBranch
*/
@Deprecated
public
void
setNotifyOnlyDefaultBranch
(
Boolean
notifyOnlyDefaultBranch
)
{
setProperty
(
NOTIFY_ONLY_DEFAULT_BRANCH_PROP
,
notifyOnlyDefaultBranch
);
}
/**
* @deprecated use {@link SlackService#withBranchesToBeNotified(BranchesToBeNotified)}
* @param notifyOnlyDefaultBranch
*/
@Deprecated
public
SlackService
withNotifyOnlyDefaultBranch
(
Boolean
notifyOnlyDefaultBranch
)
{
setNotifyOnlyDefaultBranch
(
notifyOnlyDefaultBranch
);
return
(
this
);
}
@JsonIgnore
public
BranchesToBeNotified
getBranchesToBeNotified
()
{
String
branchesToBeNotified
=
getProperty
(
BRANCHES_TO_BE_NOTIFIED_PROP
);
if
(
branchesToBeNotified
==
null
||
branchesToBeNotified
.
isEmpty
())
{
return
null
;
}
return
(
BranchesToBeNotified
.
valueOf
(
branchesToBeNotified
.
toUpperCase
()));
}
public
void
setBranchesToBeNotified
(
BranchesToBeNotified
branchesToBeNotified
)
{
setProperty
(
BRANCHES_TO_BE_NOTIFIED_PROP
,
branchesToBeNotified
.
toString
());
}
public
SlackService
withBranchesToBeNotified
(
BranchesToBeNotified
branchesToBeNotified
)
{
setBranchesToBeNotified
(
branchesToBeNotified
);
return
this
;
}
@JsonIgnore
public
String
getPushChannel
()
{
return
((
String
)
getProperty
(
PUSH_CHANNEL_PROP
));
...
...
src/test/resources/org/gitlab4j/api/slack-notifications.json
View file @
0955e34c
...
...
@@ -18,7 +18,7 @@
"webhook"
:
"https://hooks.slack.com/services/AAAA1BBB/ABCDEFGHI/aBCdef1Gerer65ere54gdffd"
,
"username"
:
"GitLab"
,
"notify_only_broken_pipelines"
:
false
,
"
notify_only_default_branch"
:
true
,
"
branches_to_be_notified"
:
"all"
,
"push_channel"
:
"pushes"
,
"issue_channel"
:
""
,
"confidential_issue_channel"
:
""
,
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment