From 6305b6e747e9cfbe991df06c19a64cec304f91d6 Mon Sep 17 00:00:00 2001 From: Claire Date: Mon, 16 Dec 2024 13:33:55 +0100 Subject: [PATCH] Fix error decrementing status count when `FeaturedTags#last_status_at` is `nil` (#33320) --- app/models/featured_tag.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/featured_tag.rb b/app/models/featured_tag.rb index 529056f9c6..dfc700649c 100644 --- a/app/models/featured_tag.rb +++ b/app/models/featured_tag.rb @@ -47,7 +47,7 @@ class FeaturedTag < ApplicationRecord def decrement(deleted_status) if statuses_count <= 1 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) else # Fetching the latest status creation time can be expensive, so only perform it