Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix workspace system message when contains markdown isn't grayed out #37124

Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 0 additions & 13 deletions src/pages/home/report/ReportActionItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -483,19 +483,6 @@ function ReportActionItem(props) {
action={props.action}
displayAsGroup={props.displayAsGroup}
isHidden={isHidden}
style={[
_.contains(
[
..._.values(CONST.REPORT.ACTIONS.TYPE.POLICYCHANGELOG),
CONST.REPORT.ACTIONS.TYPE.IOU,
CONST.REPORT.ACTIONS.TYPE.APPROVED,
CONST.REPORT.ACTIONS.TYPE.MOVED,
],
props.action.actionName,
)
? styles.colorMuted
: undefined,
]}
/>
{hasBeenFlagged && (
<Button
Expand Down
14 changes: 13 additions & 1 deletion src/pages/home/report/ReportActionItemFragment.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import convertToLTR from '@libs/convertToLTR';
import * as ReportUtils from '@libs/ReportUtils';
import CONST from '@src/CONST';
import type * as OnyxCommon from '@src/types/onyx/OnyxCommon';
import type {DecisionName, OriginalMessageSource} from '@src/types/onyx/OriginalMessage';
import type {ActionName, DecisionName, OriginalMessageSource} from '@src/types/onyx/OriginalMessage';
import type {Message} from '@src/types/onyx/ReportAction';
import AttachmentCommentFragment from './comment/AttachmentCommentFragment';
import TextCommentFragment from './comment/TextCommentFragment';
Expand Down Expand Up @@ -59,11 +59,22 @@ type ReportActionItemFragmentProps = {
/** The pending action for the report action */
pendingAction?: OnyxCommon.PendingAction;

/** The report action name */
actionName?: ActionName;

moderationDecision?: DecisionName;
};

const MUTED_ACTIONS = [
...Object.values(CONST.REPORT.ACTIONS.TYPE.POLICYCHANGELOG),
CONST.REPORT.ACTIONS.TYPE.IOU,
CONST.REPORT.ACTIONS.TYPE.APPROVED,
CONST.REPORT.ACTIONS.TYPE.MOVED,
] as ActionName[];

function ReportActionItemFragment({
pendingAction,
actionName,
fragment,
accountID,
iouMessage = '',
Expand Down Expand Up @@ -114,6 +125,7 @@ function ReportActionItemFragment({
source={source}
fragment={fragment}
styleAsDeleted={!!(isOffline && isPendingDelete)}
styleAsMuted={!!actionName && MUTED_ACTIONS.includes(actionName)}
iouMessage={iouMessage}
displayAsGroup={displayAsGroup}
style={style}
Expand Down
2 changes: 2 additions & 0 deletions src/pages/home/report/ReportActionItemMessage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ function ReportActionItemMessage({action, displayAsGroup, reportID, style, isHid
style={style}
source=""
styleAsDeleted={false}
styleAsMuted={false}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we add a default value for this props? So we don't need to pass {fase} here and other places

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense, updated

/>
</View>
);
Expand Down Expand Up @@ -80,6 +81,7 @@ function ReportActionItemMessage({action, displayAsGroup, reportID, style, isHid
iouMessage={iouMessage}
isThreadParentMessage={ReportActionsUtils.isThreadParentMessage(action, reportID)}
pendingAction={action.pendingAction}
actionName={action.actionName}
source={(action.originalMessage as OriginalMessageAddComment['originalMessage'])?.source}
accountID={action.actorAccountID ?? 0}
style={style}
Expand Down
11 changes: 9 additions & 2 deletions src/pages/home/report/comment/TextCommentFragment.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ type TextCommentFragmentProps = {
/** Should this message fragment be styled as deleted? */
styleAsDeleted: boolean;

/** Should this message fragment be styled as muted */
styleAsMuted: boolean;

/** Should the comment have the appearance of being grouped with the previous comment? */
displayAsGroup: boolean;

Expand All @@ -37,7 +40,7 @@ type TextCommentFragmentProps = {
iouMessage?: string;
};

function TextCommentFragment({fragment, styleAsDeleted, source, style, displayAsGroup, iouMessage = ''}: TextCommentFragmentProps) {
function TextCommentFragment({fragment, styleAsDeleted, styleAsMuted, source, style, displayAsGroup, iouMessage = ''}: TextCommentFragmentProps) {
const theme = useTheme();
const styles = useThemeStyles();
const {html = '', text} = fragment;
Expand All @@ -54,7 +57,10 @@ function TextCommentFragment({fragment, styleAsDeleted, source, style, displayAs
const editedTag = fragment.isEdited ? `<edited ${styleAsDeleted ? 'deleted' : ''}></edited>` : '';
const htmlContent = styleAsDeleted ? `<del>${html}</del>` : html;

const htmlWithTag = editedTag ? `${htmlContent}${editedTag}` : htmlContent;
let htmlWithTag = editedTag ? `${htmlContent}${editedTag}` : htmlContent;
if (styleAsMuted) {
htmlWithTag = `<muted-text>${htmlWithTag}<muted-text>`;
}

return (
<RenderCommentHTML
Expand All @@ -79,6 +85,7 @@ function TextCommentFragment({fragment, styleAsDeleted, source, style, displayAs
styles.ltr,
style,
styleAsDeleted ? styles.offlineFeedback.deleted : undefined,
styleAsMuted ? styles.colorMuted : undefined,
!DeviceCapabilities.canUseTouchScreen() || !isSmallScreenWidth ? styles.userSelectText : styles.userSelectNone,
]}
>
Expand Down
Loading