mirror of
https://github.com/mastodon/mastodon.git
synced 2024-12-18 07:38:42 +00:00
Fix error decrementing status count when FeaturedTags#last_status_at
is nil
(#33320)
This commit is contained in:
parent
cf4595967b
commit
6305b6e747
|
@ -47,7 +47,7 @@ class FeaturedTag < ApplicationRecord
|
||||||
def decrement(deleted_status)
|
def decrement(deleted_status)
|
||||||
if statuses_count <= 1
|
if statuses_count <= 1
|
||||||
update(statuses_count: 0, last_status_at: nil)
|
update(statuses_count: 0, last_status_at: nil)
|
||||||
elsif last_status_at > deleted_status.created_at
|
elsif last_status_at.present? && last_status_at > deleted_status.created_at
|
||||||
update(statuses_count: statuses_count - 1)
|
update(statuses_count: statuses_count - 1)
|
||||||
else
|
else
|
||||||
# Fetching the latest status creation time can be expensive, so only perform it
|
# Fetching the latest status creation time can be expensive, so only perform it
|
||||||
|
|
Loading…
Reference in a new issue