mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 22:26:26 +08:00
FIX: base sql vanishes after badge creation
This commit is contained in:
parent
94683b33b8
commit
c2829dce22
|
@ -66,7 +66,7 @@ class Admin::BadgesController < Admin::AdminController
|
|||
if errors.present?
|
||||
render_json_error errors
|
||||
else
|
||||
render_serialized(badge, BadgeSerializer, root: "badge")
|
||||
render_serialized(badge, AdminBadgeSerializer, root: "badge")
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -78,7 +78,7 @@ class Admin::BadgesController < Admin::AdminController
|
|||
if errors.present?
|
||||
render_json_error errors
|
||||
else
|
||||
render_serialized(badge, BadgeSerializer, root: "badge")
|
||||
render_serialized(badge, AdminBadgeSerializer, root: "badge")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -26,6 +26,19 @@ describe Admin::BadgesController do
|
|||
end
|
||||
end
|
||||
|
||||
describe '.create' do
|
||||
render_views
|
||||
|
||||
it 'can create badges correctly' do
|
||||
SiteSetting.enable_badge_sql = true
|
||||
result = xhr :post, :create, name: 'test', query: 'select 1 as user_id, null as granted_at', badge_type_id: 1
|
||||
json = JSON.parse(result.body)
|
||||
expect(result.status).to eq(200)
|
||||
expect(json["badge"]["name"]).to eq('test')
|
||||
expect(json["badge"]["query"]).to eq('select 1 as user_id, null as granted_at')
|
||||
end
|
||||
end
|
||||
|
||||
context '.save_badge_groupings' do
|
||||
|
||||
it 'can save badge groupings' do
|
||||
|
|
Loading…
Reference in New Issue
Block a user