Merge pull request #1079 from hmhealey/initprefs
Added an initial call to get all user preferences on page load
Этот коммит содержится в:
@@ -638,16 +638,15 @@ export function getMyTeam() {
|
||||
);
|
||||
}
|
||||
|
||||
export function getDirectChannelPreferences() {
|
||||
if (isCallInProgress('getDirectChannelPreferences')) {
|
||||
export function getAllPreferences() {
|
||||
if (isCallInProgress('getAllPreferences')) {
|
||||
return;
|
||||
}
|
||||
|
||||
callTracker.getDirectChannelPreferences = utils.getTimestamp();
|
||||
client.getPreferenceCategory(
|
||||
Constants.Preferences.CATEGORY_DIRECT_CHANNEL_SHOW,
|
||||
callTracker.getAllPreferences = utils.getTimestamp();
|
||||
client.getAllPreferences(
|
||||
(data, textStatus, xhr) => {
|
||||
callTracker.getDirectChannelPreferences = 0;
|
||||
callTracker.getAllPreferences = 0;
|
||||
|
||||
if (xhr.status === 304 || !data) {
|
||||
return;
|
||||
@@ -659,8 +658,8 @@ export function getDirectChannelPreferences() {
|
||||
});
|
||||
},
|
||||
(err) => {
|
||||
callTracker.getDirectChannelPreferences = 0;
|
||||
dispatchError(err, 'getDirectChannelPreferences');
|
||||
callTracker.getAllPreferences = 0;
|
||||
dispatchError(err, 'getAllPreferences');
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1142,6 +1142,19 @@ export function listIncomingHooks(success, error) {
|
||||
});
|
||||
}
|
||||
|
||||
export function getAllPreferences(success, error) {
|
||||
$.ajax({
|
||||
url: `/api/v1/preferences/`,
|
||||
dataType: 'json',
|
||||
type: 'GET',
|
||||
success,
|
||||
error: (xhr, status, err) => {
|
||||
var e = handleError('getAllPreferences', xhr, status, err);
|
||||
error(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
export function getPreferenceCategory(category, success, error) {
|
||||
$.ajax({
|
||||
url: `/api/v1/preferences/${category}`,
|
||||
|
||||
Ссылка в новой задаче
Block a user