Fix profiles issue with RHS
Этот коммит содержится в:
@@ -145,7 +145,7 @@ export default class PostsView extends React.Component {
|
|||||||
const postCtls = [];
|
const postCtls = [];
|
||||||
let previousPostDay = new Date(0);
|
let previousPostDay = new Date(0);
|
||||||
const userId = UserStore.getCurrentId();
|
const userId = UserStore.getCurrentId();
|
||||||
const profiles = this.props.profiles;
|
const profiles = this.props.profiles || {};
|
||||||
|
|
||||||
let renderedLastViewed = false;
|
let renderedLastViewed = false;
|
||||||
|
|
||||||
|
|||||||
@@ -109,6 +109,7 @@ export default class RhsThread extends React.Component {
|
|||||||
render() {
|
render() {
|
||||||
const posts = this.state.posts;
|
const posts = this.state.posts;
|
||||||
const selected = this.state.selected;
|
const selected = this.state.selected;
|
||||||
|
const profiles = this.state.profiles || {};
|
||||||
|
|
||||||
if (posts == null || selected == null) {
|
if (posts == null || selected == null) {
|
||||||
return (
|
return (
|
||||||
@@ -162,7 +163,7 @@ export default class RhsThread extends React.Component {
|
|||||||
if (UserStore.getCurrentId() === selected.user_id) {
|
if (UserStore.getCurrentId() === selected.user_id) {
|
||||||
profile = UserStore.getCurrentUser();
|
profile = UserStore.getCurrentUser();
|
||||||
} else {
|
} else {
|
||||||
profile = this.state.profiles[selected.user_id];
|
profile = profiles[selected.user_id];
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -187,7 +188,7 @@ export default class RhsThread extends React.Component {
|
|||||||
if (UserStore.getCurrentId() === selected.user_id) {
|
if (UserStore.getCurrentId() === selected.user_id) {
|
||||||
p = UserStore.getCurrentUser();
|
p = UserStore.getCurrentUser();
|
||||||
} else {
|
} else {
|
||||||
p = this.state.profiles[selected.user_id];
|
p = profiles[selected.user_id];
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<Comment
|
<Comment
|
||||||
|
|||||||
@@ -40,12 +40,14 @@ export default class SearchResults extends React.Component {
|
|||||||
this.mounted = false;
|
this.mounted = false;
|
||||||
|
|
||||||
this.onChange = this.onChange.bind(this);
|
this.onChange = this.onChange.bind(this);
|
||||||
|
this.onUserChange = this.onUserChange.bind(this);
|
||||||
this.resize = this.resize.bind(this);
|
this.resize = this.resize.bind(this);
|
||||||
this.handleResize = this.handleResize.bind(this);
|
this.handleResize = this.handleResize.bind(this);
|
||||||
|
|
||||||
const state = getStateFromStores();
|
const state = getStateFromStores();
|
||||||
state.windowWidth = Utils.windowWidth();
|
state.windowWidth = Utils.windowWidth();
|
||||||
state.windowHeight = Utils.windowHeight();
|
state.windowHeight = Utils.windowHeight();
|
||||||
|
state.profiles = JSON.parse(JSON.stringify(UserStore.getProfiles()));
|
||||||
this.state = state;
|
this.state = state;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -53,6 +55,7 @@ export default class SearchResults extends React.Component {
|
|||||||
this.mounted = true;
|
this.mounted = true;
|
||||||
SearchStore.addSearchChangeListener(this.onChange);
|
SearchStore.addSearchChangeListener(this.onChange);
|
||||||
ChannelStore.addChangeListener(this.onChange);
|
ChannelStore.addChangeListener(this.onChange);
|
||||||
|
UserStore.addChangeListener(this.onUserChange);
|
||||||
this.resize();
|
this.resize();
|
||||||
window.addEventListener('resize', this.handleResize);
|
window.addEventListener('resize', this.handleResize);
|
||||||
}
|
}
|
||||||
@@ -68,6 +71,7 @@ export default class SearchResults extends React.Component {
|
|||||||
componentWillUnmount() {
|
componentWillUnmount() {
|
||||||
SearchStore.removeSearchChangeListener(this.onChange);
|
SearchStore.removeSearchChangeListener(this.onChange);
|
||||||
ChannelStore.removeChangeListener(this.onChange);
|
ChannelStore.removeChangeListener(this.onChange);
|
||||||
|
UserStore.removeChangeListener(this.onUserChange);
|
||||||
this.mounted = false;
|
this.mounted = false;
|
||||||
window.removeEventListener('resize', this.handleResize);
|
window.removeEventListener('resize', this.handleResize);
|
||||||
}
|
}
|
||||||
@@ -85,6 +89,10 @@ export default class SearchResults extends React.Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onUserChange() {
|
||||||
|
this.setState({profiles: JSON.parse(JSON.stringify(UserStore.getProfiles()))});
|
||||||
|
}
|
||||||
|
|
||||||
resize() {
|
resize() {
|
||||||
$('#search-items-container').scrollTop(0);
|
$('#search-items-container').scrollTop(0);
|
||||||
if (this.state.windowWidth > 768) {
|
if (this.state.windowWidth > 768) {
|
||||||
@@ -101,6 +109,7 @@ export default class SearchResults extends React.Component {
|
|||||||
}
|
}
|
||||||
var noResults = (!results || !results.order || !results.order.length);
|
var noResults = (!results || !results.order || !results.order.length);
|
||||||
var searchTerm = SearchStore.getSearchTerm();
|
var searchTerm = SearchStore.getSearchTerm();
|
||||||
|
const profiles = this.state.profiles || {};
|
||||||
|
|
||||||
var ctls = null;
|
var ctls = null;
|
||||||
|
|
||||||
@@ -140,6 +149,7 @@ export default class SearchResults extends React.Component {
|
|||||||
key={post.id}
|
key={post.id}
|
||||||
channel={this.state.channels.get(post.channel_id)}
|
channel={this.state.channels.get(post.channel_id)}
|
||||||
post={post}
|
post={post}
|
||||||
|
user={profiles[post.user_id]}
|
||||||
term={searchTerm}
|
term={searchTerm}
|
||||||
isMentionSearch={this.props.isMentionSearch}
|
isMentionSearch={this.props.isMentionSearch}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -36,9 +36,10 @@ export default class SearchResultsItem extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
var channelName = null;
|
let channelName = null;
|
||||||
const channel = this.props.channel;
|
const channel = this.props.channel;
|
||||||
var timestamp = UserStore.getCurrentUser().update_at;
|
const timestamp = UserStore.getCurrentUser().update_at;
|
||||||
|
const user = this.props.user || {};
|
||||||
|
|
||||||
if (channel) {
|
if (channel) {
|
||||||
channelName = channel.display_name;
|
channelName = channel.display_name;
|
||||||
@@ -84,7 +85,7 @@ export default class SearchResultsItem extends React.Component {
|
|||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<ul className='post__header'>
|
<ul className='post__header'>
|
||||||
<li className='col__name'><strong><UserProfile userId={this.props.post.user_id}/></strong></li>
|
<li className='col__name'><strong><UserProfile user={user}/></strong></li>
|
||||||
<li className='col'>
|
<li className='col'>
|
||||||
<time className='search-item-time'>
|
<time className='search-item-time'>
|
||||||
<FormattedDate
|
<FormattedDate
|
||||||
@@ -135,6 +136,7 @@ export default class SearchResultsItem extends React.Component {
|
|||||||
|
|
||||||
SearchResultsItem.propTypes = {
|
SearchResultsItem.propTypes = {
|
||||||
post: React.PropTypes.object,
|
post: React.PropTypes.object,
|
||||||
|
user: React.PropTypes.object,
|
||||||
channel: React.PropTypes.object,
|
channel: React.PropTypes.object,
|
||||||
isMentionSearch: React.PropTypes.bool,
|
isMentionSearch: React.PropTypes.bool,
|
||||||
term: React.PropTypes.string
|
term: React.PropTypes.string
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user