2023-03-17 14:24:38 +01:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module ::Chat
|
|
|
|
HAS_CHAT_ENABLED = "has_chat_enabled"
|
2024-03-18 08:35:07 +01:00
|
|
|
LAST_CHAT_CHANNEL_ID = "last_chat_channel_id"
|
2023-03-17 14:24:38 +01:00
|
|
|
|
|
|
|
class Engine < ::Rails::Engine
|
|
|
|
engine_name PLUGIN_NAME
|
|
|
|
isolate_namespace Chat
|
|
|
|
config.autoload_paths << File.join(config.root, "lib")
|
2024-05-02 19:20:00 +01:00
|
|
|
scheduled_job_dir = "#{config.root}/app/jobs/scheduled"
|
2024-05-02 18:26:30 +01:00
|
|
|
config.to_prepare do
|
2024-05-02 19:20:00 +01:00
|
|
|
Rails.autoloaders.main.eager_load_dir(scheduled_job_dir) if Dir.exist?(scheduled_job_dir)
|
2024-05-02 18:26:30 +01:00
|
|
|
end
|
2023-03-17 14:24:38 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
def self.allowed_group_ids
|
|
|
|
SiteSetting.chat_allowed_groups_map
|
|
|
|
end
|
|
|
|
|
2023-09-04 11:55:02 -03:00
|
|
|
def self.message_onebox_template
|
|
|
|
@message_onebox_template ||=
|
2023-03-17 14:24:38 +01:00
|
|
|
begin
|
2023-09-04 11:55:02 -03:00
|
|
|
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"
|
2023-03-17 14:24:38 +01:00
|
|
|
File.read(path)
|
|
|
|
end
|
|
|
|
end
|
2023-10-25 09:30:39 -03:00
|
|
|
|
|
|
|
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
|
2023-03-17 14:24:38 +01:00
|
|
|
end
|