Compare commits

...

1 Commits

Author SHA1 Message Date
adba831c1f Change spaces to newlines in new posts to provide cleaner separation between text, uploaded media, and quoted notes
Changelog-Changed: Changed spaces to newlines in new posts to provide cleaner separation between text, uploaded media, and quoted notes
Signed-off-by: Terry Yiu <git@tyiu.xyz>
2025-03-02 12:27:47 -05:00

View File

@@ -865,12 +865,12 @@ func build_post(state: DamusState, post: NSAttributedString, action: PostAction,
var content = post.string var content = post.string
.trimmingCharacters(in: CharacterSet.whitespacesAndNewlines) .trimmingCharacters(in: .whitespacesAndNewlines)
let imagesString = uploadedMedias.map { $0.uploadedURL.absoluteString }.joined(separator: " ") let imagesString = uploadedMedias.map { $0.uploadedURL.absoluteString }.joined(separator: "\n")
if !imagesString.isEmpty { if !imagesString.isEmpty {
content.append(" " + imagesString + " ") content.append("\n\n" + imagesString)
} }
var tags: [[String]] = [] var tags: [[String]] = []
@@ -881,16 +881,12 @@ func build_post(state: DamusState, post: NSAttributedString, action: PostAction,
tags = nip10_reply_tags(replying_to: replying_to, keypair: state.keypair) tags = nip10_reply_tags(replying_to: replying_to, keypair: state.keypair)
case .quoting(let ev): case .quoting(let ev):
content.append(" nostr:" + bech32_note_id(ev.id)) content.append("\n\nnostr:" + bech32_note_id(ev.id))
if let quoted_ev = state.events.lookup(ev.id) { if let quoted_ev = state.events.lookup(ev.id) {
tags.append(["p", quoted_ev.pubkey.hex()]) tags.append(["p", quoted_ev.pubkey.hex()])
} }
case .posting(let postTarget): case .posting, .highlighting, .sharing:
break
case .highlighting(let draft):
break
case .sharing(_):
break break
} }
@@ -913,7 +909,7 @@ func build_post(state: DamusState, post: NSAttributedString, action: PostAction,
} }
} }
return NostrPost(content: content, kind: .text, tags: tags) return NostrPost(content: content.trimmingCharacters(in: .whitespacesAndNewlines), kind: .text, tags: tags)
} }
func isSupportedVideo(url: URL?) -> Bool { func isSupportedVideo(url: URL?) -> Bool {