Skip to content

Commit 49de22c

Browse files
authored
feat: pass original author_id and admin token when approving episode patches (#325)
1 parent 3fbb5b0 commit 49de22c

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

episode-review.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ type ApiEpisode struct {
8686

8787
type ApiUpdateEpisode struct {
8888
CommieMessage string `json:"commitMessage"`
89+
AuthorID int32 `json:"authorID"`
8990
ExpectedRevision ApiExpectedSubject `json:"expectedRevision"`
9091
Episode ApiEpisode `json:"episode"`
9192
}
@@ -105,6 +106,7 @@ func (h *handler) handleEpisodeApprove(
105106
s *session.Session,
106107
) error {
107108
var body = ApiUpdateEpisode{
109+
AuthorID: patch.FromUserID,
108110
CommieMessage: fmt.Sprintf("%s [https://patch.bgm38.tv/e/%d]", patch.Reason, patch.NumID),
109111
ExpectedRevision: ApiExpectedSubject{
110112
Name: valuePtrIfChanged(patch.OriginalName.String, patch.Name.String),
@@ -125,6 +127,7 @@ func (h *handler) handleEpisodeApprove(
125127
resp, err := h.client.R().
126128
SetHeader("cf-ray", r.Header.Get("cf-ray")).
127129
SetHeader("Authorization", "Bearer "+s.AccessToken).
130+
SetHeader("x-admin-token", h.config.AdminToken).
128131
SetBody(body).
129132
Patch(fmt.Sprintf("https://next.bgm.tv/p1/wiki/ep/%d", patch.EpisodeID))
130133
if err != nil {

0 commit comments

Comments
 (0)