mirror of
https://github.com/discourse/discourse.git
synced 2025-02-20 23:13:39 +08:00
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
|
||||
def staff_attributes(*attrs)
|
||||
end
|
||||
|
||||
def include_email?
|
||||
scope.is_admin?
|
||||
end
|
||||
end
|
||||
|
14
spec/serializers/web_hook_user_serializer_spec.rb
Normal file
14
spec/serializers/web_hook_user_serializer_spec.rb
Normal file
@ -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…
x
Reference in New Issue
Block a user