| 1049 | } |
| 1050 | |
| 1051 | void RowPainter::Paint( |
| 1052 | Painter &p, |
| 1053 | not_null<const Row*> row, |
| 1054 | VideoUserpic *videoUserpic, |
| 1055 | const PaintContext &context) { |
| 1056 | const auto entry = row->entry(); |
| 1057 | const auto history = row->history(); |
| 1058 | const auto thread = row->thread(); |
| 1059 | const auto sublist = row->sublist(); |
| 1060 | const auto peer = history ? history->peer.get() : nullptr; |
| 1061 | const auto badgesState = entry->chatListBadgesState(); |
| 1062 | entry->chatListPreloadData(); // Allow chat list message resolve. |
| 1063 | const auto item = entry->chatListMessage(); |
| 1064 | const auto cloudDraft = [&]() -> const Data::Draft*{ |
| 1065 | if (!thread) { |
| 1066 | return nullptr; |
| 1067 | } |
| 1068 | if ((!peer |
| 1069 | || (!peer->displayAsForum() && !peer->amMonoforumAdmin())) |
| 1070 | && (!item || !badgesState.unread)) { |
| 1071 | // Draw item, if there are unread messages. |
| 1072 | const auto draft = thread->owningHistory()->cloudDraft( |
| 1073 | thread->topicRootId(), |
| 1074 | thread->monoforumPeerId()); |
| 1075 | if (!Data::DraftIsNull(draft)) { |
| 1076 | return draft; |
| 1077 | } |
| 1078 | } |
| 1079 | return nullptr; |
| 1080 | }(); |
| 1081 | const auto displayDate = [&]() -> TimeId { |
| 1082 | const auto itemDate = item ? item->date() : TimeId(0); |
| 1083 | const auto draftDate = cloudDraft ? cloudDraft->date : TimeId(0); |
| 1084 | return std::max(itemDate, draftDate); |
| 1085 | }(); |
| 1086 | const auto displayPinnedIcon = badgesState.empty() |
| 1087 | && entry->isPinnedDialog(context.filter) |
| 1088 | && (context.filter || !entry->fixedOnTopIndex()); |
| 1089 | |
| 1090 | const auto from = history |
| 1091 | ? (history->peer->migrateTo() |
| 1092 | ? history->peer->migrateTo() |
| 1093 | : history->peer.get()) |
| 1094 | : sublist |
| 1095 | ? sublist->sublistPeer().get() |
| 1096 | : nullptr; |
| 1097 | const auto allowUserOnline = true;// !context.narrow || badgesState.empty(); |
| 1098 | const auto flags = (allowUserOnline ? Flag::AllowUserOnline : Flag(0)) |
| 1099 | | ((sublist && !sublist->parentChat() && from->isSelf()) |
| 1100 | ? Flag::MyNotes |
| 1101 | : (peer && peer->isSelf()) |
| 1102 | ? Flag::SavedMessages |
| 1103 | : Flag(0)) |
| 1104 | | ((from && from->isRepliesChat()) |
| 1105 | ? Flag::RepliesMessages |
| 1106 | : Flag(0)) |
| 1107 | | ((from && from->isVerifyCodes()) |
| 1108 | ? Flag::VerifyCodes |
nothing calls this directly
no test coverage detected