Skip to content

Commit

Permalink
[REF] Use a single IF statement to handle status
Browse files Browse the repository at this point in the history
  • Loading branch information
dhruvjain99 committed Aug 15, 2021
1 parent 3299ae9 commit 136bab6
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions app/livechat/server/lib/Livechat.js
Original file line number Diff line number Diff line change
Expand Up @@ -1202,11 +1202,8 @@ export const Livechat = {
},
updateCallStatus(callId, rid, status, user) {
Rooms.setCallStatus(rid, status);
if (status === 'ended' && user) {
return updateMessage({ _id: callId, msg: 'ended', actionLinks: [], endTs: new Date() }, user);
}
if (status === 'declined') {
return updateMessage({ _id: callId, msg: 'declined', actionLinks: [], endTs: new Date() }, user);
if (status === 'ended' || status === 'declined') {
return updateMessage({ _id: callId, msg: status, actionLinks: [], endTs: new Date() }, user);
}
},
};
Expand Down

0 comments on commit 136bab6

Please sign in to comment.