Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
static messageRequestBuilder(uType,uid, limit) {
var messagesRequest = "";
if(uType == "user"){
messagesRequest = new CometChat.MessagesRequestBuilder().setUID(uid).setLimit(limit).build();
}else{
messagesRequest = new CometChat.MessagesRequestBuilder().setGUID(uid).setLimit(limit).build();
}
return messagesRequest;
}
this.props.activeConversation.membersCount !==
prevProps.activeConversation.membersCount) ||
this.props.callActive !== prevProps.callActive)
) {
var limit = 200;
let messagesRequest;
let otherUID;
if (this.props.activeConversation.guid !== undefined) {
otherUID = this.props.activeConversation.guid;
messagesRequest = new CometChat.MessagesRequestBuilder()
.setLimit(limit)
.setGUID(otherUID)
.build();
} else {
otherUID = this.props.activeConversation.uid;
messagesRequest = new CometChat.MessagesRequestBuilder()
.setLimit(limit)
.setUID(otherUID)
.build();
}
messagesRequest.fetchPrevious().then(
messages => {
if (!_.isEmpty(messages)) {
const last_message = _.last(messages);
if (last_message.sender.uid !== this.props.subjectUID) {
CometChat.markMessageAsRead(last_message);
}
}
this.setState({ msghistory: messages });
this.scrollToBottom();
static messageRequestBuilder(uType,uid, limit) {
var messagesRequest = "";
if(uType == "user"){
messagesRequest = new CometChat.MessagesRequestBuilder().setUID(uid).setLimit(limit).build();
}else{
messagesRequest = new CometChat.MessagesRequestBuilder().setGUID(uid).setLimit(limit).build();
}
return messagesRequest;
}