Skip to content

Commit 53622d6

Browse files
committed
Fix
1 parent 952cfd1 commit 53622d6

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

lib/travis/api/v3/log_token.rb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,16 @@ class LogToken
33
attr_accessor :job_id, :repo_can_write
44

55
def self.find(token)
6-
values = redis.smembers("l:#{token}")
7-
new(values[0].to_i, !!values[1])
6+
key = "l:#{token}"
7+
new(redis.hget(key, :job_id).to_i, !!redis.hget(key, :repo_can_write))
88
end
99

1010
def self.create(job, user_id)
1111
repo_can_write = !!job.repository.users.where(id: user_id, permissions: { push: true }).first
1212

1313
token = SecureRandom.urlsafe_base64(16)
14-
redis.sadd("l:#{token}", [job.id, repo_can_write])
14+
redis.hset("l:#{token}", :job_id, job_id)
15+
redis.hset("l:#{token}", :repo_can_write, repo_can_write)
1516
redis.expire("l:#{token}", 1.day)
1617
token
1718
end

0 commit comments

Comments
 (0)