discourse-chat-integration/plugin.rb

31 lines
958 B
Ruby
Raw Normal View History

# name: discourse-chat-integration
2017-06-26 10:08:06 -04:00
# about: This plugin integrates discourse with a number of chat providers
# version: 0.1
# url: https://github.com/discourse/discourse-chat-integration
# author: David Taylor
2017-06-26 10:08:06 -04:00
enabled_site_setting :chat_integration_enabled
2017-06-26 10:08:06 -04:00
2017-07-03 17:11:17 -04:00
register_asset "stylesheets/chat-integration-admin.scss"
# Site setting validators must be loaded before initialize
require_relative "lib/discourse_chat/provider/slack/slack_enabled_setting_validator"
2017-06-26 10:08:06 -04:00
after_initialize do
require_relative "app/initializers/discourse_chat"
2017-08-01 15:53:39 -04:00
DiscourseEvent.on(:post_created) do |post|
if SiteSetting.chat_integration_enabled?
# This will run for every post, even PMs. Don't worry, they're filtered out later.
time = SiteSetting.chat_integration_delay_seconds.seconds
Jobs.enqueue_in(time, :notify_chats, post_id: post.id)
end
end
add_admin_route 'chat_integration.menu_title', 'chat'
DiscourseChat::Provider.mount_engines
2017-06-26 10:08:06 -04:00
end