mirror of
https://ghfast.top/https://github.com/discourse/discourse-follow.git
synced 2026-07-15 11:36:38 +08:00
22 lines
613 B
JavaScript
22 lines
613 B
JavaScript
import Component from "@ember/component";
|
|
import { observes } from "discourse-common/utils/decorators";
|
|
|
|
const preferences = [
|
|
"notify_me_when_followed",
|
|
"notify_followed_user_when_followed",
|
|
"notify_me_when_followed_replies",
|
|
"notify_me_when_followed_creates_topic",
|
|
"allow_people_to_follow_me",
|
|
];
|
|
|
|
export default Component.extend({
|
|
@observes(...preferences.map((p) => `user.${p}`))
|
|
_updatePreferences() {
|
|
if (!this.user.custom_fields) {
|
|
this.user.set("custom_fields", {});
|
|
}
|
|
preferences.forEach((p) => {
|
|
this.user.set(`custom_fields.${p}`, this.user[p]);
|
|
});
|
|
},
|
|
});
|