unreadThreadByShortLink method

List<ModeratorEntry> unreadThreadByShortLink(
  1. String shortLink
)

Implementation

List<ModeratorEntry> unreadThreadByShortLink(String shortLink) {
  //OMNI here to track seen unseen / seen
  List<ModeratorEntry> _ll = [];
  for (var element in data.threadByShortLink(shortLink)) {
    if (element.shortLink == shortLink) {
      bool newa = false;
      List<ModeratorEntry> _lll = [];
      data.childrenOf(element.hint).forEach((ce) {
        if (ce.flags.isReply) {
          ce.flags.isSeen = _omni.isSeen(ce.hint);
          //any single item unseen makes parent unseen
          if (!ce.flags.isSeen) newa = true;
          _lll.add(ce);
        }
      });
      if (newa) {
        element.flags.isSeen = false;
      } else {
        element.flags.isSeen = _omni.isSeen(element.hint);
      }
      _ll.add(element);
      if (_lll.isNotEmpty) _ll.addAll(_lll);
    }
  }
  return _ll;
}