-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Keep chats with draft comments in the LHN #781
Merged
Merged
Changes from 2 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
46e7f62
Keep chats with draft comments in the LHN
Gonals 9f21436
merge master
Gonals b8784fb
show icon
Gonals 6fb89fe
merge master and cleanup
Gonals 5e463dc
Merge branch 'master' into alberto-draftsPinned
Gonals f0b3531
cleanup style
Gonals 996600d
Merge branch 'master' into alberto-draftsPinned
Gonals ee45cb4
split line
Gonals 34f5d48
remove extra space
Gonals 4859ab6
add comment
Gonals 398b5eb
Merge branch 'master' into alberto-draftsPinned
Gonals 974e2e3
Do not add second text line if we don't have it
Gonals 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 |
---|---|---|
|
@@ -35,8 +35,7 @@ const propTypes = { | |
})), | ||
|
||
// List of draft comments. We don't know the shape, since the keys include the report numbers | ||
// eslint-disable-next-line react/forbid-prop-types | ||
comments: PropTypes.object, | ||
comments: PropTypes.objectOf(PropTypes.string), | ||
|
||
isChatSwitcherActive: PropTypes.bool, | ||
|
||
|
@@ -55,6 +54,7 @@ const defaultProps = { | |
personalDetails: {}, | ||
}; | ||
|
||
|
||
const SidebarLinks = (props) => { | ||
const {onLinkClick} = props; | ||
const reportIDInUrl = parseInt(props.match.params.reportID, 10); | ||
|
@@ -65,11 +65,13 @@ const SidebarLinks = (props) => { | |
'desc', | ||
'asc' | ||
]); | ||
const hasComment = reportID => get(props.comments, `${ONYXKEYS.COLLECTION.REPORT_DRAFT_COMMENT}${reportID}`, '').length > 0; | ||
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. This is still having a lint warning for the line length. I have a few suggestions:
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. Thanks! Fixed |
||
|
||
// Filter the reports so that the only reports shown are pinned, unread, have draft | ||
// comments (but are not the open one), and the one matching the URL | ||
// eslint-disable-next-line max-len | ||
const reportsToDisplay = _.filter(sortedReports, report => (report.isPinned || (report.unreadActionCount > 0) || report.reportID === reportIDInUrl || (report.reportID !== reportIDInUrl && get(props.comments, `${ONYXKEYS.COLLECTION.REPORT_DRAFT_COMMENT}${report.reportID}`, '').length > 0))); | ||
const reportsToDisplay = _.filter(sortedReports, report => (report.isPinned || (report.unreadActionCount > 0) | ||
|| report.reportID === reportIDInUrl | ||
|| (report.reportID !== reportIDInUrl && hasComment(report.reportID)))); | ||
|
||
// Update styles to hide the report links if they should not be visible | ||
const sidebarLinksStyle = !props.isChatSwitcherActive | ||
|
@@ -110,9 +112,7 @@ const SidebarLinks = (props) => { | |
login: participantDetails ? participantDetails.login : '', | ||
reportID: report.reportID, | ||
isUnread: report.unreadActionCount > 0, | ||
|
||
// eslint-disable-next-line max-len | ||
hasDraftComment: report.reportID !== reportIDInUrl && get(props.comments, `${ONYXKEYS.COLLECTION.REPORT_DRAFT_COMMENT}${report.reportID}`, '').length > 0 | ||
hasDraftComment: report.reportID !== reportIDInUrl && hasComment(report.reportID) | ||
}} | ||
onSelectRow={onLinkClick} | ||
optionIsFocused={report.reportID === reportIDInUrl} | ||
|
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.
This comment was marked as resolved.
Sorry, something went wrong.
This comment was marked as resolved.
Sorry, something went wrong.