From a8f154740ee69eacd31cdbc55baeac48e37270db Mon Sep 17 00:00:00 2001 From: Velin92 <34335419+Velin92@users.noreply.github.com> Date: Tue, 31 Jan 2023 19:42:45 +0100 Subject: [PATCH] iOS: Removing event id links (#509) * removing unused event id link * changelog * Revert "removing unused event id link" This reverts commit aacd1124498674662123d5598604ef8bfcdfe02e. * commented the event id add link code * better changelog * commenting a tes that is related to the use of event id links which we don't handle for now --- .../HTMLParsing/AttributedStringBuilder.swift | 3 ++- .../Sources/AttributedStringBuilderTests.swift | 15 ++++++++------- changelog.d/500.bugfix | 1 + 3 files changed, 11 insertions(+), 8 deletions(-) create mode 100644 changelog.d/500.bugfix diff --git a/ElementX/Sources/Other/HTMLParsing/AttributedStringBuilder.swift b/ElementX/Sources/Other/HTMLParsing/AttributedStringBuilder.swift index 5e8bc6039..24bbf07a2 100644 --- a/ElementX/Sources/Other/HTMLParsing/AttributedStringBuilder.swift +++ b/ElementX/Sources/Other/HTMLParsing/AttributedStringBuilder.swift @@ -153,7 +153,8 @@ struct AttributedStringBuilder: AttributedStringBuilderProtocol { var matches = MatrixEntityRegex.userIdentifierRegex.matches(in: string, options: [], range: range) matches.append(contentsOf: MatrixEntityRegex.roomIdentifierRegex.matches(in: string, options: [], range: range)) - matches.append(contentsOf: MatrixEntityRegex.eventIdentifierRegex.matches(in: string, options: [], range: range)) + // As of right now we do not handle event id links in any way so there is no need to add them as links +// matches.append(contentsOf: MatrixEntityRegex.eventIdentifierRegex.matches(in: string, options: [], range: range)) matches.append(contentsOf: MatrixEntityRegex.roomAliasRegex.matches(in: string, options: [], range: range)) matches.append(contentsOf: MatrixEntityRegex.linkRegex.matches(in: string, options: [], range: range)) diff --git a/UnitTests/Sources/AttributedStringBuilderTests.swift b/UnitTests/Sources/AttributedStringBuilderTests.swift index c29f54dc2..a60fc3b7a 100644 --- a/UnitTests/Sources/AttributedStringBuilderTests.swift +++ b/UnitTests/Sources/AttributedStringBuilderTests.swift @@ -179,13 +179,14 @@ class AttributedStringBuilderTests: XCTestCase { checkMatrixEntityLinkIn(attributedString: attributedStringBuilder.fromHTML(string), expected: roomId) checkMatrixEntityLinkIn(attributedString: attributedStringBuilder.fromPlain(string), expected: roomId) } - - func testEventIdLink() { - let eventId = "$eventidentifier" - let string = "The event is \(eventId)." - checkMatrixEntityLinkIn(attributedString: attributedStringBuilder.fromHTML(string), expected: eventId) - checkMatrixEntityLinkIn(attributedString: attributedStringBuilder.fromPlain(string), expected: eventId) - } + + // As of right now we do not handle event id links in any way so there is no need to add them as links +// func testEventIdLink() { +// let eventId = "$eventidentifier" +// let string = "The event is \(eventId)." +// checkMatrixEntityLinkIn(attributedString: attributedStringBuilder.fromHTML(string), expected: eventId) +// checkMatrixEntityLinkIn(attributedString: attributedStringBuilder.fromPlain(string), expected: eventId) +// } func testDefaultFont() { let htmlString = "Test string." diff --git a/changelog.d/500.bugfix b/changelog.d/500.bugfix new file mode 100644 index 000000000..10bb35868 --- /dev/null +++ b/changelog.d/500.bugfix @@ -0,0 +1 @@ +Fixed a bug that recognised any amount in dollars as an untappable link. \ No newline at end of file