mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2026-07-25 06:54:43 +00:00
fix: show date & counter in dialogs when last message is filtered
This commit is contained in:
@@ -38,6 +38,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||||||
|
|
||||||
// AyuGram includes
|
// AyuGram includes
|
||||||
#include "ayu/ayu_settings.h"
|
#include "ayu/ayu_settings.h"
|
||||||
|
#include "ayu/features/filters/filters_controller.h"
|
||||||
#include "ayu/ui/ayu_userpic.h"
|
#include "ayu/ui/ayu_userpic.h"
|
||||||
|
|
||||||
|
|
||||||
@@ -774,6 +775,7 @@ void FakeRow::invalidateTopic() {
|
|||||||
const Ui::Text::String &FakeRow::name() const {
|
const Ui::Text::String &FakeRow::name() const {
|
||||||
if (_name.isEmpty()) {
|
if (_name.isEmpty()) {
|
||||||
const auto from = _searchInChat
|
const auto from = _searchInChat
|
||||||
|
&& !FiltersController::filtered(_item)
|
||||||
? _item->displayFrom()
|
? _item->displayFrom()
|
||||||
: nullptr;
|
: nullptr;
|
||||||
const auto peer = from ? from : _item->history()->peer.get();
|
const auto peer = from ? from : _item->history()->peer.get();
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||||||
#include "styles/style_window.h"
|
#include "styles/style_window.h"
|
||||||
|
|
||||||
// AyuGram includes
|
// AyuGram includes
|
||||||
|
#include "ayu/features/filters/filters_controller.h"
|
||||||
#include "styles/style_ayu_icons.h"
|
#include "styles/style_ayu_icons.h"
|
||||||
|
|
||||||
|
|
||||||
@@ -427,6 +428,11 @@ void PaintRow(
|
|||||||
const auto history = entry->asHistory();
|
const auto history = entry->asHistory();
|
||||||
const auto thread = entry->asThread();
|
const auto thread = entry->asThread();
|
||||||
const auto sublist = entry->asSublist();
|
const auto sublist = entry->asSublist();
|
||||||
|
const auto itemIsFiltered = item && FiltersController::filtered(item);
|
||||||
|
const auto itemIsEmpty = item && (item->isEmpty() || itemIsFiltered);
|
||||||
|
const auto showFilteredItem = !fakeRow
|
||||||
|
&& itemIsEmpty
|
||||||
|
&& itemIsFiltered;
|
||||||
|
|
||||||
auto bg = context.active
|
auto bg = context.active
|
||||||
? st::dialogsBgActive
|
? st::dialogsBgActive
|
||||||
@@ -517,7 +523,9 @@ void PaintRow(
|
|||||||
PaintExpandedTopicsBar(p, context.topicsExpanded);
|
PaintExpandedTopicsBar(p, context.topicsExpanded);
|
||||||
}
|
}
|
||||||
if (context.narrow) {
|
if (context.narrow) {
|
||||||
if (!draft && item && !item->isEmpty()) {
|
if (!draft
|
||||||
|
&& item
|
||||||
|
&& (!itemIsEmpty || showFilteredItem)) {
|
||||||
PaintNarrowCounter(p, context, badgesState);
|
PaintNarrowCounter(p, context, badgesState);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
@@ -738,7 +746,7 @@ void PaintRow(
|
|||||||
context.now)) {
|
context.now)) {
|
||||||
// Empty history
|
// Empty history
|
||||||
}
|
}
|
||||||
} else if (!item->isEmpty()) {
|
} else if (!itemIsEmpty || showFilteredItem) {
|
||||||
if ((thread || sublist) && !promoted) {
|
if ((thread || sublist) && !promoted) {
|
||||||
PaintDialogDate(p, entry, fakeRow, date, rectForName, context);
|
PaintDialogDate(p, entry, fakeRow, date, rectForName, context);
|
||||||
}
|
}
|
||||||
@@ -1201,21 +1209,28 @@ void RowPainter::Paint(
|
|||||||
not_null<const FakeRow*> row,
|
not_null<const FakeRow*> row,
|
||||||
const PaintContext &context) {
|
const PaintContext &context) {
|
||||||
const auto item = row->item();
|
const auto item = row->item();
|
||||||
|
const auto itemIsFiltered = FiltersController::filtered(item);
|
||||||
const auto topic = context.forum ? row->topic() : nullptr;
|
const auto topic = context.forum ? row->topic() : nullptr;
|
||||||
const auto history = topic ? nullptr : item->history().get();
|
const auto history = topic ? nullptr : item->history().get();
|
||||||
const auto entry = topic ? (Entry*)topic : (Entry*)history;
|
const auto entry = topic ? (Entry*)topic : (Entry*)history;
|
||||||
auto cloudDraft = nullptr;
|
auto cloudDraft = nullptr;
|
||||||
const auto from = [&] {
|
const auto from = [&] {
|
||||||
const auto in = row->searchInChat();
|
const auto in = row->searchInChat();
|
||||||
return (topic && (in.topic() != topic))
|
if (topic && (in.topic() != topic)) {
|
||||||
? nullptr
|
return (PeerData*)nullptr;
|
||||||
: in
|
} else if (in && !itemIsFiltered) {
|
||||||
? item->displayFrom()
|
return item->displayFrom();
|
||||||
: history->peer->migrateTo()
|
} else if (!history) {
|
||||||
|
return (PeerData*)nullptr;
|
||||||
|
}
|
||||||
|
return history->peer->migrateTo()
|
||||||
? history->peer->migrateTo()
|
? history->peer->migrateTo()
|
||||||
: history->peer.get();
|
: history->peer.get();
|
||||||
}();
|
}();
|
||||||
const auto hiddenSenderInfo = [&]() -> const HiddenSenderInfo* {
|
const auto hiddenSenderInfo = [&]() -> const HiddenSenderInfo* {
|
||||||
|
if (itemIsFiltered) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
if (const auto searchChat = row->searchInChat()) {
|
if (const auto searchChat = row->searchInChat()) {
|
||||||
if (const auto peer = searchChat.peer()) {
|
if (const auto peer = searchChat.peer()) {
|
||||||
if (const auto forwarded = item->Get<HistoryMessageForwarded>()) {
|
if (const auto forwarded = item->Get<HistoryMessageForwarded>()) {
|
||||||
|
|||||||
@@ -75,6 +75,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||||||
|
|
||||||
// AyuGram includes
|
// AyuGram includes
|
||||||
#include "ayu/ayu_settings.h"
|
#include "ayu/ayu_settings.h"
|
||||||
|
#include "ayu/features/filters/filters_controller.h"
|
||||||
#include "ayu/features/message_shot/message_shot.h"
|
#include "ayu/features/message_shot/message_shot.h"
|
||||||
#include "ayu/utils/telegram_helpers.h"
|
#include "ayu/utils/telegram_helpers.h"
|
||||||
#include "ui/emoji_config.h"
|
#include "ui/emoji_config.h"
|
||||||
@@ -4329,6 +4330,10 @@ TextWithEntities HistoryItem::notificationText(
|
|||||||
}
|
}
|
||||||
|
|
||||||
ItemPreview HistoryItem::toPreview(ToPreviewOptions options) const {
|
ItemPreview HistoryItem::toPreview(ToPreviewOptions options) const {
|
||||||
|
if (FiltersController::filtered(const_cast<HistoryItem*>(this))) {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
if (isService()) {
|
if (isService()) {
|
||||||
const_cast<HistoryItem*>(this)->resolveDependent();
|
const_cast<HistoryItem*>(this)->resolveDependent();
|
||||||
|
|
||||||
|
|||||||
@@ -62,7 +62,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||||||
#include <QtGui/QGuiApplication>
|
#include <QtGui/QGuiApplication>
|
||||||
|
|
||||||
// AyuGram includes
|
// AyuGram includes
|
||||||
#include "ayu/ayu_settings.h"
|
|
||||||
#include "ayu/features/filters/filters_controller.h"
|
#include "ayu/features/filters/filters_controller.h"
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
@@ -533,18 +532,6 @@ void HistoryMessageReply::updateData(
|
|||||||
&& (asExternal || _fields.manualQuote);
|
&& (asExternal || _fields.manualQuote);
|
||||||
_multiline = !_fields.storyId && (asExternal || nonEmptyQuote);
|
_multiline = !_fields.storyId && (asExternal || nonEmptyQuote);
|
||||||
|
|
||||||
const auto &settings = AyuSettings::getInstance();
|
|
||||||
const auto author = resolvedMessage
|
|
||||||
? resolvedMessage->from().get()
|
|
||||||
: resolvedStory
|
|
||||||
? resolvedStory->peer().get()
|
|
||||||
: nullptr;
|
|
||||||
const auto blocked = settings.hideFromBlocked()
|
|
||||||
&& author
|
|
||||||
&& author->isUser()
|
|
||||||
&& author->asUser()->isBlocked();
|
|
||||||
|
|
||||||
|
|
||||||
const auto filtered = resolvedMessage &&
|
const auto filtered = resolvedMessage &&
|
||||||
!resolvedMessage.empty() &&
|
!resolvedMessage.empty() &&
|
||||||
FiltersController::filtered(resolvedMessage.get());
|
FiltersController::filtered(resolvedMessage.get());
|
||||||
@@ -553,12 +540,12 @@ void HistoryMessageReply::updateData(
|
|||||||
|| resolvedStory
|
|| resolvedStory
|
||||||
|| ((nonEmptyQuote || _fields.externalMedia)
|
|| ((nonEmptyQuote || _fields.externalMedia)
|
||||||
&& (!_fields.messageId || force));
|
&& (!_fields.messageId || force));
|
||||||
_displaying = displaying && !blocked && !filtered ? 1 : 0;
|
_displaying = displaying && !filtered ? 1 : 0;
|
||||||
|
|
||||||
const auto unavailable = !resolvedMessage
|
const auto unavailable = !resolvedMessage
|
||||||
&& !resolvedStory
|
&& !resolvedStory
|
||||||
&& ((!_fields.storyId && !_fields.messageId) || force);
|
&& ((!_fields.storyId && !_fields.messageId) || force);
|
||||||
_unavailable = unavailable && !blocked && !filtered ? 1 : 0;
|
_unavailable = (unavailable || filtered) ? 1 : 0;
|
||||||
|
|
||||||
if (force) {
|
if (force) {
|
||||||
if (!_displaying && (_fields.messageId || _fields.storyId)) {
|
if (!_displaying && (_fields.messageId || _fields.storyId)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user