| 664 | } |
| 665 | |
| 666 | bool MainWidget::filesOrForwardDrop( |
| 667 | not_null<Data::Thread*> thread, |
| 668 | not_null<const QMimeData*> data, |
| 669 | bool forumResolved) { |
| 670 | if (!forumResolved) { |
| 671 | if (const auto forum = thread->asForum()) { |
| 672 | Window::ShowDropMediaBox( |
| 673 | _controller, |
| 674 | Core::ShareMimeMediaData(data), |
| 675 | forum); |
| 676 | if (_hider) { |
| 677 | _hider->startHide(); |
| 678 | clearHider(_hider); |
| 679 | } |
| 680 | return true; |
| 681 | } else if (const auto history = thread->asHistory() |
| 682 | ; history && history->peer->monoforum()) { |
| 683 | Window::ShowDropMediaBox( |
| 684 | _controller, |
| 685 | Core::ShareMimeMediaData(data), |
| 686 | history->peer->monoforum()); |
| 687 | if (_hider) { |
| 688 | _hider->startHide(); |
| 689 | clearHider(_hider); |
| 690 | } |
| 691 | return true; |
| 692 | } |
| 693 | } |
| 694 | if (data->hasFormat(u"application/x-td-forward"_q)) { |
| 695 | auto draft = Data::ForwardDraft{ |
| 696 | .ids = session().data().takeMimeForwardIds(), |
| 697 | }; |
| 698 | if (setForwardDraft(thread, std::move(draft))) { |
| 699 | return true; |
| 700 | } |
| 701 | // We've already released the mouse button, |
| 702 | // so the forwarding is cancelled. |
| 703 | if (_hider) { |
| 704 | _hider->startHide(); |
| 705 | clearHider(_hider); |
| 706 | } |
| 707 | return false; |
| 708 | } else if (!Data::CanSendAnyOf(thread, Data::FilesSendRestrictions())) { |
| 709 | _controller->showToast( |
| 710 | tr::lng_forward_send_files_cant(tr::now)); |
| 711 | return false; |
| 712 | } else if (const auto error = Data::AnyFileRestrictionError( |
| 713 | thread->peer())) { |
| 714 | Data::ShowSendErrorToast(_controller, thread->peer(), error); |
| 715 | return false; |
| 716 | } else { |
| 717 | _controller->showThread( |
| 718 | thread, |
| 719 | ShowAtTheEndMsgId, |
| 720 | Window::SectionShow::Way::ClearStack); |
| 721 | if (_controller->activeChatCurrent().thread() != thread) { |
| 722 | return false; |
| 723 | } |
no test coverage detected