From 2721b2a477b5881109bc145841d098ff060e4119 Mon Sep 17 00:00:00 2001 From: Audric Ackermann Date: Thu, 30 Jan 2020 11:39:46 +1100 Subject: [PATCH 1/2] refresh files in group in group panel --- js/views/conversation_view.js | 9 ++++++--- ts/components/session/SessionChannelSettings.tsx | 12 ++++++++++++ 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/js/views/conversation_view.js b/js/views/conversation_view.js index c6fd292a8..6d90fd71d 100644 --- a/js/views/conversation_view.js +++ b/js/views/conversation_view.js @@ -350,7 +350,12 @@ props: getGroupSettingsProp(this.model), }); this.$('.conversation-content-right').append(this.groupSettings.el); + this.$('.conversation-content-right').show(); + + return; } + + this.groupSettings.update(getGroupSettingsProp(this.model)); this.$('.conversation-content-right').show(); }; @@ -875,9 +880,7 @@ }, updateScrollDownButton(count) { - if (this.scrollDownButton) { - this.scrollDownButton.increment(count); - } else { + if (!this.scrollDownButton) { this.scrollDownButton = new Whisper.ScrollDownButtonView({ count }); this.scrollDownButton.render(); const container = this.$('.discussion-container'); diff --git a/ts/components/session/SessionChannelSettings.tsx b/ts/components/session/SessionChannelSettings.tsx index f7462ceaa..f775d84e8 100644 --- a/ts/components/session/SessionChannelSettings.tsx +++ b/ts/components/session/SessionChannelSettings.tsx @@ -49,6 +49,18 @@ export class SessionChannelSettings extends React.Component { .ignore(); } + public componentDidUpdate() { + this.getMediaGalleryProps() + .then(({ documents, media, onItemClick }) => { + this.setState({ + documents, + media, + onItemClick, + }); + }) + .ignore(); + } + public async getMediaGalleryProps() { // We fetch more documents than media as they don’t require to be loaded // into memory right away. Revisit this once we have infinite scrolling: From e2921103bd9fd5218ebcf619e67a4e42ea818a22 Mon Sep 17 00:00:00 2001 From: Audric Ackermann Date: Thu, 30 Jan 2020 17:43:57 +1100 Subject: [PATCH 2/2] fix lint and clean code --- js/views/conversation_view.js | 7 ++----- ts/components/session/SessionChannelSettings.tsx | 16 ++++++++-------- 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/js/views/conversation_view.js b/js/views/conversation_view.js index 6d90fd71d..11c59c940 100644 --- a/js/views/conversation_view.js +++ b/js/views/conversation_view.js @@ -350,12 +350,9 @@ props: getGroupSettingsProp(this.model), }); this.$('.conversation-content-right').append(this.groupSettings.el); - this.$('.conversation-content-right').show(); - - return; + } else { + this.groupSettings.update(getGroupSettingsProp(this.model)); } - - this.groupSettings.update(getGroupSettingsProp(this.model)); this.$('.conversation-content-right').show(); }; diff --git a/ts/components/session/SessionChannelSettings.tsx b/ts/components/session/SessionChannelSettings.tsx index f775d84e8..45e65d29a 100644 --- a/ts/components/session/SessionChannelSettings.tsx +++ b/ts/components/session/SessionChannelSettings.tsx @@ -51,14 +51,14 @@ export class SessionChannelSettings extends React.Component { public componentDidUpdate() { this.getMediaGalleryProps() - .then(({ documents, media, onItemClick }) => { - this.setState({ - documents, - media, - onItemClick, - }); - }) - .ignore(); + .then(({ documents, media, onItemClick }) => { + this.setState({ + documents, + media, + onItemClick, + }); + }) + .ignore(); } public async getMediaGalleryProps() {