From 25bf0096c513da8418e5a892811057c1134f34e5 Mon Sep 17 00:00:00 2001
From: Tainan Felipe <tainanfelipe214@gmail.com>
Date: Wed, 2 Jun 2021 11:50:26 -0300
Subject: [PATCH] Add field to toggle the download of the public chat message

---
 .../chat/chat-dropdown/component.jsx          | 25 +++++++++++++++----
 .../private/config/settings.yml               |  1 +
 2 files changed, 21 insertions(+), 5 deletions(-)

diff --git a/bigbluebutton-html5/imports/ui/components/chat/chat-dropdown/component.jsx b/bigbluebutton-html5/imports/ui/components/chat/chat-dropdown/component.jsx
index b2442f2518..6cf7ead412 100755
--- a/bigbluebutton-html5/imports/ui/components/chat/chat-dropdown/component.jsx
+++ b/bigbluebutton-html5/imports/ui/components/chat/chat-dropdown/component.jsx
@@ -31,6 +31,9 @@ const intlMessages = defineMessages({
   },
 });
 
+const CHAT_CONFIG = Meteor.settings.public.chat;
+const ENABLE_SAVE_AND_COPY_PUBLIC_CHAT = CHAT_CONFIG.enableSaveAndCopyPublicChat;
+
 class ChatDropdown extends PureComponent {
   constructor(props) {
     super(props);
@@ -82,13 +85,21 @@ class ChatDropdown extends PureComponent {
 
   getAvailableActions() {
     const {
-      intl, isMeteorConnected, amIModerator, meetingIsBreakout, meetingName, timeWindowsValues, users,
+      intl,
+      isMeteorConnected,
+      amIModerator,
+      meetingIsBreakout,
+      meetingName,
+      timeWindowsValues,
+      users,
     } = this.props;
 
     const clearIcon = 'delete';
     const saveIcon = 'download';
     const copyIcon = 'copy';
     return _.compact([
+      ENABLE_SAVE_AND_COPY_PUBLIC_CHAT
+      && (
       <DropdownListItem
         data-test="chatSave"
         icon={saveIcon}
@@ -103,19 +114,23 @@ class ChatDropdown extends PureComponent {
           link.setAttribute('download', `bbb-${meetingName}[public-chat]_${dateString}.txt`);
           link.setAttribute(
             'href',
-            `data: ${mimeType} ;charset=utf-8,`+
-            `${encodeURIComponent(ChatService.exportChat(timeWindowsValues, users, intl))}`,
+            `data: ${mimeType} ;charset=utf-8,`
+            + `${encodeURIComponent(ChatService.exportChat(timeWindowsValues, users, intl))}`,
           );
           link.dispatchEvent(new MouseEvent('click', { bubbles: true, cancelable: true, view: window }));
         }}
-      />,
+      />
+      ),
+      ENABLE_SAVE_AND_COPY_PUBLIC_CHAT
+      && (
       <DropdownListItem
         data-test="chatCopy"
         icon={copyIcon}
         id="clipboardButton"
         label={intl.formatMessage(intlMessages.copy)}
         key={this.actionsKey[1]}
-      />,
+      />
+      ),
       !meetingIsBreakout && amIModerator && isMeteorConnected ? (
         <DropdownListItem
           data-test="chatClear"
diff --git a/bigbluebutton-html5/private/config/settings.yml b/bigbluebutton-html5/private/config/settings.yml
index 10bc805d10..c30d4ecea0 100755
--- a/bigbluebutton-html5/private/config/settings.yml
+++ b/bigbluebutton-html5/private/config/settings.yml
@@ -396,6 +396,7 @@ public:
     enabled: true
     itemsPerPage: 100
     timeBetweenFetchs: 1000
+    enableSaveAndCopyPublicChat: false
     bufferChatInsertsMs: 0
     startClosed: false
     min_message_length: 1
-- 
GitLab