| 1212 | } |
| 1213 | |
| 1214 | void ChooseTopicBoxController::refreshRows(bool initial) { |
| 1215 | auto added = false; |
| 1216 | if (_forum->bot() |
| 1217 | && !delegate()->peerListFindRow(PeerListRowId(0)) |
| 1218 | && (!_filter || _filter(_forum->history()))) { |
| 1219 | const auto userCreatesTopics = Data::IsBotUserCreatesTopics( |
| 1220 | _forum->peer()); |
| 1221 | delegate()->peerListAppendRow( |
| 1222 | std::make_unique<AllMessagesRow>(userCreatesTopics)); |
| 1223 | added = true; |
| 1224 | } |
| 1225 | for (const auto &row : _forum->topicsList()->indexed()->all()) { |
| 1226 | if (const auto topic = row->topic()) { |
| 1227 | const auto id = topic->rootId().bare; |
| 1228 | auto already = delegate()->peerListFindRow(id); |
| 1229 | if (initial || !already) { |
| 1230 | if (auto created = createRow(topic)) { |
| 1231 | delegate()->peerListAppendRow(std::move(created)); |
| 1232 | added = true; |
| 1233 | } |
| 1234 | } else if (already->isSearchResult()) { |
| 1235 | delegate()->peerListAppendFoundRow(already); |
| 1236 | added = true; |
| 1237 | } |
| 1238 | } |
| 1239 | } |
| 1240 | if (added) { |
| 1241 | delegate()->peerListRefreshRows(); |
| 1242 | } |
| 1243 | } |
| 1244 | |
| 1245 | void ChooseTopicBoxController::loadMoreRows() { |
| 1246 | _forum->requestTopics(); |
nothing calls this directly
no test coverage detected