FEATURE: Include email in `User` webhook.
https://meta.discourse.org/t/should-the-email-address-of-a-new-user-be-included-in-the-webhook/59255
This commit is contained in:
parent
80edb4cebc
commit
7c17966171
|
@ -2,4 +2,8 @@ class WebHookUserSerializer < UserSerializer
|
||||||
# remove staff attributes
|
# remove staff attributes
|
||||||
def staff_attributes(*attrs)
|
def staff_attributes(*attrs)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def include_email?
|
||||||
|
scope.is_admin?
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
RSpec.describe WebHookUserSerializer do
|
||||||
|
let(:user) { Fabricate(:user) }
|
||||||
|
let(:admin) { Fabricate(:admin) }
|
||||||
|
|
||||||
|
subject { described_class.new(user, scope: Guardian.new(admin), root: false) }
|
||||||
|
|
||||||
|
it "should include the user's email" do
|
||||||
|
payload = subject.as_json
|
||||||
|
|
||||||
|
expect(payload[:email]).to eq(user.email)
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in New Issue