* Update chat.scss --skip-ci * Fix height issue * Add highlighting * Implement bannged user handling for chat * Add scroll obsever * Limit initial messages load count & max messages * Add new message alert when scrolled * Add link to usernames in chat * Implement channel clearing feature * Update parserOptions * Implement banning feature for chat app WIP * Add policy for ChatChannelsController * Fix arugment error * Update user_not_authorized to handle JSON request * Update specs for updated user_not_authorized * Update font-weight for windows os
12 lines
319 B
Ruby
12 lines
319 B
Ruby
class ChatChannel < ApplicationRecord
|
|
has_many :messages
|
|
|
|
validates :channel_type, presence: true, inclusion: { in: %w(open) }
|
|
|
|
def clear_channel
|
|
messages.each(&:destroy!)
|
|
Pusher.trigger(id, "channel-cleared", [].to_json)
|
|
rescue Pusher::Error => e
|
|
logger.info "PUSHER ERROR: #{e.message}"
|
|
end
|
|
end
|