From cf616ad6801f25394148687bfc8472c1c023f02e Mon Sep 17 00:00:00 2001 From: Sibtain Ali Date: Sun, 12 Jun 2022 02:16:01 +0500 Subject: [PATCH 1/4] fix: autolink on edit --- src/libs/actions/Report.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/actions/Report.js b/src/libs/actions/Report.js index 8a909fdb1a26..e60e818114a3 100644 --- a/src/libs/actions/Report.js +++ b/src/libs/actions/Report.js @@ -1242,7 +1242,7 @@ Onyx.connect({ */ function editReportComment(reportID, originalReportAction, textForNewComment) { const parser = new ExpensiMark(); - const htmlForNewComment = parser.replace(textForNewComment); + const htmlForNewComment = parser.replace(textForNewComment, {filterRules: _.map(_.filter(parser.rules, (({name}) => !['autolink'].includes(name))), ({name}) => name)}); // Delete the comment if it's empty if (_.isEmpty(htmlForNewComment)) { From c3497b9ed6dd9c03fae4fb5ded54b2a2dd1f576e Mon Sep 17 00:00:00 2001 From: Sibtain Ali Date: Sun, 19 Jun 2022 22:10:18 +0500 Subject: [PATCH 2/4] fix: handled comments --- src/libs/actions/Report.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/actions/Report.js b/src/libs/actions/Report.js index e60e818114a3..11a2a6c8a3a6 100644 --- a/src/libs/actions/Report.js +++ b/src/libs/actions/Report.js @@ -1242,7 +1242,7 @@ Onyx.connect({ */ function editReportComment(reportID, originalReportAction, textForNewComment) { const parser = new ExpensiMark(); - const htmlForNewComment = parser.replace(textForNewComment, {filterRules: _.map(_.filter(parser.rules, (({name}) => !['autolink'].includes(name))), ({name}) => name)}); + const htmlForNewComment = parser.replace(textForNewComment, {filterRules: _.filter(_.pluck(parser.rules, 'name'), name => name !== 'autolink')}); // Delete the comment if it's empty if (_.isEmpty(htmlForNewComment)) { From 5a28237f37825e86736edd8c5bbf8929ca66c66e Mon Sep 17 00:00:00 2001 From: Sibtain Ali Date: Sat, 25 Jun 2022 01:01:12 +0500 Subject: [PATCH 3/4] Update Report.js --- src/libs/actions/Report.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/libs/actions/Report.js b/src/libs/actions/Report.js index 11a2a6c8a3a6..79b486d23ad4 100644 --- a/src/libs/actions/Report.js +++ b/src/libs/actions/Report.js @@ -1242,6 +1242,9 @@ Onyx.connect({ */ function editReportComment(reportID, originalReportAction, textForNewComment) { const parser = new ExpensiMark(); + + // Do not autolink if someone explicitly tries to remove a link from message. + // https://github.com/Expensify/App/issues/9090 const htmlForNewComment = parser.replace(textForNewComment, {filterRules: _.filter(_.pluck(parser.rules, 'name'), name => name !== 'autolink')}); // Delete the comment if it's empty From e857eb10519fb5cd6d722b0d7d7e5eb5a0bdb048 Mon Sep 17 00:00:00 2001 From: Sibtain Ali Date: Sat, 25 Jun 2022 01:11:59 +0500 Subject: [PATCH 4/4] fix: removed lint error --- src/libs/actions/Report.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/actions/Report.js b/src/libs/actions/Report.js index 79b486d23ad4..c34d90e53fa2 100644 --- a/src/libs/actions/Report.js +++ b/src/libs/actions/Report.js @@ -1242,7 +1242,7 @@ Onyx.connect({ */ function editReportComment(reportID, originalReportAction, textForNewComment) { const parser = new ExpensiMark(); - + // Do not autolink if someone explicitly tries to remove a link from message. // https://github.com/Expensify/App/issues/9090 const htmlForNewComment = parser.replace(textForNewComment, {filterRules: _.filter(_.pluck(parser.rules, 'name'), name => name !== 'autolink')});