Don't mark as read when scheduling messages.

This commit is contained in:
John Preston 2020-07-23 17:46:52 +04:00
parent 79e6369e27
commit d4feb16378
4 changed files with 26 additions and 13 deletions

View file

@ -525,9 +525,13 @@ void SendConfirmedFile(
}
session->data().sendHistoryChangeNotifications();
session->changes().historyUpdated(
history,
Data::HistoryUpdate::Flag::MessageSent);
if (!itemToEdit) {
session->changes().historyUpdated(
history,
(action.options.scheduled
? Data::HistoryUpdate::Flag::ScheduledSent
: Data::HistoryUpdate::Flag::MessageSent));
}
}
} // namespace Api

View file

@ -3903,8 +3903,10 @@ void ApiWrap::userPhotosDone(
//}
void ApiWrap::sendAction(const SendAction &action) {
_session->data().histories().readInbox(action.history);
action.history->getReadyFor(ShowAtTheEndMsgId);
if (!action.options.scheduled) {
_session->data().histories().readInbox(action.history);
action.history->getReadyFor(ShowAtTheEndMsgId);
}
_sendActions.fire_copy(action);
}
@ -3924,7 +3926,9 @@ void ApiWrap::finishForwarding(const SendAction &action) {
_session->data().sendHistoryChangeNotifications();
_session->changes().historyUpdated(
history,
Data::HistoryUpdate::Flag::MessageSent);
(action.options.scheduled
? Data::HistoryUpdate::Flag::ScheduledSent
: Data::HistoryUpdate::Flag::MessageSent));
}
void ApiWrap::forwardMessages(
@ -4164,7 +4168,9 @@ void ApiWrap::sendSharedContact(
_session->data().sendHistoryChangeNotifications();
_session->changes().historyUpdated(
history,
Data::HistoryUpdate::Flag::MessageSent);
(action.options.scheduled
? Data::HistoryUpdate::Flag::ScheduledSent
: Data::HistoryUpdate::Flag::MessageSent));
}
void ApiWrap::sendVoiceMessage(

View file

@ -109,12 +109,13 @@ struct HistoryUpdate {
LocalMessages = (1 << 5),
ChatOccupied = (1 << 6),
MessageSent = (1 << 7),
ForwardDraft = (1 << 8),
OutboxRead = (1 << 9),
BotKeyboard = (1 << 10),
CloudDraft = (1 << 11),
ScheduledSent = (1 << 8),
ForwardDraft = (1 << 9),
OutboxRead = (1 << 10),
BotKeyboard = (1 << 11),
CloudDraft = (1 << 12),
LastUsedBit = (1 << 11),
LastUsedBit = (1 << 12),
};
using Flags = base::flags<Flag>;
friend inline constexpr auto is_flag_type(Flag) { return true; }

View file

@ -3116,7 +3116,9 @@ void HistoryWidget::send(Api::SendOptions options) {
}
session().changes().historyUpdated(
_history,
Data::HistoryUpdate::Flag::MessageSent);
(options.scheduled
? Data::HistoryUpdate::Flag::ScheduledSent
: Data::HistoryUpdate::Flag::MessageSent));
}
void HistoryWidget::sendWithModifiers(Qt::KeyboardModifiers modifiers) {