# Creating a topic or a post sends the user\_updated webhook

**URL:** https://meta.discourse.org/t/creating-a-topic-or-a-post-sends-the-user-updated-webhook/71643
**Category:** Bug
**Created:** [2017 年 10 月 8 日午後 10:17 UTC](https://meta.discourse.org/t/creating-a-topic-or-a-post-sends-the-user-updated-webhook/71643 "2017-10-08T22:17:42Z")
**Posts on this page:** 12
**Page:** 1

<div class="post-metadata">

### Author: ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)
#### Post date: [2017 年 10 月 8 日午後 10:17 UTC](https://meta.discourse.org/t/creating-a-topic-or-a-post-sends-the-user-updated-webhook/71643/1 "2017-10-08T22:17:42Z")

</div>

If a User Event webhook is activated, creating a topic or a post sends the user\_updated webhook. Tested on the latest Discourse.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [2017 年 10 月 9 日午前 12:18 UTC](https://meta.discourse.org/t/creating-a-topic-or-a-post-sends-the-user-updated-webhook/71643/2 "2017-10-09T00:18:51Z")

</div>

Well I guess we are assuming that something like “last posted at” just changed and pushing that across.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [2017 年 10 月 9 日午前 12:41 UTC](https://meta.discourse.org/t/creating-a-topic-or-a-post-sends-the-user-updated-webhook/71643/3 "2017-10-09T00:41:18Z")

</div>

That is a very odd interpretation of the meaning, I would expect only a user preference was updated. Possibly by the user only.

---

<div class="post-metadata">

### Author: ![watchmanmonitor](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/watchmanmonitor/32/430970_2.png) [@watchmanmonitor](https://meta.discourse.org/u/watchmanmonitor)
#### Post date: [2017 年 10 月 9 日午前 2:55 UTC](https://meta.discourse.org/t/creating-a-topic-or-a-post-sends-the-user-updated-webhook/71643/4 "2017-10-09T02:55:09Z")

</div>

I’d also expect a webhook when badge & group memberships are changed.

---

<div class="post-metadata">

### Author: ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)
#### Post date: [2017 年 10 月 9 日午前 4:49 UTC](https://meta.discourse.org/t/creating-a-topic-or-a-post-sends-the-user-updated-webhook/71643/5 "2017-10-09T04:49:15Z")

</div>

> [@codinghorror](#):
>
> I would expect only a user preference was updated. Possibly by the user only.

This is how it used to work.

> [@watchmanmonitor](#):
>
> I’d also expect a webhook when badge & group memberships are changed.

This would be very useful.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [2017 年 10 月 9 日午前 9:07 UTC](https://meta.discourse.org/t/creating-a-topic-or-a-post-sends-the-user-updated-webhook/71643/6 "2017-10-09T09:07:51Z")

</div>

Hmm this is a regression then – who touched webhooks last @tgxworld?

---

<div class="post-metadata">

### Author: ![tgxworld](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tgxworld/32/106117_2.png) [@tgxworld](https://meta.discourse.org/u/tgxworld)
#### Post date: [2017 年 10 月 9 日午前 10:25 UTC](https://meta.discourse.org/t/creating-a-topic-or-a-post-sends-the-user-updated-webhook/71643/7 "2017-10-09T10:25:03Z")

</div>

Not me, Rails 5 touched it 😛

I’ll have a look

---

<div class="post-metadata">

### Author: ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)
#### Post date: [2017 年 10 月 9 日午後 6:15 UTC](https://meta.discourse.org/t/creating-a-topic-or-a-post-sends-the-user-updated-webhook/71643/9 "2017-10-09T18:15:03Z")

</div>

A user webhook is also being sent when a user logs in or out. Creating a user through SSO is sending 3 user webhooks. First a `user_created` one for the new user. Then `user_updated` for the same user, then `user_updated` for the discobot. This is tested on a live version of Discourse.

---

<div class="post-metadata">

### Author: ![tgxworld](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tgxworld/32/106117_2.png) [@tgxworld](https://meta.discourse.org/u/tgxworld)
#### Post date: [2017 年 10 月 10 日午前 1:18 UTC](https://meta.discourse.org/t/creating-a-topic-or-a-post-sends-the-user-updated-webhook/71643/10 "2017-10-10T01:18:19Z")

</div>

It looks like the behavior of the `user_updated` event was changed in

[https://github.com/discourse/discourse/commit/519b70ea4692834638e4b95c92b81a2160621681](https://github.com/discourse/discourse/commit/519b70ea4692834638e4b95c92b81a2160621681)

which triggers as long as a column on the user is changed. @zogstrip Do we need all the columns to trigger the event? If not I’ll add a a filter that checks the columns which have changed against the `UserUpdated::OPTION_ATTR` constant.

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [2017 年 10 月 10 日午前 8:27 UTC](https://meta.discourse.org/t/creating-a-topic-or-a-post-sends-the-user-updated-webhook/71643/11 "2017-10-10T08:27:17Z")

</div>

I needed it for the group-tracker plugin

> <https://github.com/discourse/discourse-group-tracker/blob/0b7d33899c843354dc3cfd65cd00bdd5c424c3bb/plugin.rb#L191-L200>

In that case I only need the `primary_group_id` so `UserUpdater::OPTION_ATTR` will have to be updated.

---

<div class="post-metadata">

### Author: ![tgxworld](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tgxworld/32/106117_2.png) [@tgxworld](https://meta.discourse.org/u/tgxworld)
#### Post date: [2017 年 10 月 23 日午前 3:45 UTC](https://meta.discourse.org/t/creating-a-topic-or-a-post-sends-the-user-updated-webhook/71643/12 "2017-10-23T03:45:25Z")

</div>

Fixed in

[https://github.com/discourse/discourse/commit/19f3b8116150c3692e8bd4349cdb3708621a2ddd](https://github.com/discourse/discourse/commit/19f3b8116150c3692e8bd4349cdb3708621a2ddd)  
[https://github.com/discourse/discourse-group-tracker/commit/36fd0ded022ab7b62dba6d840658576f64d57a7b](https://github.com/discourse/discourse-group-tracker/commit/36fd0ded022ab7b62dba6d840658576f64d57a7b)

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [2017 年 10 月 23 日午前 3:47 UTC](https://meta.discourse.org/t/creating-a-topic-or-a-post-sends-the-user-updated-webhook/71643/13 "2017-10-23T03:47:05Z")

</div>


