-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Format whispers/welcome messages in the report action list of each chat #17527
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
Changes from all commits
c4b7c3d
8d59ce9
51fb7e4
1ed1046
621d79f
12f3c99
73919c7
e5aa976
46bd44c
ebc3534
d6e54cc
8c26440
503e0c3
2d4a524
21745be
a7b28fd
e7d4dad
b916bb6
c405a2f
64e5b04
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -24,7 +24,12 @@ import * as DeviceCapabilities from '../../../libs/DeviceCapabilities'; | |
| import MiniReportActionContextMenu from './ContextMenu/MiniReportActionContextMenu'; | ||
| import * as ReportActionContextMenu from './ContextMenu/ReportActionContextMenu'; | ||
| import * as ContextMenuActions from './ContextMenu/ContextMenuActions'; | ||
| import {withBlockedFromConcierge, withNetwork, withReportActionsDrafts} from '../../../components/OnyxProvider'; | ||
| import { | ||
| withBlockedFromConcierge, | ||
| withNetwork, | ||
| withPersonalDetails, | ||
| withReportActionsDrafts, | ||
| } from '../../../components/OnyxProvider'; | ||
| import RenameAction from '../../../components/ReportActionItem/RenameAction'; | ||
| import InlineSystemMessage from '../../../components/InlineSystemMessage'; | ||
| import styles from '../../../styles/styles'; | ||
|
|
@@ -40,6 +45,11 @@ import ChronosOOOListActions from '../../../components/ReportActionItem/ChronosO | |
| import ReportActionItemReactions from '../../../components/Reactions/ReportActionItemReactions'; | ||
| import * as Report from '../../../libs/actions/Report'; | ||
| import withLocalize from '../../../components/withLocalize'; | ||
| import Icon from '../../../components/Icon'; | ||
| import * as Expensicons from '../../../components/Icon/Expensicons'; | ||
| import Text from '../../../components/Text'; | ||
| import DisplayNames from '../../../components/DisplayNames'; | ||
| import personalDetailsPropType from '../../personalDetailsPropType'; | ||
|
|
||
| const propTypes = { | ||
| /** Report for this action */ | ||
|
|
@@ -69,13 +79,17 @@ const propTypes = { | |
| /** Stores user's preferred skin tone */ | ||
| preferredSkinTone: PropTypes.oneOfType([PropTypes.number, PropTypes.string]), | ||
|
|
||
| /** All of the personalDetails */ | ||
| personalDetails: PropTypes.objectOf(personalDetailsPropType), | ||
|
|
||
| ...windowDimensionsPropTypes, | ||
| }; | ||
|
|
||
| const defaultProps = { | ||
| draftMessage: '', | ||
| hasOutstandingIOU: false, | ||
| preferredSkinTone: CONST.EMOJI_DEFAULT_SKIN_TONE, | ||
| personalDetails: {}, | ||
| }; | ||
|
|
||
| class ReportActionItem extends Component { | ||
|
|
@@ -100,7 +114,8 @@ class ReportActionItem extends Component { | |
| || !_.isEqual(this.props.action, nextProps.action) | ||
| || this.state.isContextMenuActive !== nextState.isContextMenuActive | ||
| || lodashGet(this.props.report, 'statusNum') !== lodashGet(nextProps.report, 'statusNum') | ||
| || lodashGet(this.props.report, 'stateNum') !== lodashGet(nextProps.report, 'stateNum'); | ||
| || lodashGet(this.props.report, 'stateNum') !== lodashGet(nextProps.report, 'stateNum') | ||
| || this.props.translate !== nextProps.translate; | ||
| } | ||
|
|
||
| componentDidUpdate(prevProps) { | ||
|
|
@@ -239,6 +254,13 @@ class ReportActionItem extends Component { | |
| if (this.props.action.actionName === CONST.REPORT.ACTIONS.TYPE.CHRONOSOOOLIST) { | ||
| return <ChronosOOOListActions action={this.props.action} reportID={this.props.report.reportID} />; | ||
| } | ||
|
|
||
| const whisperedTo = lodashGet(this.props.action, 'whisperedTo', []); | ||
| const isWhisper = whisperedTo.length > 0; | ||
| const isMultipleParticipant = whisperedTo.length > 1; | ||
| const isWhisperOnlyVisibleByUser = isWhisper && ReportUtils.isCurrentUserTheOnlyParticipant(whisperedTo); | ||
| const whisperedToPersonalDetails = isWhisper ? _.filter(this.props.personalDetails, details => _.includes(whisperedTo, details.login)) : []; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. NAB: You might want to be careful with this line. I believe that I'd prefer to always keep personalDetails an object.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Typescript won't allow this 😄 |
||
| const displayNamesWithTooltips = isWhisper ? ReportUtils.getDisplayNamesWithTooltips(whisperedToPersonalDetails, isMultipleParticipant) : []; | ||
| return ( | ||
| <PressableWithSecondaryInteraction | ||
| pointerEvents={this.props.action.pendingAction === CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE ? 'none' : 'auto'} | ||
|
|
@@ -258,6 +280,7 @@ class ReportActionItem extends Component { | |
| <View | ||
| style={StyleUtils.getReportActionItemStyle( | ||
| hovered | ||
| || isWhisper | ||
|
pecanoro marked this conversation as resolved.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hi, this is out of scope of this PR but we caused this issue - #20451 (comment) On native, the "New" message maker is hidden behind the whisper message because it's not transparent. |
||
| || this.state.isContextMenuActive | ||
| || this.props.draftMessage, | ||
| (this.props.network.isOffline && this.props.action.isLoading) || this.props.action.error, | ||
|
|
@@ -276,14 +299,37 @@ class ReportActionItem extends Component { | |
| errorRowStyles={[styles.ml10, styles.mr2]} | ||
| needsOffscreenAlphaCompositing={this.props.action.actionName === CONST.REPORT.ACTIONS.TYPE.IOU} | ||
| > | ||
| {isWhisper && ( | ||
| <View style={[styles.flexRow, styles.pl5, styles.pt2]}> | ||
| <View style={[styles.pl6, styles.mr3]}> | ||
| <Icon src={Expensicons.Eye} small /> | ||
| </View> | ||
| <Text style={[styles.chatItemMessageHeaderTimestamp]}> | ||
| {this.props.translate('reportActionContextMenu.onlyVisible')} | ||
| | ||
| </Text> | ||
| <DisplayNames | ||
| fullTitle={ReportUtils.getWhisperDisplayNames(whisperedTo)} | ||
| displayNamesWithTooltips={displayNamesWithTooltips} | ||
| tooltipEnabled | ||
| numberOfLines={1} | ||
| textStyles={[styles.chatItemMessageHeaderTimestamp]} | ||
| shouldUseFullTitle={isWhisperOnlyVisibleByUser} | ||
| /> | ||
|
pecanoro marked this conversation as resolved.
|
||
| </View> | ||
| )} | ||
| {!this.props.displayAsGroup | ||
| ? ( | ||
| <ReportActionItemSingle action={this.props.action} showHeader={!this.props.draftMessage}> | ||
| <ReportActionItemSingle | ||
| action={this.props.action} | ||
| showHeader={!this.props.draftMessage} | ||
| wrapperStyles={[styles.chatItem, isWhisper ? styles.pt1 : {}]} | ||
| > | ||
| {this.renderItemContent(hovered || this.state.isContextMenuActive)} | ||
| </ReportActionItemSingle> | ||
| ) | ||
| : ( | ||
| <ReportActionItemGrouped> | ||
| <ReportActionItemGrouped wrapperStyles={[styles.chatItem, isWhisper ? styles.pt1 : {}]}> | ||
| {this.renderItemContent(hovered || this.state.isContextMenuActive)} | ||
| </ReportActionItemGrouped> | ||
| )} | ||
|
|
@@ -318,6 +364,7 @@ export default compose( | |
| withWindowDimensions, | ||
| withLocalize, | ||
| withNetwork(), | ||
| withPersonalDetails(), | ||
| withBlockedFromConcierge({propName: 'blockedFromConcierge'}), | ||
| withReportActionsDrafts({ | ||
| propName: 'draftMessage', | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -370,6 +370,10 @@ export default { | |
| paddingLeft: 20, | ||
| }, | ||
|
|
||
| pl6: { | ||
| paddingLeft: 24, | ||
| }, | ||
|
|
||
| pl10: { | ||
| paddingLeft: 40, | ||
| }, | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.