Skip to content

Commit 6aafb51

Browse files
committed
rename CheckTaskID to CheckTaskIsRunning
1 parent 77c7056 commit 6aafb51

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

services/auth/oauth2.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ func CheckOAuthAccessToken(ctx context.Context, accessToken string) int64 {
5555
return grant.UserID
5656
}
5757

58-
// CheckTaskID verifies that the TaskID corresponds to a running task
59-
func CheckTaskID(ctx context.Context, taskID int64) bool {
58+
// CheckTaskIsRunning verifies that the TaskID corresponds to a running task
59+
func CheckTaskIsRunning(ctx context.Context, taskID int64) bool {
6060
// Verify the task exists
6161
task, err := actions_model.GetTaskByID(ctx, taskID)
6262
if err != nil {
@@ -112,7 +112,7 @@ func (o *OAuth2) userIDFromToken(ctx context.Context, tokenSHA string, store Dat
112112
if strings.Contains(tokenSHA, ".") {
113113
// First attempt to decode an actions JWT, returning the actions user
114114
if taskID, err := actions.TokenToTaskID(tokenSHA); err == nil {
115-
if CheckTaskID(ctx, taskID) {
115+
if CheckTaskIsRunning(ctx, taskID) {
116116
store.GetData()["IsActionsToken"] = true
117117
store.GetData()["ActionsTaskID"] = taskID
118118
return user_model.ActionsUserID

services/auth/oauth2_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ func TestUserIDFromToken(t *testing.T) {
3333
})
3434
}
3535

36-
func TestCheckTaskID(t *testing.T) {
36+
func TestCheckTaskIsRunning(t *testing.T) {
3737
assert.NoError(t, unittest.PrepareTestDatabase())
3838

3939
cases := map[string]struct {
@@ -48,7 +48,7 @@ func TestCheckTaskID(t *testing.T) {
4848
for name := range cases {
4949
c := cases[name]
5050
t.Run(name, func(t *testing.T) {
51-
actual := CheckTaskID(context.Background(), c.TaskID)
51+
actual := CheckTaskIsRunning(context.Background(), c.TaskID)
5252
assert.Equal(t, c.Expected, actual)
5353
})
5454
}

0 commit comments

Comments
 (0)