Skip to content

Commit

Permalink
show "Room" for unresolved event permalinks
Browse files Browse the repository at this point in the history
  • Loading branch information
Velin92 committed Feb 28, 2025
1 parent 8906875 commit 14fa7d8
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 10 deletions.
7 changes: 0 additions & 7 deletions ElementX/Sources/Other/Pills/PillTextAttachmentData.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,6 @@ enum PillType: Codable, Equatable {
enum EventRoom: Codable, Equatable {
case roomAlias(String)
case roomID(String)

var value: String {
switch self {
case .roomAlias(let value), .roomID(let value):
return value
}
}
}

case event(room: EventRoom)
Expand Down
2 changes: 1 addition & 1 deletion ElementX/Sources/Screens/Timeline/TimelineViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -866,7 +866,7 @@ class TimelineViewModel: TimelineViewModelType, TimelineViewModelProtocol {
case .allUsers:
pillContext.viewState = .mention(isOwnMention: true, displayText: PillConstants.atRoom)
case .event(let room):
var pillViewState: PillViewState = .reference(avatar: .link, displayText: L10n.screenRoomEventPill(room.value))
var pillViewState: PillViewState = .reference(avatar: .link, displayText: L10n.screenRoomEventPill(L10n.commonRoom))
defer {
pillContext.viewState = pillViewState
}
Expand Down
4 changes: 2 additions & 2 deletions UnitTests/Sources/PillContextTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ class PillContextTests: XCTestCase {
XCTAssertFalse(context.viewState.isOwnMention)
XCTAssertFalse(context.viewState.isUndefined)
XCTAssertEqual(context.viewState.image, .link)
XCTAssertEqual(context.viewState.displayText, L10n.screenRoomEventPill("1"))
XCTAssertEqual(context.viewState.displayText, L10n.screenRoomEventPill(L10n.commonRoom))
}

func testEventOnRoomAliasMention() async throws {
Expand Down Expand Up @@ -294,6 +294,6 @@ class PillContextTests: XCTestCase {
XCTAssertFalse(context.viewState.isOwnMention)
XCTAssertFalse(context.viewState.isUndefined)
XCTAssertEqual(context.viewState.image, .link)
XCTAssertEqual(context.viewState.displayText, L10n.screenRoomEventPill("#foundation-and-empire:matrix.org"))
XCTAssertEqual(context.viewState.displayText, L10n.screenRoomEventPill(L10n.commonRoom))
}
}

0 comments on commit 14fa7d8

Please sign in to comment.