diff --git a/app/lib/rocketchat.js b/app/lib/rocketchat.js index 831d75790..06ff12eda 100644 --- a/app/lib/rocketchat.js +++ b/app/lib/rocketchat.js @@ -1141,6 +1141,14 @@ const RocketChat = { rid, updatedSince }); }, + readThreads(tmid) { + const serverVersion = reduxStore.getState().server.version; + if (serverVersion && semver.gte(semver.coerce(serverVersion), '3.4.0')) { + // RC 3.4.0 + return this.methodCallWrapper('readThreads', tmid); + } + return Promise.resolve(); + }, runSlashCommand(command, roomId, params, triggerId, tmid) { // RC 0.60.2 return this.post('commands.run', { diff --git a/app/views/RoomView/List.js b/app/views/RoomView/List.js index 4e58fe0fa..d0dc7c88d 100644 --- a/app/views/RoomView/List.js +++ b/app/views/RoomView/List.js @@ -115,6 +115,7 @@ class List extends React.Component { } else { this.state.messages = messages; } + this.readThreads(); }); } } @@ -125,6 +126,18 @@ class List extends React.Component { this.init(); } + readThreads = async() => { + const { tmid } = this.props; + + if (tmid) { + try { + await RocketChat.readThreads(tmid); + } catch { + // Do nothing + } + } + } + shouldComponentUpdate(nextProps, nextState) { const { loading, end, refreshing } = this.state; const { hideSystemMessages, theme } = this.props;