MM-56071: Track multiple threads (#25775)
We can have 2 types of threads open at the same time. One from the thread view, and another from RHS. We add another variable to distinguish between the 2 states. In future, if we have the ability for more than 2 threads, then we would need to track by threadID. https://mattermost.atlassian.net/browse/MM-56071 ```release-note NONE ```
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
3f2351c71f
Коммит
7dcf5f85a5
@@ -67,6 +67,7 @@ describe('components/threading/ThreadViewer', () => {
|
||||
postIds: [post.id],
|
||||
appsEnabled: true,
|
||||
rootPostId: post.id,
|
||||
isThreadView: true,
|
||||
};
|
||||
|
||||
test('should match snapshot', async () => {
|
||||
|
||||
@@ -49,7 +49,7 @@ export type Props = Attrs & {
|
||||
postIds: string[];
|
||||
highlightedPostId?: Post['id'];
|
||||
selectedPostFocusedAt?: number;
|
||||
isThreadView?: boolean;
|
||||
isThreadView: boolean;
|
||||
inputPlaceholder?: string;
|
||||
rootPostId: string;
|
||||
fromSuppressed?: boolean;
|
||||
@@ -81,7 +81,7 @@ export default class ThreadViewer extends React.PureComponent<Props, State> {
|
||||
}
|
||||
|
||||
public componentWillUnmount() {
|
||||
WebSocketClient.updateActiveThread('');
|
||||
WebSocketClient.updateActiveThread(this.props.isThreadView, '');
|
||||
}
|
||||
|
||||
public componentDidUpdate(prevProps: Props) {
|
||||
@@ -184,7 +184,7 @@ export default class ThreadViewer extends React.PureComponent<Props, State> {
|
||||
}
|
||||
|
||||
if (this.props.channel) {
|
||||
WebSocketClient.updateActiveThread(this.props.channel?.id);
|
||||
WebSocketClient.updateActiveThread(this.props.isThreadView, this.props.channel?.id);
|
||||
}
|
||||
this.setState({isLoading: false});
|
||||
};
|
||||
|
||||
@@ -396,9 +396,10 @@ export default class WebSocketClient {
|
||||
this.sendMessage('presence', data, callback);
|
||||
}
|
||||
|
||||
updateActiveThread(channelId: string, callback?: (msg: any) => void) {
|
||||
updateActiveThread(isThreadView: boolean, channelId: string, callback?: (msg: any) => void) {
|
||||
const data = {
|
||||
thread_channel_id: channelId,
|
||||
is_thread_view: isThreadView,
|
||||
};
|
||||
this.sendMessage('presence', data, callback);
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user