Files
David BattersbyandGitHub ab36918be8 DEV: consolidate chat channel notification settings (#29080)
On the chat channel settings page, we want to show a single Send push notifications setting instead of the current Desktop notifications and Mobile push notifications settings.

For existing users, use the Mobile push notifications setting value for the new Send push notifications setting.
2024-10-08 13:13:01 +04:00

33 lines
801 B
JavaScript

import { tracked } from "@glimmer/tracking";
import User from "discourse/models/user";
export default class UserChatChannelMembership {
static create(args = {}) {
return new UserChatChannelMembership(args);
}
@tracked following;
@tracked muted;
@tracked notificationLevel;
@tracked lastReadMessageId;
@tracked lastViewedAt;
@tracked user;
constructor(args = {}) {
this.following = args.following;
this.muted = args.muted;
this.notificationLevel = args.notification_level;
this.lastReadMessageId = args.last_read_message_id;
this.lastViewedAt = new Date(args.last_viewed_at);
this.user = this.#initUserModel(args.user);
}
#initUserModel(user) {
if (!user || user instanceof User) {
return user;
}
return User.create(user);
}
}