* Refactor channel switcher to not wait on server results * Change channel switcher to quick switcher and include team switching * Add sections, update ordering and add discoverability button * Fix styling error * Use CMD in text if on mac * Clean yarn cache on every install * Various UX updates per feedback * Add shortcut help text for team switcher * Couple more updates per feedback * Some minor fixes for GM and autocomplete race * Updating UI for channel switcher (#6504) * Updating channel switcher button (#6506) * Updating switcher modal on mobile (#6507) * Removed jQuery usage * Rename function to toggleQuickSwitchModal
39 строки
1.0 KiB
JavaScript
39 строки
1.0 KiB
JavaScript
// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
|
|
// See License.txt for license information.
|
|
|
|
import SuggestionStore from 'stores/suggestion_store.jsx';
|
|
|
|
export default class Provider {
|
|
constructor() {
|
|
this.latestPrefix = '';
|
|
this.latestComplete = true;
|
|
this.disableDispatches = false;
|
|
}
|
|
|
|
handlePretextChanged(suggestionId, pretext) { // eslint-disable-line no-unused-vars
|
|
// NO-OP for inherited classes to override
|
|
}
|
|
|
|
startNewRequest(suggestionId, prefix) {
|
|
this.latestPrefix = prefix;
|
|
this.latestComplete = false;
|
|
|
|
// Don't use the dispatcher here since this is only called while handling an event
|
|
SuggestionStore.setSuggestionsPending(suggestionId, true);
|
|
}
|
|
|
|
shouldCancelDispatch(prefix) {
|
|
if (this.disableDispatches) {
|
|
return true;
|
|
}
|
|
|
|
if (prefix === this.latestPrefix) {
|
|
this.latestComplete = true;
|
|
} else if (this.latestComplete) {
|
|
return true;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
}
|