Added keys to array-based elements and made getMe asynchronous
Этот коммит содержится в:
@@ -439,9 +439,9 @@ module.exports = React.createClass({
|
|||||||
currentPostDay = utils.getDateForUnixTicks(post.create_at);
|
currentPostDay = utils.getDateForUnixTicks(post.create_at);
|
||||||
if (currentPostDay.toDateString() != previousPostDay.toDateString()) {
|
if (currentPostDay.toDateString() != previousPostDay.toDateString()) {
|
||||||
postCtls.push(
|
postCtls.push(
|
||||||
<div className="date-separator">
|
<div key="date_div" className="date-separator">
|
||||||
<hr className="separator__hr" />
|
<hr key="date_line" className="separator__hr" />
|
||||||
<div className="separator__text">{currentPostDay.toDateString()}</div>
|
<div key="date" className="separator__text">{currentPostDay.toDateString()}</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -449,9 +449,9 @@ module.exports = React.createClass({
|
|||||||
if (post.create_at > last_viewed && !rendered_last_viewed) {
|
if (post.create_at > last_viewed && !rendered_last_viewed) {
|
||||||
rendered_last_viewed = true;
|
rendered_last_viewed = true;
|
||||||
postCtls.push(
|
postCtls.push(
|
||||||
<div className="new-separator">
|
<div key="unviewed_div" className="new-separator">
|
||||||
<hr id="new_message" className="separator__hr" />
|
<hr key="unviewed_line" id="new_message" className="separator__hr" />
|
||||||
<div className="separator__text">New Messages</div>
|
<div key="unviewedMessage" className="separator__text">New Messages</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -459,7 +459,7 @@ module.exports = React.createClass({
|
|||||||
previousPostDay = currentPostDay;
|
previousPostDay = currentPostDay;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
postCtls.push(<LoadingScreen position="absolute" />);
|
postCtls.push(<LoadingScreen key="loading" position="absolute" />);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
var utils = require('../utils/utils.jsx');
|
var utils = require('../utils/utils.jsx');
|
||||||
|
|
||||||
module.exports = React.createClass({
|
module.exports = React.createClass({
|
||||||
|
displayName:'SettingsSidebar',
|
||||||
updateTab: function(tab) {
|
updateTab: function(tab) {
|
||||||
this.props.updateTab(tab);
|
this.props.updateTab(tab);
|
||||||
$('.settings-modal').addClass('display--content');
|
$('.settings-modal').addClass('display--content');
|
||||||
@@ -14,7 +15,7 @@ module.exports = React.createClass({
|
|||||||
<div className="">
|
<div className="">
|
||||||
<ul className="nav nav-pills nav-stacked">
|
<ul className="nav nav-pills nav-stacked">
|
||||||
{this.props.tabs.map(function(tab) {
|
{this.props.tabs.map(function(tab) {
|
||||||
return <li className={self.props.activeTab == tab.name ? 'active' : ''}><a href="#" onClick={function(){self.updateTab(tab.name);}}><i className={tab.icon}></i>{tab.ui_name}</a></li>
|
return <li key={tab.name+'_li'} className={self.props.activeTab == tab.name ? 'active' : ''}><a key={tab.name + '_a'} href="#" onClick={function(){self.updateTab(tab.name);}}><i key={tab.name+'_i'} className={tab.icon}></i>{tab.ui_name}</a></li>
|
||||||
})}
|
})}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -87,7 +87,8 @@ var NavbarDropdown = React.createClass({
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
teams.push(<li><a href={utils.getWindowLocationOrigin() + '/signup_team'}>Create a New Team</a></li>);
|
teams.push(<li key="newTeam_li"><a key="newTeam_a" href={utils.getWindowLocationOrigin() + "/signup_team" }>Create a New Team</a></li>);
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ul className='nav navbar-nav navbar-right'>
|
<ul className='nav navbar-nav navbar-right'>
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
var AppDispatcher = require('../dispatcher/app_dispatcher.jsx');
|
var AppDispatcher = require('../dispatcher/app_dispatcher.jsx');
|
||||||
var EventEmitter = require('events').EventEmitter;
|
var EventEmitter = require('events').EventEmitter;
|
||||||
var assign = require('object-assign');
|
var assign = require('object-assign');
|
||||||
var client = require('../utils/client.jsx');
|
|
||||||
|
|
||||||
var Constants = require('../utils/constants.jsx');
|
var Constants = require('../utils/constants.jsx');
|
||||||
var ActionTypes = Constants.ActionTypes;
|
var ActionTypes = Constants.ActionTypes;
|
||||||
@@ -73,24 +72,13 @@ var UserStore = assign({}, EventEmitter.prototype, {
|
|||||||
BrowserStore.setGlobalItem("current_user_id", id);
|
BrowserStore.setGlobalItem("current_user_id", id);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
getCurrentId: function(skipFetch) {
|
getCurrentId: function() {
|
||||||
var current_id = this._current_id;
|
var current_id = this._current_id;
|
||||||
|
|
||||||
if (current_id == null) {
|
if (current_id == null) {
|
||||||
current_id = BrowserStore.getGlobalItem("current_user_id");
|
current_id = BrowserStore.getGlobalItem("current_user_id");
|
||||||
}
|
}
|
||||||
|
|
||||||
// this is a speical case to force fetch the
|
|
||||||
// current user if it's missing
|
|
||||||
// it's synchronous to block rendering
|
|
||||||
if (current_id == null && !skipFetch) {
|
|
||||||
var me = client.getMeSynchronous();
|
|
||||||
if (me != null) {
|
|
||||||
this.setCurrentUser(me);
|
|
||||||
current_id = me.id;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return current_id;
|
return current_id;
|
||||||
},
|
},
|
||||||
getCurrentUser: function(skipFetch) {
|
getCurrentUser: function(skipFetch) {
|
||||||
|
|||||||
@@ -322,7 +322,7 @@ module.exports.getMe = function() {
|
|||||||
if (isCallInProgress("getMe")) return;
|
if (isCallInProgress("getMe")) return;
|
||||||
|
|
||||||
callTracker["getMe"] = utils.getTimestamp();
|
callTracker["getMe"] = utils.getTimestamp();
|
||||||
client.getMeSynchronous(
|
client.getMe(
|
||||||
function(data, textStatus, xhr) {
|
function(data, textStatus, xhr) {
|
||||||
callTracker["getMe"] = 0;
|
callTracker["getMe"] = 0;
|
||||||
|
|
||||||
|
|||||||
@@ -279,32 +279,24 @@ module.exports.getAudits = function(userId, success, error) {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports.getMeSynchronous = function(success, error) {
|
module.exports.getMe = function(success, error) {
|
||||||
|
|
||||||
var current_user = null;
|
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
async: false,
|
|
||||||
url: "/api/v1/users/me",
|
url: "/api/v1/users/me",
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
contentType: 'application/json',
|
contentType: 'application/json',
|
||||||
type: 'GET',
|
type: 'GET',
|
||||||
success: function(data, textStatus, xhr) {
|
success: success,
|
||||||
current_user = data;
|
|
||||||
if (success) success(data, textStatus, xhr);
|
|
||||||
},
|
|
||||||
error: function(xhr, status, err) {
|
error: function(xhr, status, err) {
|
||||||
var ieChecker = window.navigator.userAgent; // This and the condition below is used to check specifically for browsers IE10 & 11 to suppress a 200 'OK' error from appearing on login
|
var ieChecker = window.navigator.userAgent; // This and the condition below is used to check specifically for browsers IE10 & 11 to suppress a 200 'OK' error from appearing on login
|
||||||
if (xhr.status != 200 || !(ieChecker.indexOf("Trident/7.0") > 0 || ieChecker.indexOf("Trident/6.0") > 0)) {
|
if (xhr.status != 200 || !(ieChecker.indexOf("Trident/7.0") > 0 || ieChecker.indexOf("Trident/6.0") > 0)) {
|
||||||
if (error) {
|
if (error) {
|
||||||
e = handleError("getMeSynchronous", xhr, status, err);
|
e = handleError("getMe", xhr, status, err);
|
||||||
error(e);
|
error(e);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
return current_user;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports.inviteMembers = function(data, success, error) {
|
module.exports.inviteMembers = function(data, success, error) {
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user