Allow user to mark post as unread that was posted by a webhook (#7016) (#7039)

* Allow user to mark post as unread that was posted by a webhook

* feedback review

(cherry picked from commit 34aef73ac1)

Co-authored-by: Elias Nahum <nahumhbl@gmail.com>
This commit is contained in:
Mattermost Build 2023-01-27 18:58:15 +02:00 committed by GitHub
parent c77f1dbd6d
commit e6a1cbb2aa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -19,7 +19,7 @@ import {observeIsCRTEnabled, observeThreadById} from '@queries/servers/thread';
import {observeCurrentUser} from '@queries/servers/user';
import {toMilliseconds} from '@utils/datetime';
import {isMinimumServerVersion} from '@utils/helpers';
import {isSystemMessage} from '@utils/post';
import {isFromWebhook, isSystemMessage} from '@utils/post';
import {getPostIdsForCombinedUserActivityPost} from '@utils/post_list';
import {isSystemAdmin} from '@utils/user';
@ -134,7 +134,11 @@ const enhanced = withObservables([], ({combinedPost, post, showAddReaction, loca
);
const canMarkAsUnread = combineLatest([currentUser, channelIsArchived]).pipe(
switchMap(([user, isArchived]) => of$(!isArchived && user?.id !== post.userId && !isSystemMessage(post))),
switchMap(([user, isArchived]) => of$(
!isArchived && (
(user?.id !== post.userId && !isSystemMessage(post)) || isFromWebhook(post)
),
)),
);
const canAddReaction = combineLatest([hasAddReactionPermission, channelIsReadOnly, isUnderMaxAllowedReactions, channelIsArchived]).pipe(