Added error prompt on empty user search
This commit is contained in:
parent
2addcc1fa8
commit
a9d81fce19
@ -175,7 +175,7 @@ export class ChatView implements Observer<ChatMessageViewModel> {
|
||||
const msgTime = new Date();
|
||||
const context: ChatMessageViewModel = {
|
||||
fromUser: JsonAPI.principleName,
|
||||
toUser: "",
|
||||
toUser: contactName,
|
||||
message: messageContent,
|
||||
messageTime: msgTime,
|
||||
};
|
||||
@ -192,12 +192,12 @@ export class ChatView implements Observer<ChatMessageViewModel> {
|
||||
fromUser: JsonAPI.principleName,
|
||||
toUser: contactName,
|
||||
messageCipher: messageCipher,
|
||||
messageTime: msgTime,
|
||||
messageTime: msgTime.toISOString(),
|
||||
};
|
||||
this._sendMessageAJAX(chatMessageDTO);
|
||||
}
|
||||
|
||||
private _sendMessageAJAX(chatMessageDTO: ChatMessageDTO): void {
|
||||
private _sendMessageAJAX(chatMessageDTO: any): void {
|
||||
let headers = new Headers();
|
||||
// console.log("Token = " + btoa("hmm" + ":" + "hmm"))
|
||||
|
||||
|
@ -165,17 +165,22 @@ export class UserView implements Observer<ActiveUserViewModel> {
|
||||
e.preventDefault();
|
||||
// log.trace(temp);
|
||||
const searchTerm = this._userSearchInputElement.value;
|
||||
if (searchTerm.length > 0) {
|
||||
log.debug("search term value = " + searchTerm);
|
||||
const list = this._model.activeUsersList;
|
||||
log.debug("active users");
|
||||
log.debug(list);
|
||||
if (list == null) {
|
||||
if (!list) {
|
||||
log.error("Users list is null");
|
||||
return;
|
||||
}
|
||||
let searchResult = this._searchService.search(list, searchTerm);
|
||||
this.update({ data: searchResult, op: "" });
|
||||
log.debug(searchResult);
|
||||
}
|
||||
else {
|
||||
this._notificationService.error("Please enter a name")
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@ -183,7 +188,6 @@ export class UserView implements Observer<ActiveUserViewModel> {
|
||||
this._userSearchInputElement.addEventListener("input", (e) => {
|
||||
e.preventDefault();
|
||||
if (this._userSearchInputElement.value.length < 2) {
|
||||
log.debug("inputted");
|
||||
this._userSearchCancelButton.hidden = false;
|
||||
}
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user