From 05789f6ef66808f046809204a4ff0bb686176464 Mon Sep 17 00:00:00 2001 From: Ben Halpern Date: Mon, 6 Aug 2018 10:45:01 -0400 Subject: [PATCH] Add client-side /connect maxlength and add badge setting on model only (#660) --- app/controllers/chat_channels_controller.rb | 1 + app/javascript/chat/compose.jsx | 1 + app/models/message.rb | 2 +- ...e_notification_setting_to_chat_channel_memberships.rb | 5 +++++ db/schema.rb | 7 ++++++- spec/models/message_spec.rb | 9 +++++++++ 6 files changed, 23 insertions(+), 2 deletions(-) create mode 100644 db/migrate/20180806142338_add_badge_notification_setting_to_chat_channel_memberships.rb diff --git a/app/controllers/chat_channels_controller.rb b/app/controllers/chat_channels_controller.rb index de97dff9e..98dd56a33 100644 --- a/app/controllers/chat_channels_controller.rb +++ b/app/controllers/chat_channels_controller.rb @@ -92,6 +92,7 @@ class ChatChannelsController < ApplicationController @chat_channels_memberships = current_user. chat_channel_memberships.includes(:chat_channel). where("has_unopened_messages = ? OR status = ?", true, "pending"). + where(show_global_badge_notification: true). order("chat_channel_memberships.updated_at DESC") else @chat_channels_memberships = [] diff --git a/app/javascript/chat/compose.jsx b/app/javascript/chat/compose.jsx index f96258696..1f0ec0c83 100644 --- a/app/javascript/chat/compose.jsx +++ b/app/javascript/chat/compose.jsx @@ -22,6 +22,7 @@ export default class Chat extends Component { id="messageform" placeholder="Message goes here" onKeyDown={handleKeyDown} + maxLength="1000" />