-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Issue 28059 fix emoji reactions in offline mode #28519
Merged
srikarparsi
merged 6 commits into
Expensify:main
from
abdel-h66:issue-28059-fix-emoji-reactions-in-offline-mode
Oct 4, 2023
Merged
Changes from 5 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
5a7af6f
Adds pending actions to the AddEmojiReaction
abdel-h66 be169e4
Uses OfflineWithFeedback to display emojis with pending add actions
abdel-h66 de97cdc
Fixes prettier issues
abdel-h66 ec32b85
Disables opacity on emojis when the action has a pending action
abdel-h66 3ba9ba0
Uses reportActionID instead of the whole reportAction
abdel-h66 b0145f1
Uses lodash get to guard against undefined
abdel-h66 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -14,12 +14,14 @@ import Tooltip from '../Tooltip'; | |||||
import ReactionTooltipContent from './ReactionTooltipContent'; | ||||||
import * as EmojiUtils from '../../libs/EmojiUtils'; | ||||||
import {ReactionListContext} from '../../pages/home/ReportScreenContext'; | ||||||
import OfflineWithFeedback from '../OfflineWithFeedback'; | ||||||
import reportActionPropTypes from '../../pages/home/report/reportActionPropTypes'; | ||||||
|
||||||
const propTypes = { | ||||||
emojiReactions: EmojiReactionsPropTypes, | ||||||
|
||||||
/** The ID of the reportAction. It is the string representation of the a 64-bit integer. */ | ||||||
reportActionID: PropTypes.string.isRequired, | ||||||
/** The report action that these reactions are for */ | ||||||
reportAction: PropTypes.shape(reportActionPropTypes).isRequired, | ||||||
|
||||||
/** | ||||||
* Function to call when the user presses on an emoji. | ||||||
|
@@ -46,6 +48,9 @@ function ReportActionItemEmojiReactions(props) { | |||||
|
||||||
let totalReactionCount = 0; | ||||||
|
||||||
const reportAction = props.reportAction; | ||||||
const reportActionID = reportAction.reportActionID; | ||||||
|
||||||
// Each emoji is sorted by the oldest timestamp of user reactions so that they will always appear in the same order for everyone | ||||||
const sortedReactions = _.sortBy(props.emojiReactions, (emojiReaction, emojiName) => { | ||||||
// Since the emojiName is only stored as the object key, when _.sortBy() runs, the object is converted to an array and the | ||||||
|
@@ -96,7 +101,7 @@ function ReportActionItemEmojiReactions(props) { | |||||
}; | ||||||
|
||||||
const onReactionListOpen = (event) => { | ||||||
reactionListRef.current.showReactionList(event, popoverReactionListAnchors.current[reactionEmojiName], reactionEmojiName, props.reportActionID); | ||||||
reactionListRef.current.showReactionList(event, popoverReactionListAnchors.current[reactionEmojiName], reactionEmojiName, reportActionID); | ||||||
}; | ||||||
|
||||||
return { | ||||||
|
@@ -108,6 +113,7 @@ function ReportActionItemEmojiReactions(props) { | |||||
reactionCount, | ||||||
hasUserReacted, | ||||||
onReactionListOpen, | ||||||
hasPendingAction: reaction.pendingAction, | ||||||
}; | ||||||
}); | ||||||
|
||||||
|
@@ -132,24 +138,29 @@ function ReportActionItemEmojiReactions(props) { | |||||
key={reaction.reactionEmojiName} | ||||||
> | ||||||
<View> | ||||||
<EmojiReactionBubble | ||||||
ref={(ref) => (popoverReactionListAnchors.current[reaction.reactionEmojiName] = ref)} | ||||||
count={reaction.reactionCount} | ||||||
emojiCodes={reaction.emojiCodes} | ||||||
onPress={reaction.onPress} | ||||||
reactionUsers={reaction.reactionUsers} | ||||||
hasUserReacted={reaction.hasUserReacted} | ||||||
onReactionListOpen={reaction.onReactionListOpen} | ||||||
shouldBlockReactions={props.shouldBlockReactions} | ||||||
/> | ||||||
<OfflineWithFeedback | ||||||
pendingAction={reaction.hasPendingAction} | ||||||
shouldDisableOpacity={Boolean(reportAction.pendingAction)} | ||||||
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.
Suggested change
|
||||||
> | ||||||
<EmojiReactionBubble | ||||||
ref={(ref) => (popoverReactionListAnchors.current[reaction.reactionEmojiName] = ref)} | ||||||
count={reaction.reactionCount} | ||||||
emojiCodes={reaction.emojiCodes} | ||||||
onPress={reaction.onPress} | ||||||
reactionUsers={reaction.reactionUsers} | ||||||
hasUserReacted={reaction.hasUserReacted} | ||||||
onReactionListOpen={reaction.onReactionListOpen} | ||||||
shouldBlockReactions={props.shouldBlockReactions} | ||||||
/> | ||||||
</OfflineWithFeedback> | ||||||
</View> | ||||||
</Tooltip> | ||||||
); | ||||||
})} | ||||||
{!props.shouldBlockReactions && ( | ||||||
<AddReactionBubble | ||||||
onSelectEmoji={props.toggleReaction} | ||||||
reportAction={{reportActionID: props.reportActionID}} | ||||||
reportAction={{reportActionID}} | ||||||
/> | ||||||
)} | ||||||
</View> | ||||||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hasPendingAction
is a confusing name, it makes me thing this is gonna be a boolThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree we can use plain
pendingAction