mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-09-28 22:53:11 +02:00
Marks which events can receive Comment replies as root scopes.
This commit is contained in:
@@ -70,6 +70,7 @@ import com.vitorpamplona.quartz.events.FileStorageHeaderEvent
|
|||||||
import com.vitorpamplona.quartz.events.GitIssueEvent
|
import com.vitorpamplona.quartz.events.GitIssueEvent
|
||||||
import com.vitorpamplona.quartz.events.Price
|
import com.vitorpamplona.quartz.events.Price
|
||||||
import com.vitorpamplona.quartz.events.PrivateDmEvent
|
import com.vitorpamplona.quartz.events.PrivateDmEvent
|
||||||
|
import com.vitorpamplona.quartz.events.RootScope
|
||||||
import com.vitorpamplona.quartz.events.TextNoteEvent
|
import com.vitorpamplona.quartz.events.TextNoteEvent
|
||||||
import com.vitorpamplona.quartz.events.TorrentCommentEvent
|
import com.vitorpamplona.quartz.events.TorrentCommentEvent
|
||||||
import com.vitorpamplona.quartz.events.TorrentEvent
|
import com.vitorpamplona.quartz.events.TorrentEvent
|
||||||
@@ -555,7 +556,7 @@ open class NewPostViewModel : ViewModel() {
|
|||||||
|
|
||||||
val replyingTo = originalNote
|
val replyingTo = originalNote
|
||||||
|
|
||||||
if (replyingTo?.event is CommentEvent || replyingTo?.event is Event) {
|
if (replyingTo?.event is CommentEvent || (replyingTo?.event is Event && replyingTo.event is RootScope)) {
|
||||||
account?.sendReplyComment(
|
account?.sendReplyComment(
|
||||||
message = tagger.message,
|
message = tagger.message,
|
||||||
replyingTo = replyingTo,
|
replyingTo = replyingTo,
|
||||||
|
@@ -39,7 +39,8 @@ class CommentEvent(
|
|||||||
tags: Array<Array<String>>,
|
tags: Array<Array<String>>,
|
||||||
content: String,
|
content: String,
|
||||||
sig: HexKey,
|
sig: HexKey,
|
||||||
) : BaseTextNoteEvent(id, pubKey, createdAt, KIND, tags, content, sig) {
|
) : BaseTextNoteEvent(id, pubKey, createdAt, KIND, tags, content, sig),
|
||||||
|
RootScope {
|
||||||
fun root() = tags.firstOrNull { it.size > 3 && it[3] == "root" }?.get(1)
|
fun root() = tags.firstOrNull { it.size > 3 && it[3] == "root" }?.get(1)
|
||||||
|
|
||||||
fun getRootScopes() = tags.filter { it.size > 1 && it[0] == "I" || it[0] == "A" || it[0] == "E" }
|
fun getRootScopes() = tags.filter { it.size > 1 && it[0] == "I" || it[0] == "A" || it[0] == "E" }
|
||||||
|
@@ -588,3 +588,5 @@ data class ZapSplitSetup(
|
|||||||
val weight: Double,
|
val weight: Double,
|
||||||
val isLnAddress: Boolean,
|
val isLnAddress: Boolean,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
interface RootScope
|
||||||
|
@@ -38,7 +38,8 @@ class PictureEvent(
|
|||||||
tags: Array<Array<String>>,
|
tags: Array<Array<String>>,
|
||||||
content: String,
|
content: String,
|
||||||
sig: HexKey,
|
sig: HexKey,
|
||||||
) : Event(id, pubKey, createdAt, KIND, tags, content, sig) {
|
) : Event(id, pubKey, createdAt, KIND, tags, content, sig),
|
||||||
|
RootScope {
|
||||||
fun mimeTypes() = tags.filter { it.size > 1 && it[0] == MIME_TYPE }
|
fun mimeTypes() = tags.filter { it.size > 1 && it[0] == MIME_TYPE }
|
||||||
|
|
||||||
fun hashes() = tags.filter { it.size > 1 && it[0] == HASH }
|
fun hashes() = tags.filter { it.size > 1 && it[0] == HASH }
|
||||||
|
@@ -34,7 +34,8 @@ abstract class VideoEvent(
|
|||||||
tags: Array<Array<String>>,
|
tags: Array<Array<String>>,
|
||||||
content: String,
|
content: String,
|
||||||
sig: HexKey,
|
sig: HexKey,
|
||||||
) : BaseAddressableEvent(id, pubKey, createdAt, kind, tags, content, sig) {
|
) : BaseAddressableEvent(id, pubKey, createdAt, kind, tags, content, sig),
|
||||||
|
RootScope {
|
||||||
fun url() = tags.firstOrNull { it.size > 1 && it[0] == URL }?.get(1)
|
fun url() = tags.firstOrNull { it.size > 1 && it[0] == URL }?.get(1)
|
||||||
|
|
||||||
fun urls() = tags.filter { it.size > 1 && it[0] == URL }.map { it[1] }
|
fun urls() = tags.filter { it.size > 1 && it[0] == URL }.map { it[1] }
|
||||||
|
@@ -34,7 +34,8 @@ class VideoVerticalEvent(
|
|||||||
tags: Array<Array<String>>,
|
tags: Array<Array<String>>,
|
||||||
content: String,
|
content: String,
|
||||||
sig: HexKey,
|
sig: HexKey,
|
||||||
) : VideoEvent(id, pubKey, createdAt, KIND, tags, content, sig) {
|
) : VideoEvent(id, pubKey, createdAt, KIND, tags, content, sig),
|
||||||
|
RootScope {
|
||||||
companion object {
|
companion object {
|
||||||
const val KIND = 34236
|
const val KIND = 34236
|
||||||
const val ALT_DESCRIPTION = "Vertical Video"
|
const val ALT_DESCRIPTION = "Vertical Video"
|
||||||
|
Reference in New Issue
Block a user