Fix streaming API allowing connections to persist after access token invalidation (#15111)
Fix #14816
This commit is contained in:
parent
8532429af7
commit
aa10200e58
4 changed files with 109 additions and 7 deletions
17
app/lib/access_token_extension.rb
Normal file
17
app/lib/access_token_extension.rb
Normal file
|
@ -0,0 +1,17 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module AccessTokenExtension
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
included do
|
||||
after_commit :push_to_streaming_api
|
||||
end
|
||||
|
||||
def revoke(clock = Time)
|
||||
update(revoked_at: clock.now.utc)
|
||||
end
|
||||
|
||||
def push_to_streaming_api
|
||||
Redis.current.publish("timeline:access_token:#{id}", Oj.dump(event: :kill)) if revoked? || destroyed?
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue