mirror of
https://github.com/discourse/discourse.git
synced 2024-12-16 00:13:44 +08:00
ef0fe51e05
The payload when receiving a notification webhook is pointless without knowing which user the notification is for. This fix adds the user_id to the notification serializer so that when you receive a notification webhook you can properly identify which user the notification is for. See https://meta.discourse.org/t/getting-the-target-user-for-notification-webhook-events/129052?u=blake for more details.
18 lines
431 B
Ruby
18 lines
431 B
Ruby
# frozen_string_literal: true
|
|
|
|
require 'rails_helper'
|
|
|
|
describe NotificationSerializer do
|
|
describe '#as_json' do
|
|
fab!(:user) { Fabricate(:user) }
|
|
let(:notification) { Fabricate(:notification, user: user) }
|
|
let(:serializer) { NotificationSerializer.new(notification) }
|
|
let(:json) { serializer.as_json }
|
|
|
|
it "returns the user_id" do
|
|
expect(json[:notification][:user_id]).to eq(user.id)
|
|
end
|
|
|
|
end
|
|
end
|