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