Compare commits

..

1 Commits

Author SHA1 Message Date
0b85b53eda Clean up code in ProfileName.name_choice
Signed-off-by: Terry Yiu <git@tyiu.xyz>
2025-04-11 15:05:09 -04:00
3 changed files with 3 additions and 9 deletions

View File

@@ -883,8 +883,6 @@ func build_post(state: DamusState, post: NSAttributedString, action: PostAction,
case .quoting(let ev):
content.append("\n\nnostr:" + bech32_note_id(ev.id))
tags.append(["q", ev.id.hex()]);
if let quoted_ev = state.events.lookup(ev.id) {
tags.append(["p", quoted_ev.pubkey.hex()])
}

View File

@@ -67,7 +67,9 @@ struct ProfileName: View {
}
func name_choice(profile: Profile?) -> String {
return prefix == "@" ? current_display_name(profile: profile).username.truncate(maxLength: 50) : current_display_name(profile: profile).displayName.truncate(maxLength: 50)
let displayName = current_display_name(profile: profile)
let untruncatedName = prefix == "@" ? displayName.username : displayName.displayName
return untruncatedName.truncate(maxLength: 50)
}
func onlyzapper(profile: Profile?) -> Bool {

View File

@@ -170,12 +170,6 @@ final class PostViewTests: XCTestCase {
nonAlphaNumerics.forEach { testAddingStringAfterLink(str: $0)}
}
func testQuoteRepost() {
let post = build_post(state: test_damus_state, post: .init(), action: .quoting(test_note), uploadedMedias: [], pubkeys: [])
XCTAssertEqual(post.tags, [["q", test_note.id.hex()]])
}
}
func checkMentionLinkEditorHandling(