mirror of
https://github.com/discourse/discourse.git
synced 2024-12-05 00:25:57 +08:00
3f5a00e20f
With this commit we now support onboxes of: - channel - channel message - thread - thread message
40 lines
970 B
Ruby
40 lines
970 B
Ruby
# frozen_string_literal: true
|
|
|
|
module ::Chat
|
|
HAS_CHAT_ENABLED = "has_chat_enabled"
|
|
|
|
class Engine < ::Rails::Engine
|
|
engine_name PLUGIN_NAME
|
|
isolate_namespace Chat
|
|
config.autoload_paths << File.join(config.root, "lib")
|
|
end
|
|
|
|
def self.allowed_group_ids
|
|
SiteSetting.chat_allowed_groups_map
|
|
end
|
|
|
|
def self.message_onebox_template
|
|
@message_onebox_template ||=
|
|
begin
|
|
path = "#{Rails.root}/plugins/chat/lib/onebox/templates/discourse_chat_message.mustache"
|
|
File.read(path)
|
|
end
|
|
end
|
|
|
|
def self.channel_onebox_template
|
|
@channel_onebox_template ||=
|
|
begin
|
|
path = "#{Rails.root}/plugins/chat/lib/onebox/templates/discourse_chat_channel.mustache"
|
|
File.read(path)
|
|
end
|
|
end
|
|
|
|
def self.thread_onebox_template
|
|
@thread_onebox_template ||=
|
|
begin
|
|
path = "#{Rails.root}/plugins/chat/lib/onebox/templates/discourse_chat_thread.mustache"
|
|
File.read(path)
|
|
end
|
|
end
|
|
end
|