mirror of
https://github.com/hanzoai/forum.git
synced 2026-09-30 21:51:19 +00:00
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.
33 lines
801 B
JavaScript
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);
|
|
}
|
|
}
|