mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: Get correct selectable avatar from URL (#10339)
The URL for selectable avatars was 'cooked' which means that the find_by method was not enough.
This commit is contained in:
@@ -2377,6 +2377,17 @@ describe UsersController do
|
||||
expect(user.reload.uploaded_avatar_id).to eq(avatar1.id)
|
||||
expect(user.user_avatar.reload.custom_upload_id).to eq(avatar1.id)
|
||||
end
|
||||
|
||||
it 'can succesfully select an avatar using a cooked URL' do
|
||||
events = DiscourseEvent.track_events do
|
||||
put "/u/#{user.username}/preferences/avatar/select.json", params: { url: UrlHelper.cook_url(avatar1.url) }
|
||||
end
|
||||
|
||||
expect(events.map { |event| event[:event_name] }).to include(:user_updated)
|
||||
expect(response.status).to eq(200)
|
||||
expect(user.reload.uploaded_avatar_id).to eq(avatar1.id)
|
||||
expect(user.user_avatar.reload.custom_upload_id).to eq(avatar1.id)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user