| 391 | } |
| 392 | |
| 393 | void ForumTopic::applyTopic(const MTPDforumTopic &data) { |
| 394 | Expects(_rootId == data.vid().v); |
| 395 | |
| 396 | const auto min = data.is_short(); |
| 397 | |
| 398 | applyCreator(peerFromMTP(data.vfrom_id())); |
| 399 | applyCreationDate(data.vdate().v); |
| 400 | |
| 401 | applyTitle(qs(data.vtitle())); |
| 402 | if (const auto iconId = data.vicon_emoji_id()) { |
| 403 | applyIconId(iconId->v); |
| 404 | } else { |
| 405 | applyIconId(0); |
| 406 | } |
| 407 | applyColorId(data.vicon_color().v); |
| 408 | |
| 409 | applyIsMy(data.is_my()); |
| 410 | setClosed(data.is_closed()); |
| 411 | |
| 412 | if (!min) { |
| 413 | owner().setPinnedFromEntryList(this, data.is_pinned()); |
| 414 | owner().notifySettings().apply(this, data.vnotify_settings()); |
| 415 | |
| 416 | if (const auto draft = data.vdraft()) { |
| 417 | draft->match([&](const MTPDdraftMessage &data) { |
| 418 | Data::ApplyPeerCloudDraft( |
| 419 | &session(), |
| 420 | peer()->id, |
| 421 | _rootId, |
| 422 | PeerId(), |
| 423 | data); |
| 424 | }, [](const MTPDdraftMessageEmpty&) {}); |
| 425 | } |
| 426 | |
| 427 | _replies->setInboxReadTill( |
| 428 | data.vread_inbox_max_id().v, |
| 429 | data.vunread_count().v); |
| 430 | _replies->setOutboxReadTill(data.vread_outbox_max_id().v); |
| 431 | applyTopicTopMessage(data.vtop_message().v); |
| 432 | unreadMentions().setCount(data.vunread_mentions_count().v); |
| 433 | unreadReactions().setCount(data.vunread_reactions_count().v); |
| 434 | unreadPollVotes().setCount(data.vunread_poll_votes_count().v); |
| 435 | } |
| 436 | } |
| 437 | |
| 438 | void ForumTopic::applyCreator(PeerId creatorId) { |
| 439 | if (_creatorId != creatorId) { |
no test coverage detected