diff options
author | Fire Demon <firedemon@creature.cafe> | 2020-08-14 02:41:44 -0500 |
---|---|---|
committer | Fire Demon <firedemon@creature.cafe> | 2020-08-30 05:45:18 -0500 |
commit | abfd0c107c8003ba06a118625c49d22df553696f (patch) | |
tree | bb41e6b47b2848233b7830b179a7b2e4df21dd91 /app/models | |
parent | d97a574b07cb60e9c2bdd98ace5049e73ee9b861 (diff) |
[Command Tags] Add #!notify toggle to allow toggling whether or not a post should be locally delivered to timelines/notifications
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/status.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/app/models/status.rb b/app/models/status.rb index e81331e93..c12e72f10 100644 --- a/app/models/status.rb +++ b/app/models/status.rb @@ -298,6 +298,20 @@ class Status < ApplicationRecord update_status_stat!(key => [public_send(key) - 1, 0].max) end + def notify=(value) + Redis.current.set("status:#{id}:notify", value ? 1 : 0, ex: 1.hour) + @notify = value + end + + def notify + return @notify if defined?(@notify) + + value = Redis.current.get("status:#{id}:notify") + @notify = value.nil? ? true : value.to_i == 1 + end + + alias notify? notify + def less_private_than?(other_visibility) return false if other_visibility.blank? |