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->data().sendHistoryChangeNotifications();
session->changes().historyUpdated( if (!itemToEdit) {
history, session->changes().historyUpdated(
Data::HistoryUpdate::Flag::MessageSent); history,
(action.options.scheduled
? Data::HistoryUpdate::Flag::ScheduledSent
: Data::HistoryUpdate::Flag::MessageSent));
}
} }
} // namespace Api } // namespace Api

View file

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

View file

@ -109,12 +109,13 @@ struct HistoryUpdate {
LocalMessages = (1 << 5), LocalMessages = (1 << 5),
ChatOccupied = (1 << 6), ChatOccupied = (1 << 6),
MessageSent = (1 << 7), MessageSent = (1 << 7),
ForwardDraft = (1 << 8), ScheduledSent = (1 << 8),
OutboxRead = (1 << 9), ForwardDraft = (1 << 9),
BotKeyboard = (1 << 10), OutboxRead = (1 << 10),
CloudDraft = (1 << 11), BotKeyboard = (1 << 11),
CloudDraft = (1 << 12),
LastUsedBit = (1 << 11), LastUsedBit = (1 << 12),
}; };
using Flags = base::flags<Flag>; using Flags = base::flags<Flag>;
friend inline constexpr auto is_flag_type(Flag) { return true; } 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( session().changes().historyUpdated(
_history, _history,
Data::HistoryUpdate::Flag::MessageSent); (options.scheduled
? Data::HistoryUpdate::Flag::ScheduledSent
: Data::HistoryUpdate::Flag::MessageSent));
} }
void HistoryWidget::sendWithModifiers(Qt::KeyboardModifiers modifiers) { void HistoryWidget::sendWithModifiers(Qt::KeyboardModifiers modifiers) {