* Fix multiple chat loading bug * Open profile links in chat via new tab * Add unmount handling for chat * Add overscroll property to chat * Add channel_name to ChatChannel model * Create route and page for chatroom WIP * Expose ChatChannel id to live page * Implement multichannel support WIP * Implement chatroom page WIP * Add css for chatroom * Update chat's moderation * Refactor chat's message type * Swap the use of :message_markdown & :message_html * Add channel permissions WIP * Fix failing specs * Adjust json reponses * Add empty message prevention * Update participant error message * Change Workshop channel to General
13 lines
361 B
Ruby
13 lines
361 B
Ruby
class ChatChannel < ApplicationRecord
|
|
has_many :messages
|
|
|
|
validates :channel_type, presence: true, inclusion: { in: %w(open invite_only) }
|
|
|
|
def clear_channel
|
|
messages.each(&:destroy!)
|
|
Pusher.trigger(id, "channel-cleared", { chat_channel_id: id }.to_json)
|
|
true
|
|
rescue Pusher::Error => e
|
|
logger.info "PUSHER ERROR: #{e.message}"
|
|
end
|
|
end
|