Skip to content

Commit

Permalink
Merge pull request #20771 from Ollyws/issue-20255
Browse files Browse the repository at this point in the history
Fix for: IOU has pin option in LHN
  • Loading branch information
amyevans authored Jun 22, 2023
2 parents 4bf2918 + 5bc6630 commit ab74259
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/libs/ReportUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,10 +166,11 @@ function isTaskAssignee(report) {
/**
* Checks if a report is an IOU or expense report.
*
* @param {Object} report
* @param {Object|String} reportOrID
* @returns {Boolean}
*/
function isMoneyRequestReport(report) {
function isMoneyRequestReport(reportOrID) {
const report = _.isObject(reportOrID) ? reportOrID : allReports[`${ONYXKEYS.COLLECTION.REPORT}${reportOrID}`];
return isIOUReport(report) || isExpenseReport(report);
}

Expand Down
6 changes: 4 additions & 2 deletions src/pages/home/report/ContextMenu/ContextMenuActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,8 @@ export default [
{
textTranslateKey: 'common.pin',
icon: Expensicons.Pin,
shouldShow: (type, reportAction, isArchivedRoom, betas, anchor, isChronosReport, reportID, isPinnedChat) => type === CONTEXT_MENU_TYPES.REPORT && !isPinnedChat,
shouldShow: (type, reportAction, isArchivedRoom, betas, anchor, isChronosReport, reportID, isPinnedChat) =>
type === CONTEXT_MENU_TYPES.REPORT && !isPinnedChat && !ReportUtils.isMoneyRequestReport(reportID),
onPress: (closePopover, {reportID}) => {
Report.togglePinnedState(reportID, false);
if (closePopover) {
Expand All @@ -300,7 +301,8 @@ export default [
{
textTranslateKey: 'common.unPin',
icon: Expensicons.Pin,
shouldShow: (type, reportAction, isArchivedRoom, betas, anchor, isChronosReport, reportID, isPinnedChat) => type === CONTEXT_MENU_TYPES.REPORT && isPinnedChat,
shouldShow: (type, reportAction, isArchivedRoom, betas, anchor, isChronosReport, reportID, isPinnedChat) =>
type === CONTEXT_MENU_TYPES.REPORT && isPinnedChat && !ReportUtils.isMoneyRequestReport(reportID),
onPress: (closePopover, {reportID}) => {
Report.togglePinnedState(reportID, true);
if (closePopover) {
Expand Down

0 comments on commit ab74259

Please sign in to comment.