Discourse 事件总线问题

如果这是错误的区域,我很抱歉。但是,当通过 HTTP 请求个人资料 JSON 文件时,Discourse 会触发一个事件吗?例如:https://meta.discourse.org/u/Marcy.json。

1 个赞

No it does not, you would have to write a plugin to intercept that info.

2 个赞

I’d like to but I’m unsure where to start. I want to change information on the JSON file before it’s displayed to the client.

1 个赞

That would mean you want to amend the serializer, look at plugins such as discourse assign or discourse solved that make serializer changes.

3 个赞

Thanks for the tip, I found this which I assume makes the {Username}.json file?
https://github.com/discourse/discourse/blob/master/app/serializers/user_serializer.rb

Is there any Discourse Ruby API on what events exist, etc? As I don’t know how I’d make changes to it before being displayed as I wanna change the email field before it’s displayed.