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