Skip to content

Commit

Permalink
DEV: Stop using FoundUserWithStatusSerializer (#546)
Browse files Browse the repository at this point in the history
Starting from discourse/discourse@b3a1199 we stop using deprecated "WithStatus" serializers. Instead we'll be passing an 'include_status' option to serilaizers, for example:

```ruby
# before
BasicUserWithStatusSerializer.new(user)
ArraySerializer.new(users, each_serializer: BasicUserWithStatusSerializer)

# now
BasicUserSerializer.new(user, include_status: true)
ArraySerializer.new(users, each_serializer: BasicUserSerializer, include_status: true)
```
  • Loading branch information
AndrewPrigorshnev authored Mar 14, 2024
1 parent 33c43ca commit a1686e1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
1 change: 1 addition & 0 deletions .discourse-compatibility
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
< 3.3.0.beta1-dev: 56b0de3896361b6a87523537c8f5b450d2fe0807
3.2.0: 33c43ca51ac7b7baa8a309a269dcf8685b8bd638
< 3.2.0.beta2-dev: ac930c509e2a5b0c37b84bcea28d332e686add95
3.1.999: a304cd2028ccf1f5b00f5137633aa7027a1fd334
3.1.0.beta3: 9c270cac9abc1c2b30574d8c655fb3a90546236b
Expand Down
6 changes: 2 additions & 4 deletions app/controllers/discourse_assign/assign_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ class AssignController < ApplicationController

def suggestions
users = [current_user, *recent_assignees]
each_serializer =
SiteSetting.enable_user_status? ? FoundUserWithStatusSerializer : FoundUserSerializer

render json: {
assign_allowed_on_groups:
Group.visible_groups(current_user).assign_allowed_groups.pluck(:name),
Expand All @@ -20,7 +17,8 @@ def suggestions
ActiveModel::ArraySerializer.new(
users,
scope: guardian,
each_serializer: each_serializer,
each_serializer: FoundUserSerializer,
include_status: true,
),
}
end
Expand Down

0 comments on commit a1686e1

Please sign in to comment.