This repository has been archived on 2023-03-18. You can view files and clone it, but cannot push or open issues or pull requests.
osr-discourse-src/plugins/chat/assets/javascripts/discourse/components/chat-channel-settings-row.js
Roman Rizzi 0a5f548635
DEV: Move discourse-chat to the core repo. (#18776)
As part of this move, we are also renaming `discourse-chat` to `chat`.
2022-11-02 10:41:30 -03:00

41 lines
1.1 KiB
JavaScript

import Component from "@ember/component";
import discourseComputed from "discourse-common/utils/decorators";
import I18n from "I18n";
import { action } from "@ember/object";
import { inject as service } from "@ember/service";
const NOTIFICATION_LEVELS = [
{ name: I18n.t("chat.notification_levels.never"), value: "never" },
{ name: I18n.t("chat.notification_levels.mention"), value: "mention" },
{ name: I18n.t("chat.notification_levels.always"), value: "always" },
];
const MUTED_OPTIONS = [
{ name: I18n.t("chat.settings.muted_on"), value: true },
{ name: I18n.t("chat.settings.muted_off"), value: false },
];
export default Component.extend({
channel: null,
loading: false,
showSaveSuccess: false,
notificationLevels: NOTIFICATION_LEVELS,
mutedOptions: MUTED_OPTIONS,
chat: service(),
router: service(),
didInsertElement() {
this._super(...arguments);
},
@discourseComputed("channel.chatable_type")
chatChannelClass(channelType) {
return `${channelType.toLowerCase()}-chat-channel`;
},
@action
previewChannel() {
this.chat.openChannel(this.channel);
},
});