2
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2026-03-03 23:54:20 +08:00
discourse/app/serializers/inactive_user_serializer.rb
Yuriy Kurant 4793193c0b
UX: add filter button to user card of deactivated account (#36024)
As a follow-up of #35908.

Allow filtering posts by user from the user card of deactivated user.

### Context
The filter button was missing for deactivated accounts because
`topic_post_count` wasn’t exposed in `InactiveUserSerializer`.

### Result
<img width="701" height="216" alt="Screenshot 2025-11-14 at 00 11 27"
src="https://github.com/user-attachments/assets/e1b8d2a4-9465-4225-aaed-0582f43b8d90"
/>
2025-11-14 15:56:41 +08:00

15 lines
274 B
Ruby

# frozen_string_literal: true
class InactiveUserSerializer < BasicUserSerializer
attr_accessor :topic_post_count
attributes :inactive, :topic_post_count
def inactive
!object.active?
end
def include_topic_post_count?
topic_post_count.present?
end
end