mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-17 22:57:11 +02:00
Show forward original date in context menu.
This commit is contained in:
parent
e9a6bee046
commit
a2b8366477
11 changed files with 49 additions and 19 deletions
BIN
Telegram/Resources/icons/menu/forwarded_status.png
Normal file
BIN
Telegram/Resources/icons/menu/forwarded_status.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 691 B |
BIN
Telegram/Resources/icons/menu/forwarded_status@2x.png
Normal file
BIN
Telegram/Resources/icons/menu/forwarded_status@2x.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.4 KiB |
BIN
Telegram/Resources/icons/menu/forwarded_status@3x.png
Normal file
BIN
Telegram/Resources/icons/menu/forwarded_status@3x.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.1 KiB |
|
@ -756,19 +756,32 @@ rpl::producer<Ui::WhoReadContent> WhoReacted(
|
|||
const style::WhoRead &st) {
|
||||
return WhoReacted(item, reaction, context, st, nullptr);
|
||||
}
|
||||
rpl::producer<Ui::WhoReadContent> WhenEdited(
|
||||
|
||||
[[nodiscard]] rpl::producer<Ui::WhoReadContent> WhenDate(
|
||||
not_null<PeerData*> author,
|
||||
TimeId date) {
|
||||
TimeId date,
|
||||
Ui::WhoReadType type) {
|
||||
return rpl::single(Ui::WhoReadContent{
|
||||
.participants = { Ui::WhoReadParticipant{
|
||||
.name = author->name(),
|
||||
.date = FormatReadDate(date, QDateTime::currentDateTime()),
|
||||
.id = author->id.value,
|
||||
} },
|
||||
.type = Ui::WhoReadType::Edited,
|
||||
.type = type,
|
||||
.fullReadCount = 1,
|
||||
});
|
||||
}
|
||||
|
||||
rpl::producer<Ui::WhoReadContent> WhenEdited(
|
||||
not_null<PeerData*> author,
|
||||
TimeId date) {
|
||||
return WhenDate(author, date, Ui::WhoReadType::Edited);
|
||||
}
|
||||
|
||||
rpl::producer<Ui::WhoReadContent> WhenOriginal(
|
||||
not_null<PeerData*> author,
|
||||
TimeId date) {
|
||||
return WhenDate(author, date, Ui::WhoReadType::Original);
|
||||
}
|
||||
|
||||
} // namespace Api
|
||||
|
|
|
@ -64,5 +64,8 @@ struct WhoReadList {
|
|||
[[nodiscard]] rpl::producer<Ui::WhoReadContent> WhenEdited(
|
||||
not_null<PeerData*> author,
|
||||
TimeId date);
|
||||
[[nodiscard]] rpl::producer<Ui::WhoReadContent> WhenOriginal(
|
||||
not_null<PeerData*> author,
|
||||
TimeId date);
|
||||
|
||||
} // namespace Api
|
||||
|
|
|
@ -2918,7 +2918,7 @@ void HistoryInner::showContextMenu(QContextMenuEvent *e, bool showFromTouch) {
|
|||
leaderOrSelf,
|
||||
_controller);
|
||||
} else if (leaderOrSelf) {
|
||||
HistoryView::MaybeAddWhenEditedAction(_menu, leaderOrSelf);
|
||||
HistoryView::MaybeAddWhenEditedForwardedAction(_menu, leaderOrSelf);
|
||||
}
|
||||
|
||||
if (_menu->empty()) {
|
||||
|
|
|
@ -1286,7 +1286,7 @@ base::unique_qptr<Ui::PopupMenu> FillContextMenu(
|
|||
if (hasWhoReactedItem) {
|
||||
AddWhoReactedAction(result, list, item, list->controller());
|
||||
} else if (item) {
|
||||
MaybeAddWhenEditedAction(result, item);
|
||||
MaybeAddWhenEditedForwardedAction(result, item);
|
||||
}
|
||||
|
||||
return result;
|
||||
|
@ -1457,20 +1457,28 @@ void AddSaveSoundForNotifications(
|
|||
}, &st::menuIconSoundAdd);
|
||||
}
|
||||
|
||||
void AddWhenEditedActionHelper(
|
||||
void AddWhenEditedForwardedActionHelper(
|
||||
not_null<Ui::PopupMenu*> menu,
|
||||
not_null<HistoryItem*> item,
|
||||
bool insertSeparator) {
|
||||
if (item->history()->peer->isUser()) {
|
||||
if (const auto edited = item->Get<HistoryMessageEdited>()) {
|
||||
if (!item->hideEditedBadge()) {
|
||||
if (insertSeparator && !menu->empty()) {
|
||||
menu->addSeparator(&st::expandedMenuSeparator);
|
||||
}
|
||||
menu->addAction(Ui::WhenReadContextAction(
|
||||
menu.get(),
|
||||
Api::WhenEdited(item->from(), edited->date)));
|
||||
if (const auto edited = item->Get<HistoryMessageEdited>()) {
|
||||
if (!item->hideEditedBadge()) {
|
||||
if (insertSeparator && !menu->empty()) {
|
||||
menu->addSeparator(&st::expandedMenuSeparator);
|
||||
}
|
||||
menu->addAction(Ui::WhenReadContextAction(
|
||||
menu.get(),
|
||||
Api::WhenEdited(item->from(), edited->date)));
|
||||
}
|
||||
} else if (const auto forwarded = item->Get<HistoryMessageForwarded>()) {
|
||||
if (!forwarded->story && forwarded->psaType.isEmpty()) {
|
||||
if (insertSeparator && !menu->empty()) {
|
||||
menu->addSeparator(&st::expandedMenuSeparator);
|
||||
}
|
||||
menu->addAction(Ui::WhenReadContextAction(
|
||||
menu.get(),
|
||||
Api::WhenOriginal(item->from(), forwarded->originalDate)));
|
||||
forwarded->originalDate;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1522,8 +1530,8 @@ void AddWhoReactedAction(
|
|||
if (!menu->empty()) {
|
||||
menu->addSeparator(&st::expandedMenuSeparator);
|
||||
}
|
||||
AddWhenEditedActionHelper(menu, item, false);
|
||||
if (item->history()->peer->isUser()) {
|
||||
AddWhenEditedForwardedActionHelper(menu, item, false);
|
||||
menu->addAction(Ui::WhenReadContextAction(
|
||||
menu.get(),
|
||||
Api::WhoReacted(item, context, st::defaultWhoRead, whoReadIds),
|
||||
|
@ -1535,13 +1543,14 @@ void AddWhoReactedAction(
|
|||
Data::ReactedMenuFactory(&controller->session()),
|
||||
participantChosen,
|
||||
showAllChosen));
|
||||
AddWhenEditedForwardedActionHelper(menu, item, true);
|
||||
}
|
||||
}
|
||||
|
||||
void MaybeAddWhenEditedAction(
|
||||
void MaybeAddWhenEditedForwardedAction(
|
||||
not_null<Ui::PopupMenu*> menu,
|
||||
not_null<HistoryItem*> item) {
|
||||
AddWhenEditedActionHelper(menu, item, true);
|
||||
AddWhenEditedForwardedActionHelper(menu, item, true);
|
||||
}
|
||||
|
||||
void AddEditTagAction(
|
||||
|
|
|
@ -84,7 +84,7 @@ void AddWhoReactedAction(
|
|||
not_null<QWidget*> context,
|
||||
not_null<HistoryItem*> item,
|
||||
not_null<Window::SessionController*> controller);
|
||||
void MaybeAddWhenEditedAction(
|
||||
void MaybeAddWhenEditedForwardedAction(
|
||||
not_null<Ui::PopupMenu*> menu,
|
||||
not_null<HistoryItem*> item);
|
||||
void ShowWhoReactedMenu(
|
||||
|
|
|
@ -810,6 +810,8 @@ whoReadReactionsOver: icon{{ "menu/read_reactions", windowBoldFg }};
|
|||
whoReadReactionsDisabled: icon{{ "menu/read_reactions", menuFgDisabled }};
|
||||
whenEdited: icon {{ "menu/edited_status", windowBoldFg }};
|
||||
whenEditedOver: icon {{ "menu/edited_status", windowBoldFg }};
|
||||
whenOriginal: icon {{ "menu/forwarded_status", windowBoldFg }};
|
||||
whenOriginalOver: icon {{ "menu/forwarded_status", windowBoldFg }};
|
||||
|
||||
reactionsTabAll: icon {{ "menu/read_reactions", windowFg }};
|
||||
reactionsTabAllSelected: icon {{ "menu/read_reactions", activeButtonFg }};
|
||||
|
|
|
@ -602,6 +602,8 @@ void WhenAction::paint(Painter &p) {
|
|||
p.fillRect(0, 0, width(), _height, _st.itemBg);
|
||||
const auto &icon = (_content.type == WhoReadType::Edited)
|
||||
? (selected ? st::whenEditedOver : st::whenEdited)
|
||||
: (_content.type == WhoReadType::Original)
|
||||
? (selected ? st::whenOriginalOver : st::whenOriginal)
|
||||
: loading
|
||||
? st::whoReadChecksDisabled
|
||||
: selected
|
||||
|
|
|
@ -37,6 +37,7 @@ enum class WhoReadType {
|
|||
Watched,
|
||||
Reacted,
|
||||
Edited,
|
||||
Original,
|
||||
};
|
||||
|
||||
enum class WhoReadState : uchar {
|
||||
|
|
Loading…
Add table
Reference in a new issue