MM-53506 Fixed duplicated command response in thread/channel (#23969) (#30310)

- Ephemeral system answers from commands in threads are also posted in parent channel
- Removed an obsolete condition that provoked the bug
Этот коммит содержится в:
Clément Collin
2025-03-10 10:42:40 +01:00
коммит произвёл GitHub
родитель 5fe7c36457
Коммит dd258f5ee5
2 изменённых файлов: 18 добавлений и 2 удалений

Просмотреть файл

@@ -722,6 +722,23 @@ describe('postsInChannel', () => {
});
});
it('should do nothing when a reply-post comes and CRT is ON, even if ephemeral', () => {
const state = deepFreeze({
channel1: [],
});
const nextState = reducers.postsInChannel(state, {
type: PostTypes.RECEIVED_NEW_POST,
data: {id: 'post1', channel_id: 'channel1', root_id: 'parent1', type: 'system_ephemeral'},
features: {crtEnabled: true},
}, {}, {});
expect(nextState).toBe(state);
expect(nextState).toEqual({
channel1: [],
});
});
it('should reset when called for (e.g. when CRT is TOGGLED)', () => {
const state = deepFreeze({
channel1: [],

Просмотреть файл

@@ -22,7 +22,6 @@ import type {
import type {MMReduxAction} from 'mattermost-redux/action_types';
import {ChannelTypes, PostTypes, UserTypes, ThreadTypes, CloudTypes} from 'mattermost-redux/action_types';
import {Posts} from 'mattermost-redux/constants';
import {PostTypes as PostConstant} from 'mattermost-redux/constants/posts';
import {comparePosts, isPermalink, shouldUpdatePost} from 'mattermost-redux/utils/post_utils';
export function removeUnneededMetadata(post: Post) {
@@ -472,7 +471,7 @@ export function postsInChannel(state: Record<string, PostOrderBlock[]> = {}, act
case PostTypes.RECEIVED_NEW_POST: {
const post = action.data as Post;
if (action.features?.crtEnabled && post.root_id && post.type !== PostConstant.EPHEMERAL) {
if (action.features?.crtEnabled && post.root_id) {
return state;
}