Fix channel autocomplete and fix channel member query to ignore deleted channels (#4371)
Этот коммит содержится в:
коммит произвёл
Corey Hulen
родитель
fcf7d185f6
Коммит
ef363fd88e
@@ -1040,6 +1040,7 @@ func (s SqlChannelStore) GetMembersForUser(teamId string, userId string) StoreCh
|
|||||||
INNER JOIN Channels c
|
INNER JOIN Channels c
|
||||||
ON c.Id = cm.ChannelId
|
ON c.Id = cm.ChannelId
|
||||||
AND (c.TeamId = :TeamId OR c.TeamId = '')
|
AND (c.TeamId = :TeamId OR c.TeamId = '')
|
||||||
|
AND c.DeleteAt = 0
|
||||||
WHERE cm.UserId = :UserId
|
WHERE cm.UserId = :UserId
|
||||||
`, map[string]interface{}{"TeamId": teamId, "UserId": userId})
|
`, map[string]interface{}{"TeamId": teamId, "UserId": userId})
|
||||||
|
|
||||||
|
|||||||
@@ -31,10 +31,12 @@ export default class MoreChannels extends React.Component {
|
|||||||
|
|
||||||
this.shouldComponentUpdate = PureRenderMixin.shouldComponentUpdate.bind(this);
|
this.shouldComponentUpdate = PureRenderMixin.shouldComponentUpdate.bind(this);
|
||||||
|
|
||||||
const initState = this.getStateFromStores();
|
this.state = {
|
||||||
initState.channelType = '';
|
channelType: '',
|
||||||
initState.showNewChannelModal = false;
|
showNewChannelModal: false,
|
||||||
this.state = initState;
|
channels: null,
|
||||||
|
serverError: null
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
@@ -140,31 +142,28 @@ export default class MoreChannels extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let moreChannels;
|
let moreChannels;
|
||||||
|
const channels = this.state.channels;
|
||||||
if (this.state.channels != null) {
|
if (channels == null) {
|
||||||
var channels = this.state.channels;
|
moreChannels = <LoadingScreen/>;
|
||||||
if (channels.loading) {
|
} else if (channels.length) {
|
||||||
moreChannels = <LoadingScreen/>;
|
moreChannels = (
|
||||||
} else if (channels.length) {
|
<FilteredChannelList
|
||||||
moreChannels = (
|
channels={channels}
|
||||||
<FilteredChannelList
|
handleJoin={this.handleJoin}
|
||||||
channels={channels}
|
/>
|
||||||
handleJoin={this.handleJoin}
|
);
|
||||||
/>
|
} else {
|
||||||
);
|
moreChannels = (
|
||||||
} else {
|
<div className='no-channel-message'>
|
||||||
moreChannels = (
|
<p className='primary-message'>
|
||||||
<div className='no-channel-message'>
|
<FormattedMessage
|
||||||
<p className='primary-message'>
|
id='more_channels.noMore'
|
||||||
<FormattedMessage
|
defaultMessage='No more channels to join'
|
||||||
id='more_channels.noMore'
|
/>
|
||||||
defaultMessage='No more channels to join'
|
</p>
|
||||||
/>
|
{createChannelHelpText}
|
||||||
</p>
|
</div>
|
||||||
{createChannelHelpText}
|
);
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -26,7 +26,6 @@ class ChannelStoreClass extends EventEmitter {
|
|||||||
this.channels = [];
|
this.channels = [];
|
||||||
this.myChannelMembers = {};
|
this.myChannelMembers = {};
|
||||||
this.moreChannels = {};
|
this.moreChannels = {};
|
||||||
this.moreChannels.loading = true;
|
|
||||||
this.stats = {};
|
this.stats = {};
|
||||||
this.unreadCounts = {};
|
this.unreadCounts = {};
|
||||||
}
|
}
|
||||||
@@ -300,13 +299,7 @@ class ChannelStoreClass extends EventEmitter {
|
|||||||
const ch = this.get(id);
|
const ch = this.get(id);
|
||||||
const chMember = this.getMyMember(id);
|
const chMember = this.getMyMember(id);
|
||||||
|
|
||||||
if (ch == null) {
|
if (ch == null || chMember == null) {
|
||||||
console.log('setUnreadCountByChannel: missing channel id ' + id); //eslint-disable-line no-console
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (chMember == null) {
|
|
||||||
console.log('setUnreadCountByChannel: missing channel member for channel id ' + id); //eslint-disable-line no-console
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user