Finally fixed the git weirdness
Этот коммит содержится в:
@@ -324,13 +324,7 @@ module.exports = React.createClass({
|
|||||||
if (order.length > 0 && order.length % Constants.POST_CHUNK_SIZE === 0) {
|
if (order.length > 0 && order.length % Constants.POST_CHUNK_SIZE === 0) {
|
||||||
more_messages = <a ref="loadmore" className="more-messages-text theme" href="#" onClick={this.getMorePosts}>Load more messages</a>;
|
more_messages = <a ref="loadmore" className="more-messages-text theme" href="#" onClick={this.getMorePosts}>Load more messages</a>;
|
||||||
} else if (channel.type === 'D') {
|
} else if (channel.type === 'D') {
|
||||||
var userIds = channel.name.split('__');
|
var teammate = utils.getDirectTeammate(channel.id)
|
||||||
var teammate;
|
|
||||||
if (userIds.length === 2 && userIds[0] === user_id) {
|
|
||||||
teammate = UserStore.getProfile(userIds[1]);
|
|
||||||
} else if (userIds.length === 2 && userIds[1] === user_id) {
|
|
||||||
teammate = UserStore.getProfile(userIds[0]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (teammate) {
|
if (teammate) {
|
||||||
var teammate_name = teammate.full_name.length > 0 ? teammate.full_name : teammate.username;
|
var teammate_name = teammate.full_name.length > 0 ? teammate.full_name : teammate.username;
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ SearchItem = React.createClass({
|
|||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
client.getPost(
|
client.getPost(
|
||||||
this.props.post.channel_id,
|
this.props.post.channel_id,
|
||||||
this.props.post.id,
|
this.props.post.id,
|
||||||
@@ -64,6 +65,11 @@ SearchItem = React.createClass({
|
|||||||
dispatchError(err, "getPost");
|
dispatchError(err, "getPost");
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
var postChannel = ChannelStore.get(this.props.post.channel_id);
|
||||||
|
var teammate = postChannel.type === 'D' ? utils.getDirectTeammate(this.props.post.channel_id).username : "";
|
||||||
|
|
||||||
|
utils.switchChannel(postChannel,teammate);
|
||||||
},
|
},
|
||||||
render: function() {
|
render: function() {
|
||||||
|
|
||||||
|
|||||||
@@ -269,13 +269,8 @@ var SidebarLoggedIn = React.createClass({
|
|||||||
var channel = ChannelStore.getCurrent();
|
var channel = ChannelStore.getCurrent();
|
||||||
if (channel) {
|
if (channel) {
|
||||||
if (channel.type === 'D') {
|
if (channel.type === 'D') {
|
||||||
userIds = channel.name.split('__');
|
var teammate_username = utils.getDirectTeammate(channel.id).username
|
||||||
if (userIds.length < 2) return;
|
document.title = teammate_username + " " + document.title.substring(document.title.lastIndexOf("-"));
|
||||||
if (userIds[0] == UserStore.getCurrentId() && UserStore.getProfile(userIds[1])) {
|
|
||||||
document.title = UserStore.getProfile(userIds[1]).username + " " + document.title.substring(document.title.lastIndexOf("-"));
|
|
||||||
} else if (userIds[1] == UserStore.getCurrentId() && UserStore.getProfile(userIds[0])) {
|
|
||||||
document.title = UserStore.getProfile(userIds[0]).username + " " + document.title.substring(document.title.lastIndexOf("-"));
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
document.title = channel.display_name + " " + document.title.substring(document.title.lastIndexOf("-"))
|
document.title = channel.display_name + " " + document.title.substring(document.title.lastIndexOf("-"))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
// See License.txt for license information.
|
// See License.txt for license information.
|
||||||
|
|
||||||
var AppDispatcher = require('../dispatcher/app_dispatcher.jsx');
|
var AppDispatcher = require('../dispatcher/app_dispatcher.jsx');
|
||||||
|
var ChannelStore = require('../stores/channel_store.jsx')
|
||||||
var UserStore = require('../stores/user_store.jsx');
|
var UserStore = require('../stores/user_store.jsx');
|
||||||
var Constants = require('../utils/constants.jsx');
|
var Constants = require('../utils/constants.jsx');
|
||||||
var ActionTypes = Constants.ActionTypes;
|
var ActionTypes = Constants.ActionTypes;
|
||||||
@@ -726,6 +727,23 @@ module.exports.isComment = function(post) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
module.exports.getDirectTeammate = function(channel_id) {
|
||||||
|
var userIds = ChannelStore.get(channel_id).name.split('__');
|
||||||
|
|
||||||
|
if(userIds.length != 2) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var curUser = UserStore.getCurrentId();
|
||||||
|
|
||||||
|
for(var idx in userIds) {
|
||||||
|
if(userIds[idx] === curUser)
|
||||||
|
delete userIds[idx];
|
||||||
|
}
|
||||||
|
|
||||||
|
return UserStore.getProfile(userIds[0])
|
||||||
|
}
|
||||||
|
|
||||||
Image.prototype.load = function(url, progressCallback) {
|
Image.prototype.load = function(url, progressCallback) {
|
||||||
var thisImg = this;
|
var thisImg = this;
|
||||||
var xmlHTTP = new XMLHttpRequest();
|
var xmlHTTP = new XMLHttpRequest();
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user