FIX: Remove hard dependency on Chat plugin (#732)
When chat is disabled, these JS modules will not be available
This commit is contained in:
parent
d471bbdf9a
commit
da13f6fc01
|
|
@ -1,8 +1,13 @@
|
|||
import { LinkTo } from "@ember/routing";
|
||||
import ChannelTitle from "discourse/plugins/chat/discourse/components/channel-title";
|
||||
import { and } from "truth-helpers";
|
||||
import { optionalRequire } from "discourse/lib/utilities";
|
||||
|
||||
const ChannelTitle = optionalRequire(
|
||||
"discourse/plugins/chat/discourse/components/channel-title"
|
||||
);
|
||||
|
||||
const DiscoursePostEventChatChannel = <template>
|
||||
{{#if @event.channel}}
|
||||
{{#if (and @event.channel ChannelTitle)}}
|
||||
<section class="event__section event-chat-channel">
|
||||
<span></span>
|
||||
<LinkTo @route="chat.channel" @models={{@event.channel.routeModels}}>
|
||||
|
|
|
|||
|
|
@ -2,11 +2,15 @@ import { tracked } from "@glimmer/tracking";
|
|||
import EmberObject from "@ember/object";
|
||||
import { TrackedArray } from "@ember-compat/tracked-built-ins";
|
||||
import { bind } from "discourse/lib/decorators";
|
||||
import { optionalRequire } from "discourse/lib/utilities";
|
||||
import User from "discourse/models/user";
|
||||
import ChatChannel from "discourse/plugins/chat/discourse/models/chat-channel";
|
||||
import DiscoursePostEventEventStats from "./discourse-post-event-event-stats";
|
||||
import DiscoursePostEventInvitee from "./discourse-post-event-invitee";
|
||||
|
||||
const ChatChannel = optionalRequire(
|
||||
"discourse/plugins/chat/discourse/models/chat-channel"
|
||||
);
|
||||
|
||||
const DEFAULT_REMINDER = {
|
||||
type: "notification",
|
||||
value: 15,
|
||||
|
|
@ -76,7 +80,7 @@ export default class DiscoursePostEventEvent {
|
|||
this.stats = args.stats;
|
||||
this.reminders = args.reminders;
|
||||
this.customFields = EmberObject.create(args.custom_fields || {});
|
||||
if (args.channel) {
|
||||
if (args.channel && ChatChannel) {
|
||||
this.channel = ChatChannel.create(args.channel);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue