Merge pull request #968 from hmhealey/plt322
PLT-322 Updated Direct Messages menu
Этот коммит содержится в:
@@ -637,3 +637,55 @@ export function getMyTeam() {
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
export function getDirectChannelPreferences() {
|
||||
if (isCallInProgress('getDirectChannelPreferences')) {
|
||||
return;
|
||||
}
|
||||
|
||||
callTracker.getDirectChannelPreferences = utils.getTimestamp();
|
||||
client.getPreferenceCategory(
|
||||
Constants.Preferences.CATEGORY_DIRECT_CHANNEL_SHOW,
|
||||
(data, textStatus, xhr) => {
|
||||
callTracker.getDirectChannelPreferences = 0;
|
||||
|
||||
if (xhr.status === 304 || !data) {
|
||||
return;
|
||||
}
|
||||
|
||||
AppDispatcher.handleServerAction({
|
||||
type: ActionTypes.RECIEVED_PREFERENCES,
|
||||
preferences: data
|
||||
});
|
||||
},
|
||||
(err) => {
|
||||
callTracker.getDirectChannelPreferences = 0;
|
||||
dispatchError(err, 'getDirectChannelPreferences');
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
export function savePreferences(preferences, success, error) {
|
||||
client.savePreferences(
|
||||
preferences,
|
||||
(data, textStatus, xhr) => {
|
||||
if (xhr.status !== 304) {
|
||||
AppDispatcher.handleServerAction({
|
||||
type: ActionTypes.RECIEVED_PREFERENCES,
|
||||
preferences
|
||||
});
|
||||
}
|
||||
|
||||
if (success) {
|
||||
success(data);
|
||||
}
|
||||
},
|
||||
(err) => {
|
||||
dispatchError(err, 'savePreferences');
|
||||
|
||||
if (error) {
|
||||
error();
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1141,3 +1141,31 @@ export function listIncomingHooks(success, error) {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
export function getPreferenceCategory(category, success, error) {
|
||||
$.ajax({
|
||||
url: `/api/v1/preferences/${category}`,
|
||||
dataType: 'json',
|
||||
type: 'GET',
|
||||
success,
|
||||
error: (xhr, status, err) => {
|
||||
var e = handleError('getPreferenceCategory', xhr, status, err);
|
||||
error(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
export function savePreferences(preferences, success, error) {
|
||||
$.ajax({
|
||||
url: '/api/v1/preferences/save',
|
||||
dataType: 'json',
|
||||
contentType: 'application/json',
|
||||
type: 'POST',
|
||||
data: JSON.stringify(preferences),
|
||||
success,
|
||||
error: (xhr, status, err) => {
|
||||
var e = handleError('savePreferences', xhr, status, err);
|
||||
error(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ module.exports = {
|
||||
RECIEVED_AUDITS: null,
|
||||
RECIEVED_TEAMS: null,
|
||||
RECIEVED_STATUSES: null,
|
||||
RECIEVED_PREFERENCES: null,
|
||||
|
||||
RECIEVED_MSG: null,
|
||||
|
||||
@@ -285,5 +286,8 @@ module.exports = {
|
||||
id: 'mentionHighlightLink',
|
||||
uiName: 'Mention Highlight Link'
|
||||
}
|
||||
]
|
||||
],
|
||||
Preferences: {
|
||||
CATEGORY_DIRECT_CHANNEL_SHOW: 'direct_channel_show'
|
||||
}
|
||||
};
|
||||
|
||||
Ссылка в новой задаче
Block a user