mirror of
https://github.com/metabolist/metatext.git
synced 2024-11-25 09:41:00 +00:00
Improve reply indicator logic
This commit is contained in:
parent
8ad01a6ecf
commit
3a1d8d4470
1 changed files with 15 additions and 5 deletions
|
@ -28,16 +28,26 @@ extension ContextItemsInfo {
|
||||||
section.filtered(regularExpression: regularExpression)
|
section.filtered(regularExpression: regularExpression)
|
||||||
.enumerated()
|
.enumerated()
|
||||||
.map { index, statusInfo in
|
.map { index, statusInfo in
|
||||||
let isReplyInContext = index > 0
|
let isContextParent = statusInfo.record.id == parent.record.id
|
||||||
&& section[index - 1].record.id == statusInfo.record.inReplyToId
|
let isReplyInContext: Bool
|
||||||
let hasReplyFollowing = section.count > index + 1
|
|
||||||
&& section[index + 1].record.inReplyToId == statusInfo.record.id
|
if isContextParent {
|
||||||
|
isReplyInContext = !ancestors.isEmpty
|
||||||
|
&& statusInfo.record.inReplyToId == ancestors.last?.record.id
|
||||||
|
} else {
|
||||||
|
isReplyInContext = index > 0
|
||||||
|
&& section[index - 1].record.id == statusInfo.record.inReplyToId
|
||||||
|
}
|
||||||
|
|
||||||
|
let hasReplyFollowing = (section.count > index + 1
|
||||||
|
&& section[index + 1].record.inReplyToId == statusInfo.record.id)
|
||||||
|
|| (statusInfo == ancestors.last && parent.record.inReplyToId == statusInfo.record.id)
|
||||||
|
|
||||||
return .status(
|
return .status(
|
||||||
.init(info: statusInfo),
|
.init(info: statusInfo),
|
||||||
.init(showContentToggled: statusInfo.showContentToggled,
|
.init(showContentToggled: statusInfo.showContentToggled,
|
||||||
showAttachmentsToggled: statusInfo.showAttachmentsToggled,
|
showAttachmentsToggled: statusInfo.showAttachmentsToggled,
|
||||||
isContextParent: statusInfo.record.id == parent.record.id,
|
isContextParent: isContextParent,
|
||||||
isReplyInContext: isReplyInContext,
|
isReplyInContext: isReplyInContext,
|
||||||
hasReplyFollowing: hasReplyFollowing))
|
hasReplyFollowing: hasReplyFollowing))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue