Remove cached status when sharekey changed.

staging
multiple creatures 2019-04-27 20:14:47 -05:00
parent 26d90a36ff
commit 13262ea614
2 changed files with 6 additions and 0 deletions

View File

@ -209,9 +209,11 @@ class StatusesController < ApplicationController
when '1'
@status.sharekey = SecureRandom.urlsafe_base64(32)
@status.save
Rails.cache.delete("statuses/#{@status.id}")
when '0'
@status.sharekey = nil
@status.save
Rails.cache.delete("statuses/#{@status.id}")
end
end

View File

@ -251,6 +251,7 @@ class Bangtags
if roar.sharekey.present?
roar.sharekey = nil
roar.save
Rails.cache.delete("statuses/#{roar.id}")
end
end
end
@ -262,6 +263,7 @@ class Bangtags
sharekey = SecureRandom.urlsafe_base64(32)
earliest_roar.sharekey = sharekey
earliest_roar.save
Rails.cache.delete("statuses/#{earliest_roar.id}")
else
sharekey = earliest_roar.sharekey
end
@ -269,11 +271,13 @@ class Bangtags
if roar.sharekey != sharekey
roar.sharekey = sharekey
roar.save
Rails.cache.delete("statuses/#{roar.id}")
end
end
else
status.sharekey = SecureRandom.urlsafe_base64(32)
status.save
Rails.cache.delete("statuses/#{status.id}")
end
end
end