Skip to content
Permalink
Browse files

MDL-55543 message: disabled search when deleting messages

  • Loading branch information...
ryanwyllie authored and markn86 committed Aug 19, 2016
1 parent 59181e5 commit 9d783a8d2cdf70f4c54d8fec18b3916d1dba875e
Showing with 37 additions and 1 deletion.
  1. +37 −1 message/amd/src/message_area_search.js
@@ -113,6 +113,18 @@ define(['jquery', 'core/ajax', 'core/templates', 'core/notification', 'core/str'
this._searchArea = this._searchAreas.MESSAGES;
this._setPlaceholderText('searchmessages');
}.bind(this));
this.messageArea.onCustomEvent(this.messageArea.EVENTS.CHOOSEMESSAGESTODELETE, function() {
this._hideSearchResults();
this._searchArea = this._searchAreas.MESSAGES;
this._setPlaceholderText('searchmessages');
this._disableSearching();
}.bind(this));
this.messageArea.onCustomEvent(this.messageArea.EVENTS.CANCELDELETEMESSAGES, function() {
this._enableSearching();
}.bind(this));
this.messageArea.onCustomEvent(this.messageArea.EVENTS.MESSAGESDELETED, function() {
this._enableSearching();
}.bind(this));

// Event listeners for scrolling through messages and people in courses.
customEvents.define(this.messageArea.SELECTORS.SEARCHRESULTSAREA, [
@@ -383,5 +395,29 @@ define(['jquery', 'core/ajax', 'core/templates', 'core/notification', 'core/str'
this.messageArea.find(this.messageArea.SELECTORS.SEARCHRESULTSAREA).hide();
};

/**
* Disable search.
*
* @private
*/
Search.prototype._disableSearching = function() {
this.messageArea.find(this.messageArea.SELECTORS.SEARCHBOX).prop('disabled', true);

if (this._searchArea == this._searchAreas.MESSAGES) {
this.messageArea.trigger(this.messageArea.EVENTS.MESSAGESEARCHCANCELED);
} else if (this._searchArea == this._searchAreas.PEOPLE) {
this.messageArea.trigger(this.messageArea.EVENTS.PEOPLESEARCHCANCELED);
}
};

/**
* Enable search.
*
* @private
*/
Search.prototype._enableSearching = function() {
this.messageArea.find(this.messageArea.SELECTORS.SEARCHBOX).prop('disabled', false);
};

return Search;
});
});

0 comments on commit 9d783a8

Please sign in to comment.
You can’t perform that action at this time.