aboutsummaryrefslogtreecommitdiff
path: root/internal/db/issue.go
diff options
context:
space:
mode:
authorJoe Chen <jc@unknwon.io>2022-06-25 18:07:39 +0800
committerGitHub <noreply@github.com>2022-06-25 18:07:39 +0800
commit083c3ee659c6c5542687f3bafae68cbc24dbc90f (patch)
tree0103bf3b5c5ebfccd368a7cb6a425a521fd669d9 /internal/db/issue.go
parent9df4e3ae3c555a86f691f0d78a43834842e77d8b (diff)
db: refactor "action" table to use GORM (#7054)
Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>
Diffstat (limited to 'internal/db/issue.go')
-rw-r--r--internal/db/issue.go28
1 files changed, 14 insertions, 14 deletions
diff --git a/internal/db/issue.go b/internal/db/issue.go
index 9fafd4f0..a8909630 100644
--- a/internal/db/issue.go
+++ b/internal/db/issue.go
@@ -237,7 +237,7 @@ func (issue *Issue) sendLabelUpdatedWebhook(doer *User) {
Action: api.HOOK_ISSUE_LABEL_UPDATED,
Index: issue.Index,
PullRequest: issue.PullRequest.APIFormat(),
- Repository: issue.Repo.APIFormat(nil),
+ Repository: issue.Repo.APIFormatLegacy(nil),
Sender: doer.APIFormat(),
})
} else {
@@ -245,7 +245,7 @@ func (issue *Issue) sendLabelUpdatedWebhook(doer *User) {
Action: api.HOOK_ISSUE_LABEL_UPDATED,
Index: issue.Index,
Issue: issue.APIFormat(),
- Repository: issue.Repo.APIFormat(nil),
+ Repository: issue.Repo.APIFormatLegacy(nil),
Sender: doer.APIFormat(),
})
}
@@ -350,7 +350,7 @@ func (issue *Issue) ClearLabels(doer *User) (err error) {
Action: api.HOOK_ISSUE_LABEL_CLEARED,
Index: issue.Index,
PullRequest: issue.PullRequest.APIFormat(),
- Repository: issue.Repo.APIFormat(nil),
+ Repository: issue.Repo.APIFormatLegacy(nil),
Sender: doer.APIFormat(),
})
} else {
@@ -358,7 +358,7 @@ func (issue *Issue) ClearLabels(doer *User) (err error) {
Action: api.HOOK_ISSUE_LABEL_CLEARED,
Index: issue.Index,
Issue: issue.APIFormat(),
- Repository: issue.Repo.APIFormat(nil),
+ Repository: issue.Repo.APIFormatLegacy(nil),
Sender: doer.APIFormat(),
})
}
@@ -477,7 +477,7 @@ func (issue *Issue) ChangeStatus(doer *User, repo *Repository, isClosed bool) (e
apiPullRequest := &api.PullRequestPayload{
Index: issue.Index,
PullRequest: issue.PullRequest.APIFormat(),
- Repository: repo.APIFormat(nil),
+ Repository: repo.APIFormatLegacy(nil),
Sender: doer.APIFormat(),
}
if isClosed {
@@ -490,7 +490,7 @@ func (issue *Issue) ChangeStatus(doer *User, repo *Repository, isClosed bool) (e
apiIssues := &api.IssuesPayload{
Index: issue.Index,
Issue: issue.APIFormat(),
- Repository: repo.APIFormat(nil),
+ Repository: repo.APIFormatLegacy(nil),
Sender: doer.APIFormat(),
}
if isClosed {
@@ -525,7 +525,7 @@ func (issue *Issue) ChangeTitle(doer *User, title string) (err error) {
From: oldTitle,
},
},
- Repository: issue.Repo.APIFormat(nil),
+ Repository: issue.Repo.APIFormatLegacy(nil),
Sender: doer.APIFormat(),
})
} else {
@@ -538,7 +538,7 @@ func (issue *Issue) ChangeTitle(doer *User, title string) (err error) {
From: oldTitle,
},
},
- Repository: issue.Repo.APIFormat(nil),
+ Repository: issue.Repo.APIFormatLegacy(nil),
Sender: doer.APIFormat(),
})
}
@@ -567,7 +567,7 @@ func (issue *Issue) ChangeContent(doer *User, content string) (err error) {
From: oldContent,
},
},
- Repository: issue.Repo.APIFormat(nil),
+ Repository: issue.Repo.APIFormatLegacy(nil),
Sender: doer.APIFormat(),
})
} else {
@@ -580,7 +580,7 @@ func (issue *Issue) ChangeContent(doer *User, content string) (err error) {
From: oldContent,
},
},
- Repository: issue.Repo.APIFormat(nil),
+ Repository: issue.Repo.APIFormatLegacy(nil),
Sender: doer.APIFormat(),
})
}
@@ -610,7 +610,7 @@ func (issue *Issue) ChangeAssignee(doer *User, assigneeID int64) (err error) {
apiPullRequest := &api.PullRequestPayload{
Index: issue.Index,
PullRequest: issue.PullRequest.APIFormat(),
- Repository: issue.Repo.APIFormat(nil),
+ Repository: issue.Repo.APIFormatLegacy(nil),
Sender: doer.APIFormat(),
}
if isRemoveAssignee {
@@ -623,7 +623,7 @@ func (issue *Issue) ChangeAssignee(doer *User, assigneeID int64) (err error) {
apiIssues := &api.IssuesPayload{
Index: issue.Index,
Issue: issue.APIFormat(),
- Repository: issue.Repo.APIFormat(nil),
+ Repository: issue.Repo.APIFormatLegacy(nil),
Sender: doer.APIFormat(),
}
if isRemoveAssignee {
@@ -763,7 +763,7 @@ func NewIssue(repo *Repository, issue *Issue, labelIDs []int64, uuids []string)
if err = NotifyWatchers(&Action{
ActUserID: issue.Poster.ID,
ActUserName: issue.Poster.Name,
- OpType: ACTION_CREATE_ISSUE,
+ OpType: ActionCreateIssue,
Content: fmt.Sprintf("%d|%s", issue.Index, issue.Title),
RepoID: repo.ID,
RepoUserName: repo.Owner.Name,
@@ -780,7 +780,7 @@ func NewIssue(repo *Repository, issue *Issue, labelIDs []int64, uuids []string)
Action: api.HOOK_ISSUE_OPENED,
Index: issue.Index,
Issue: issue.APIFormat(),
- Repository: repo.APIFormat(nil),
+ Repository: repo.APIFormatLegacy(nil),
Sender: issue.Poster.APIFormat(),
}); err != nil {
log.Error("PrepareWebhooks: %v", err)