fix incorrect call for AsyncClient.dispatchError
Этот коммит содержится в:
@@ -8,12 +8,13 @@ var UserStore = require('../stores/user_store.jsx');
|
||||
var UserProfile = require( './user_profile.jsx' );
|
||||
var SearchBox =require('./search_bar.jsx');
|
||||
var utils = require('../utils/utils.jsx');
|
||||
var client =require('../utils/client.jsx');
|
||||
var client = require('../utils/client.jsx');
|
||||
var AsyncClient = require('../utils/async_client.jsx');
|
||||
var AppDispatcher = require('../dispatcher/app_dispatcher.jsx');
|
||||
var Constants = require('../utils/constants.jsx');
|
||||
var ActionTypes = Constants.ActionTypes;
|
||||
|
||||
RhsHeaderSearch = React.createClass({
|
||||
var RhsHeaderSearch = React.createClass({
|
||||
handleClose: function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
@@ -32,13 +33,13 @@ RhsHeaderSearch = React.createClass({
|
||||
return (
|
||||
<div className="sidebar--right__header">
|
||||
<span className="sidebar--right__title">{title}</span>
|
||||
<button type="button" className="sidebar--right__close" aria-label="Close" onClick={this.handleClose}></button>
|
||||
<button type="button" className="sidebar--right__close" aria-label="Close" title="Close" onClick={this.handleClose}></button>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
SearchItem = React.createClass({
|
||||
var SearchItem = React.createClass({
|
||||
handleClick: function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
@@ -62,15 +63,16 @@ SearchItem = React.createClass({
|
||||
});
|
||||
},
|
||||
function(err) {
|
||||
dispatchError(err, "getPost");
|
||||
AsyncClient.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 : "";
|
||||
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);
|
||||
utils.switchChannel(postChannel, teammate);
|
||||
},
|
||||
|
||||
render: function() {
|
||||
|
||||
var message = utils.textToJsx(this.props.post.message, {searchTerm: this.props.term, noMentionHighlight: !this.props.isMentionSearch});
|
||||
@@ -79,14 +81,10 @@ SearchItem = React.createClass({
|
||||
var timestamp = UserStore.getCurrentUser().update_at;
|
||||
|
||||
if (channel) {
|
||||
if (channel.type === 'D') {
|
||||
channelName = "Private Message";
|
||||
} else {
|
||||
channelName = channel.display_name;
|
||||
}
|
||||
channelName = (channel.type === 'D') ? "Private Message" : channel.display_name;
|
||||
}
|
||||
|
||||
return (
|
||||
return (
|
||||
<div className="search-item-container post" onClick={this.handleClick}>
|
||||
<div className="search-channel__name">{ channelName }</div>
|
||||
<div className="post-profile-img__container">
|
||||
@@ -95,7 +93,11 @@ SearchItem = React.createClass({
|
||||
<div className="post__content">
|
||||
<ul className="post-header">
|
||||
<li className="post-header-col"><strong><UserProfile userId={this.props.post.user_id} /></strong></li>
|
||||
<li className="post-header-col"><time className="search-item-time">{ utils.displayDate(this.props.post.create_at)+' '+utils.displayTime(this.props.post.create_at) }</time></li>
|
||||
<li className="post-header-col">
|
||||
<time className="search-item-time">
|
||||
{ utils.displayDate(this.props.post.create_at) + ' ' + utils.displayTime(this.props.post.create_at) }
|
||||
</time>
|
||||
</li>
|
||||
</ul>
|
||||
<div className="search-item-snippet"><span>{message}</span></div>
|
||||
</div>
|
||||
@@ -104,11 +106,13 @@ SearchItem = React.createClass({
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
function getStateFromStores() {
|
||||
return { results: PostStore.getSearchResults() };
|
||||
}
|
||||
|
||||
module.exports = React.createClass({
|
||||
displayName: 'SearchResults',
|
||||
componentDidMount: function() {
|
||||
PostStore.addSearchChangeListener(this._onChange);
|
||||
this.resize();
|
||||
@@ -144,41 +148,24 @@ module.exports = React.createClass({
|
||||
|
||||
var results = this.state.results;
|
||||
var currentId = UserStore.getCurrentId();
|
||||
var searchForm = currentId == null ? null : <SearchBox />;
|
||||
var searchForm = currentId ? <SearchBox /> : null;
|
||||
var noResults = (!results || !results.order || !results.order.length);
|
||||
var searchTerm = PostStore.getSearchTerm();
|
||||
|
||||
if (results == null) {
|
||||
return (
|
||||
<div className="sidebar--right__header">
|
||||
<div className="sidebar__heading">Search Results</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
if (!results.order || results.order.length == 0) {
|
||||
return (
|
||||
<div className="sidebar--right__content">
|
||||
<div className="search-bar__container">{searchForm}</div>
|
||||
<div className="sidebar-right__body">
|
||||
<RhsHeaderSearch />
|
||||
<div id="search-items-container" className="search-items-container">
|
||||
<div className="sidebar--right__subheader">No results</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
var self = this;
|
||||
return (
|
||||
<div className="sidebar--right__content">
|
||||
<div className="search-bar__container sidebar--right__search-header">{searchForm}</div>
|
||||
<div className="sidebar-right__body">
|
||||
<RhsHeaderSearch isMentionSearch={this.props.isMentionSearch} />
|
||||
<div id="search-items-container" className="search-items-container">
|
||||
{results.order.map(function(id) {
|
||||
var post = results.posts[id];
|
||||
return <SearchItem key={post.id} post={post} term={PostStore.getSearchTerm()} isMentionSearch={self.props.isMentionSearch} />
|
||||
})}
|
||||
|
||||
{ noResults ? <div className="sidebar--right__subheader">No results</div>
|
||||
: results.order.map(function(id) {
|
||||
var post = results.posts[id];
|
||||
return <SearchItem key={post.id} post={post} term={searchTerm} isMentionSearch={this.props.isMentionSearch} />
|
||||
}, this)
|
||||
}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Ссылка в новой задаче
Block a user