mirror of https://github.com/usbharu/Hideout.git
feat: Createアクティビティにactorを追加
This commit is contained in:
parent
c644a66071
commit
a4feef5f75
|
@ -4,7 +4,16 @@ open class Create : Object {
|
||||||
var `object`: Object? = null
|
var `object`: Object? = null
|
||||||
|
|
||||||
protected constructor() : super()
|
protected constructor() : super()
|
||||||
constructor(type: List<String> = emptyList(), name: String, `object`: Object?) : super(add(type, "Create"), name) {
|
constructor(
|
||||||
|
type: List<String> = emptyList(),
|
||||||
|
name: String? = null,
|
||||||
|
`object`: Object?,
|
||||||
|
actor: String? = null
|
||||||
|
) : super(
|
||||||
|
add(type, "Create"),
|
||||||
|
name,
|
||||||
|
actor
|
||||||
|
) {
|
||||||
this.`object` = `object`
|
this.`object` = `object`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,9 +9,10 @@ open class Object : JsonLd {
|
||||||
@JsonSerialize(using = TypeSerializer::class)
|
@JsonSerialize(using = TypeSerializer::class)
|
||||||
private var type: List<String> = emptyList()
|
private var type: List<String> = emptyList()
|
||||||
var name: String? = null
|
var name: String? = null
|
||||||
|
var actor: String? = null
|
||||||
|
|
||||||
protected constructor()
|
protected constructor()
|
||||||
constructor(type: List<String>, name: String) : super() {
|
constructor(type: List<String>, name: String? = null,actor:String? = null) : super() {
|
||||||
this.type = type
|
this.type = type
|
||||||
this.name = name
|
this.name = name
|
||||||
}
|
}
|
||||||
|
@ -25,22 +26,28 @@ open class Object : JsonLd {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
override fun equals(other: Any?): Boolean {
|
override fun equals(other: Any?): Boolean {
|
||||||
if (this === other) return true
|
if (this === other) return true
|
||||||
if (other !is Object) return false
|
if (other !is Object) return false
|
||||||
|
if (!super.equals(other)) return false
|
||||||
|
|
||||||
if (type != other.type) return false
|
if (type != other.type) return false
|
||||||
return name == other.name
|
if (name != other.name) return false
|
||||||
|
return actor == other.actor
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun hashCode(): Int {
|
override fun hashCode(): Int {
|
||||||
var result = type.hashCode()
|
var result = super.hashCode()
|
||||||
|
result = 31 * result + type.hashCode()
|
||||||
result = 31 * result + (name?.hashCode() ?: 0)
|
result = 31 * result + (name?.hashCode() ?: 0)
|
||||||
|
result = 31 * result + (actor?.hashCode() ?: 0)
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun toString(): String {
|
override fun toString(): String {
|
||||||
return "Object(type=$type, name=$name) ${super.toString()}"
|
return "Object(type=$type, name=$name, actor=$actor) ${super.toString()}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -54,7 +54,8 @@ class ActivityPubNoteServiceImpl(
|
||||||
username = "$actor#pubkey",
|
username = "$actor#pubkey",
|
||||||
jsonLd = Create(
|
jsonLd = Create(
|
||||||
name = "Create Note",
|
name = "Create Note",
|
||||||
`object` = note
|
`object` = note,
|
||||||
|
actor = note.attributedTo
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue