Merge branch 'master' into glitch-soc/merge-upstream
Conflicts: - `app/controllers/concerns/sign_in_token_authentication_concern.rb`: Conflict caused because of glitch-soc's theming system. Took upstream's new code and applied the theming system changes on top of it. - `app/controllers/concerns/two_factor_authentication_concern.rb`: Conflict caused because of glitch-soc's theming system. Took upstream's new code and applied the theming system changes on top of it.
This commit is contained in:
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
|
Reference in New Issue
Block a user