| 4313 | } |
| 4314 | |
| 4315 | void MarkAsReadThread(not_null<Data::Thread*> thread) { |
| 4316 | const auto readHistory = [&](not_null<History*> history) { |
| 4317 | history->owner().histories().readInbox(history); |
| 4318 | }; |
| 4319 | if (!IsUnreadThread(thread)) { |
| 4320 | return; |
| 4321 | } else if (const auto forum = thread->asForum()) { |
| 4322 | forum->enumerateTopics([](not_null<Data::ForumTopic*> topic) { |
| 4323 | MarkAsReadThread(topic); |
| 4324 | }); |
| 4325 | } else if (const auto history = thread->asHistory()) { |
| 4326 | readHistory(history); |
| 4327 | if (const auto migrated = history->migrateSibling()) { |
| 4328 | readHistory(migrated); |
| 4329 | } |
| 4330 | } else if (const auto topic = thread->asTopic()) { |
| 4331 | topic->readTillEnd(); |
| 4332 | } else if (const auto sublist = thread->asSublist()) { |
| 4333 | sublist->readTillEnd(); |
| 4334 | } |
| 4335 | } |
| 4336 | |
| 4337 | void AddSeparatorAndShiftUp(const PeerMenuCallback &addAction) { |
| 4338 | addAction({ |
no test coverage detected