Fixing merge
Этот коммит содержится в:
@@ -639,16 +639,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;
|
||||
@@ -660,8 +659,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}`,
|
||||
|
||||
@@ -17,6 +17,7 @@ module.exports = {
|
||||
|
||||
RECIEVED_POSTS: null,
|
||||
RECIEVED_POST: null,
|
||||
RECIEVED_EDIT_POST: null,
|
||||
RECIEVED_SEARCH: null,
|
||||
RECIEVED_POST_SELECTED: null,
|
||||
RECIEVED_MENTION_DATA: null,
|
||||
@@ -287,6 +288,16 @@ module.exports = {
|
||||
}
|
||||
],
|
||||
Preferences: {
|
||||
CATEGORY_DIRECT_CHANNEL_SHOW: 'direct_channel_show'
|
||||
CATEGORY_DIRECT_CHANNEL_SHOW: 'direct_channel_show',
|
||||
CATEGORY_DISPLAY_SETTINGS: 'display_settings'
|
||||
},
|
||||
KeyCodes: {
|
||||
UP: 38,
|
||||
DOWN: 40,
|
||||
LEFT: 37,
|
||||
RIGHT: 39,
|
||||
BACKSPACE: 8,
|
||||
ENTER: 13,
|
||||
ESCAPE: 27
|
||||
}
|
||||
};
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
var AppDispatcher = require('../dispatcher/app_dispatcher.jsx');
|
||||
var ChannelStore = require('../stores/channel_store.jsx');
|
||||
var UserStore = require('../stores/user_store.jsx');
|
||||
var PreferenceStore = require('../stores/preference_store.jsx');
|
||||
var TeamStore = require('../stores/team_store.jsx');
|
||||
var Constants = require('../utils/constants.jsx');
|
||||
var ActionTypes = Constants.ActionTypes;
|
||||
@@ -164,23 +165,29 @@ export function displayDate(ticks) {
|
||||
}
|
||||
|
||||
export function displayTime(ticks) {
|
||||
var d = new Date(ticks);
|
||||
var hours = d.getHours();
|
||||
var minutes = d.getMinutes();
|
||||
const d = new Date(ticks);
|
||||
let hours = d.getHours();
|
||||
let minutes = d.getMinutes();
|
||||
let ampm = '';
|
||||
|
||||
var ampm = 'AM';
|
||||
if (hours >= 12) {
|
||||
ampm = 'PM';
|
||||
}
|
||||
|
||||
hours = hours % 12;
|
||||
if (!hours) {
|
||||
hours = '12';
|
||||
}
|
||||
if (minutes <= 9) {
|
||||
minutes = '0' + minutes;
|
||||
}
|
||||
return hours + ':' + minutes + ' ' + ampm;
|
||||
|
||||
const useMilitaryTime = PreferenceStore.getPreference(Constants.Preferences.CATEGORY_DISPLAY_SETTINGS, 'use_military_time', {value: 'false'}).value;
|
||||
if (useMilitaryTime === 'false') {
|
||||
ampm = ' AM';
|
||||
if (hours >= 12) {
|
||||
ampm = ' PM';
|
||||
}
|
||||
|
||||
hours = hours % 12;
|
||||
if (!hours) {
|
||||
hours = '12';
|
||||
}
|
||||
}
|
||||
|
||||
return hours + ':' + minutes + ampm;
|
||||
}
|
||||
|
||||
export function displayDateTime(ticks) {
|
||||
|
||||
Ссылка в новой задаче
Block a user