mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-01-27 09:45:02 +00:00
Improve display of admin event log entries.
Don't show the Forward, Delete and Go to message in MediaView. Better handle round video floating player in admin event log.
This commit is contained in:
parent
0b3644b334
commit
836fe119d9
@ -238,6 +238,7 @@ void InnerWidget::setVisibleTopBottom(int visibleTop, int visibleBottom) {
|
||||
} else {
|
||||
scrollDateHideByTimer();
|
||||
}
|
||||
_controller->floatPlayerAreaUpdated().notify(true);
|
||||
}
|
||||
|
||||
void InnerWidget::updateVisibleTopItem() {
|
||||
|
@ -814,7 +814,7 @@ bool HistoryItem::canPin() const {
|
||||
}
|
||||
|
||||
bool HistoryItem::canForward() const {
|
||||
if (id < 0) {
|
||||
if (id < 0 || isLogEntry()) {
|
||||
return false;
|
||||
}
|
||||
if (auto message = toHistoryMessage()) {
|
||||
@ -863,6 +863,9 @@ bool HistoryItem::canEdit(const QDateTime &cur) const {
|
||||
}
|
||||
|
||||
bool HistoryItem::canDelete() const {
|
||||
if (isLogEntry()) {
|
||||
return false;
|
||||
}
|
||||
auto channel = _history->peer->asChannel();
|
||||
if (!channel) {
|
||||
return !(_flags & MTPDmessage_ClientFlag::f_is_group_migrate);
|
||||
|
@ -350,11 +350,11 @@ void MainWidget::checkFloatPlayerVisibility() {
|
||||
return;
|
||||
}
|
||||
|
||||
if (_history->isHidden() || _history->isItemCompletelyHidden(instance->widget->item())) {
|
||||
instance->hiddenByHistory = false;
|
||||
} else {
|
||||
instance->hiddenByHistory = true;
|
||||
auto amVisible = false;
|
||||
if (auto item = instance->widget->item()) {
|
||||
AuthSession::Current().data().queryItemVisibility().notify({ item, &amVisible }, true);
|
||||
}
|
||||
instance->hiddenByHistory = amVisible;
|
||||
toggleFloatPlayer(instance);
|
||||
updateFloatPlayerPosition(instance);
|
||||
}
|
||||
|
@ -419,7 +419,7 @@ void MediaView::updateActions() {
|
||||
if (_doc && _doc->loading()) {
|
||||
_actions.push_back({ lang(lng_cancel), SLOT(onSaveCancel()) });
|
||||
}
|
||||
if (_msgid > 0) {
|
||||
if (_msgid > 0 && _msgid < ServerMaxMsgId) {
|
||||
_actions.push_back({ lang(lng_context_to_msg), SLOT(onToMessage()) });
|
||||
}
|
||||
if (_doc && !_doc->filepath(DocumentData::FilePathResolveChecked).isEmpty()) {
|
||||
@ -749,7 +749,7 @@ void MediaView::onScreenResized(int screen) {
|
||||
}
|
||||
|
||||
void MediaView::onToMessage() {
|
||||
if (HistoryItem *item = _msgid ? App::histItemById(_msgmigrated ? 0 : _channel, _msgid) : 0) {
|
||||
if (auto item = _msgid ? App::histItemById(_msgmigrated ? 0 : _channel, _msgid) : 0) {
|
||||
if (App::wnd()) {
|
||||
close();
|
||||
Ui::showPeerHistoryAtItem(item);
|
||||
@ -950,7 +950,7 @@ void MediaView::onShowInFolder() {
|
||||
}
|
||||
|
||||
void MediaView::onForward() {
|
||||
HistoryItem *item = App::histItemById(_msgmigrated ? 0 : _channel, _msgid);
|
||||
auto item = App::histItemById(_msgmigrated ? 0 : _channel, _msgid);
|
||||
if (!_msgid || !item) return;
|
||||
|
||||
if (App::wnd()) {
|
||||
@ -1039,7 +1039,7 @@ void MediaView::showPhoto(PhotoData *photo, HistoryItem *context) {
|
||||
_msgid = context ? context->id : 0;
|
||||
_msgmigrated = context ? (context->history() == _migrated) : false;
|
||||
_channel = _history ? _history->channelId() : NoChannel;
|
||||
_canForward = _msgid > 0;
|
||||
_canForward = context ? context->canForward() : false;
|
||||
_canDelete = context ? context->canDelete() : false;
|
||||
_photo = photo;
|
||||
if (_history) {
|
||||
@ -1156,7 +1156,7 @@ void MediaView::showDocument(DocumentData *doc, HistoryItem *context) {
|
||||
_msgid = context ? context->id : 0;
|
||||
_msgmigrated = context ? (context->history() == _migrated) : false;
|
||||
_channel = _history ? _history->channelId() : NoChannel;
|
||||
_canForward = _msgid > 0;
|
||||
_canForward = context ? context->canForward() : false;
|
||||
_canDelete = context ? context->canDelete() : false;
|
||||
if (_history) {
|
||||
_overview = doc->isGifv() ? OverviewGIFs : doc->isVideo() ? OverviewVideos : OverviewFiles;
|
||||
@ -2148,7 +2148,7 @@ bool MediaView::moveToNext(int32 delta) {
|
||||
}
|
||||
_msgid = lastChatPhoto.item->id;
|
||||
_channel = _history ? _history->channelId() : NoChannel;
|
||||
_canForward = _msgid > 0;
|
||||
_canForward = lastChatPhoto.item->canForward();
|
||||
_canDelete = lastChatPhoto.item->canDelete();
|
||||
displayPhoto(lastChatPhoto.photo, lastChatPhoto.item);
|
||||
preloadData(delta);
|
||||
@ -2179,12 +2179,12 @@ bool MediaView::moveToNext(int32 delta) {
|
||||
newMigrated = false;
|
||||
}
|
||||
if (newIndex >= 0 && newIndex < (newMigrated ? _migrated : _history)->overview[_overview].size()) {
|
||||
if (HistoryItem *item = App::histItemById(newMigrated ? 0 : _channel, (newMigrated ? _migrated : _history)->overview[_overview][newIndex])) {
|
||||
if (auto item = App::histItemById(newMigrated ? 0 : _channel, (newMigrated ? _migrated : _history)->overview[_overview][newIndex])) {
|
||||
_index = newIndex;
|
||||
_msgid = item->id;
|
||||
_msgmigrated = (item->history() == _migrated);
|
||||
_channel = _history ? _history->channelId() : NoChannel;
|
||||
_canForward = _msgid > 0;
|
||||
_canForward = item->canForward();
|
||||
_canDelete = item->canDelete();
|
||||
stopGif();
|
||||
if (auto media = item->getMedia()) {
|
||||
@ -2489,7 +2489,7 @@ void MediaView::updateOver(QPoint pos) {
|
||||
updateOverState(OverRightNav);
|
||||
} else if (_nameNav.contains(pos)) {
|
||||
updateOverState(OverName);
|
||||
} else if (_msgid && _dateNav.contains(pos)) {
|
||||
} else if ((_msgid > 0 && _msgid < ServerMaxMsgId) && _dateNav.contains(pos)) {
|
||||
updateOverState(OverDate);
|
||||
} else if (_headerHasLink && _headerNav.contains(pos)) {
|
||||
updateOverState(OverHeader);
|
||||
|
Loading…
Reference in New Issue
Block a user