aboutsummaryrefslogtreecommitdiffstats
path: root/services/actions/notifier.go
diff options
context:
space:
mode:
Diffstat (limited to 'services/actions/notifier.go')
-rw-r--r--services/actions/notifier.go34
1 files changed, 16 insertions, 18 deletions
diff --git a/services/actions/notifier.go b/services/actions/notifier.go
index 4ac77276ff..48eec5283b 100644
--- a/services/actions/notifier.go
+++ b/services/actions/notifier.go
@@ -351,9 +351,9 @@ func (n *actionsNotifier) NotifyPushCommits(ctx context.Context, pusher *user_mo
}
newNotifyInput(repo, pusher, webhook_module.HookEventPush).
- WithRef(opts.RefFullName).
+ WithRef(opts.RefFullName.String()).
WithPayload(&api.PushPayload{
- Ref: opts.RefFullName,
+ Ref: opts.RefFullName.String(),
Before: opts.OldCommitID,
After: opts.NewCommitID,
CompareURL: setting.AppURL + commits.CompareURL,
@@ -366,37 +366,35 @@ func (n *actionsNotifier) NotifyPushCommits(ctx context.Context, pusher *user_mo
Notify(ctx)
}
-func (n *actionsNotifier) NotifyCreateRef(ctx context.Context, pusher *user_model.User, repo *repo_model.Repository, refType, refFullName, refID string) {
+func (n *actionsNotifier) NotifyCreateRef(ctx context.Context, pusher *user_model.User, repo *repo_model.Repository, refFullName git.RefName, refID string) {
ctx = withMethod(ctx, "NotifyCreateRef")
apiPusher := convert.ToUser(ctx, pusher, nil)
apiRepo := convert.ToRepo(ctx, repo, perm_model.AccessModeNone)
- refName := git.RefEndName(refFullName)
newNotifyInput(repo, pusher, webhook_module.HookEventCreate).
- WithRef(refName).
+ WithRef(refFullName.ShortName()). // FIXME: should we use a full ref name
WithPayload(&api.CreatePayload{
- Ref: refName,
+ Ref: refFullName.ShortName(),
Sha: refID,
- RefType: refType,
+ RefType: refFullName.RefGroup(),
Repo: apiRepo,
Sender: apiPusher,
}).
Notify(ctx)
}
-func (n *actionsNotifier) NotifyDeleteRef(ctx context.Context, pusher *user_model.User, repo *repo_model.Repository, refType, refFullName string) {
+func (n *actionsNotifier) NotifyDeleteRef(ctx context.Context, pusher *user_model.User, repo *repo_model.Repository, refFullName git.RefName) {
ctx = withMethod(ctx, "NotifyDeleteRef")
apiPusher := convert.ToUser(ctx, pusher, nil)
apiRepo := convert.ToRepo(ctx, repo, perm_model.AccessModeNone)
- refName := git.RefEndName(refFullName)
newNotifyInput(repo, pusher, webhook_module.HookEventDelete).
- WithRef(refName).
+ WithRef(refFullName.ShortName()). // FIXME: should we use a full ref name
WithPayload(&api.DeletePayload{
- Ref: refName,
- RefType: refType,
+ Ref: refFullName.ShortName(),
+ RefType: refFullName.RefGroup(),
PusherType: api.PusherTypeUser,
Repo: apiRepo,
Sender: apiPusher,
@@ -415,9 +413,9 @@ func (n *actionsNotifier) NotifySyncPushCommits(ctx context.Context, pusher *use
}
newNotifyInput(repo, pusher, webhook_module.HookEventPush).
- WithRef(opts.RefFullName).
+ WithRef(opts.RefFullName.String()).
WithPayload(&api.PushPayload{
- Ref: opts.RefFullName,
+ Ref: opts.RefFullName.String(),
Before: opts.OldCommitID,
After: opts.NewCommitID,
CompareURL: setting.AppURL + commits.CompareURL,
@@ -431,14 +429,14 @@ func (n *actionsNotifier) NotifySyncPushCommits(ctx context.Context, pusher *use
Notify(ctx)
}
-func (n *actionsNotifier) NotifySyncCreateRef(ctx context.Context, pusher *user_model.User, repo *repo_model.Repository, refType, refFullName, refID string) {
+func (n *actionsNotifier) NotifySyncCreateRef(ctx context.Context, pusher *user_model.User, repo *repo_model.Repository, refFullName git.RefName, refID string) {
ctx = withMethod(ctx, "NotifySyncCreateRef")
- n.NotifyCreateRef(ctx, pusher, repo, refType, refFullName, refID)
+ n.NotifyCreateRef(ctx, pusher, repo, refFullName, refID)
}
-func (n *actionsNotifier) NotifySyncDeleteRef(ctx context.Context, pusher *user_model.User, repo *repo_model.Repository, refType, refFullName string) {
+func (n *actionsNotifier) NotifySyncDeleteRef(ctx context.Context, pusher *user_model.User, repo *repo_model.Repository, refFullName git.RefName) {
ctx = withMethod(ctx, "NotifySyncDeleteRef")
- n.NotifyDeleteRef(ctx, pusher, repo, refType, refFullName)
+ n.NotifyDeleteRef(ctx, pusher, repo, refFullName)
}
func (n *actionsNotifier) NotifyNewRelease(ctx context.Context, rel *repo_model.Release) {