Compare commits
1 Commits
create-pos
...
profile-vi
| Author | SHA1 | Date | |
|---|---|---|---|
|
d174b03648
|
@@ -865,29 +865,33 @@ func build_post(state: DamusState, post: NSAttributedString, action: PostAction,
|
||||
|
||||
|
||||
var content = post.string
|
||||
.trimmingCharacters(in: .whitespacesAndNewlines)
|
||||
.trimmingCharacters(in: CharacterSet.whitespacesAndNewlines)
|
||||
|
||||
let imagesString = uploadedMedias.map { $0.uploadedURL.absoluteString }.joined(separator: "\n")
|
||||
let imagesString = uploadedMedias.map { $0.uploadedURL.absoluteString }.joined(separator: " ")
|
||||
|
||||
if !imagesString.isEmpty {
|
||||
content.append("\n\n" + imagesString)
|
||||
content.append(" " + imagesString + " ")
|
||||
}
|
||||
|
||||
var tags: [[String]] = []
|
||||
|
||||
switch action {
|
||||
case .replying_to(let replying_to):
|
||||
// start off with the reply tags
|
||||
tags = nip10_reply_tags(replying_to: replying_to, keypair: state.keypair)
|
||||
case .replying_to(let replying_to):
|
||||
// start off with the reply tags
|
||||
tags = nip10_reply_tags(replying_to: replying_to, keypair: state.keypair)
|
||||
|
||||
case .quoting(let ev):
|
||||
content.append("\n\nnostr:" + bech32_note_id(ev.id))
|
||||
case .quoting(let ev):
|
||||
content.append(" nostr:" + bech32_note_id(ev.id))
|
||||
|
||||
if let quoted_ev = state.events.lookup(ev.id) {
|
||||
tags.append(["p", quoted_ev.pubkey.hex()])
|
||||
}
|
||||
case .posting, .highlighting, .sharing:
|
||||
break
|
||||
if let quoted_ev = state.events.lookup(ev.id) {
|
||||
tags.append(["p", quoted_ev.pubkey.hex()])
|
||||
}
|
||||
case .posting(let postTarget):
|
||||
break
|
||||
case .highlighting(let draft):
|
||||
break
|
||||
case .sharing(_):
|
||||
break
|
||||
}
|
||||
|
||||
// append additional tags
|
||||
@@ -909,7 +913,7 @@ func build_post(state: DamusState, post: NSAttributedString, action: PostAction,
|
||||
}
|
||||
}
|
||||
|
||||
return NostrPost(content: content.trimmingCharacters(in: .whitespacesAndNewlines), kind: .text, tags: tags)
|
||||
return NostrPost(content: content, kind: .text, tags: tags)
|
||||
}
|
||||
|
||||
func isSupportedVideo(url: URL?) -> Bool {
|
||||
|
||||
@@ -122,7 +122,10 @@ struct ProfileView: View {
|
||||
func content_filter(_ fstate: FilterState) -> ((NostrEvent) -> Bool) {
|
||||
var filters = ContentFilters.defaults(damus_state: damus_state)
|
||||
filters.append(fstate.filter)
|
||||
if fstate == .conversations {
|
||||
switch fstate {
|
||||
case .posts, .posts_and_replies:
|
||||
filters.append({ profile.pubkey == $0.pubkey })
|
||||
case .conversations:
|
||||
filters.append({ profile.conversation_events.contains($0.id) } )
|
||||
}
|
||||
return ContentFilters(filters: filters).filter
|
||||
|
||||
Reference in New Issue
Block a user