mirror of
https://github.com/tateisu/SubwayTooter
synced 2025-02-09 16:48:47 +01:00
fixup
This commit is contained in:
parent
a46dbba13b
commit
076a3c791d
@ -34,8 +34,8 @@ class TootReaction(
|
|||||||
val announcement_id: EntityId? = null,
|
val announcement_id: EntityId? = null,
|
||||||
|
|
||||||
// (fedibird絵文字リアクション) userストリームのemoji_reactionイベントで設定される。
|
// (fedibird絵文字リアクション) userストリームのemoji_reactionイベントで設定される。
|
||||||
val status_id : EntityId? = null,
|
val status_id: EntityId? = null,
|
||||||
) {
|
) {
|
||||||
companion object {
|
companion object {
|
||||||
|
|
||||||
fun appendDomain(name: String, domain: String?) =
|
fun appendDomain(name: String, domain: String?) =
|
||||||
@ -181,11 +181,11 @@ class TootReactionSet(val isMisskey: Boolean) : LinkedList<TootReaction>() {
|
|||||||
private fun getRaw(name: String?): TootReaction? =
|
private fun getRaw(name: String?): TootReaction? =
|
||||||
find { it.name == name }
|
find { it.name == name }
|
||||||
|
|
||||||
operator fun get(name: String?): TootReaction? =
|
operator fun get(name: String?): TootReaction? = when {
|
||||||
if (name == null || name.isEmpty())
|
name == null || name.isEmpty() -> null
|
||||||
null
|
isMisskey -> getRaw(name) ?: getRaw(TootReaction.getAnotherExpression(name))
|
||||||
else
|
else -> getRaw(name)
|
||||||
getRaw(name) ?: getRaw(TootReaction.getAnotherExpression(name))
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
fun parseMisskey(src: JsonObject?, myReactionCode: String? = null) =
|
fun parseMisskey(src: JsonObject?, myReactionCode: String? = null) =
|
||||||
|
@ -968,11 +968,15 @@ class TootStatus(parser: TootParser, src: JsonObject) : TimelineItem() {
|
|||||||
this.reactionSet = reactionSet
|
this.reactionSet = reactionSet
|
||||||
}
|
}
|
||||||
|
|
||||||
val old = reactionSet[newReaction.name]
|
when(val old = reactionSet[newReaction.name]) {
|
||||||
if( old != null){
|
null -> reactionSet.add(newReaction)
|
||||||
old.count = newReaction.count
|
|
||||||
}else{
|
// 同一オブジェクトならマージは不要
|
||||||
reactionSet.add(newReaction)
|
newReaction -> {
|
||||||
|
}
|
||||||
|
|
||||||
|
// 異なるオブジェクトの場合はmeを壊さないようにカウントだけ更新する
|
||||||
|
else -> old.count = newReaction.count
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
reactionSet?.myReaction = reactionSet?.find { it.me }
|
reactionSet?.myReaction = reactionSet?.find { it.me }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user