Skip to content

Commit

Permalink
[IMPROVEMENT] Mark a thread as read
Browse files Browse the repository at this point in the history
  • Loading branch information
djorkaeffalexandre committed Jun 29, 2020
1 parent 8fe0615 commit 60d23dc
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
4 changes: 4 additions & 0 deletions app/lib/rocketchat.js
Original file line number Diff line number Diff line change
Expand Up @@ -1134,6 +1134,10 @@ const RocketChat = {
rid, updatedSince
});
},
readThreads(tmid) {
// RC 3.4.0
return this.methodCall('readThreads', tmid);
},
runSlashCommand(command, roomId, params, triggerId, tmid) {
// RC 0.60.2
return this.post('commands.run', {
Expand Down
13 changes: 13 additions & 0 deletions app/views/RoomView/List.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ class List extends React.Component {
} else {
this.state.messages = messages;
}
this.read();
});
}
}
Expand All @@ -125,6 +126,18 @@ class List extends React.Component {
this.init();
}

read = 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;
Expand Down

0 comments on commit 60d23dc

Please sign in to comment.