2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-09-03 08:05:12 +00:00

Fix localtime-related slowmode errors.

This commit is contained in:
John Preston
2019-08-20 12:42:13 +03:00
parent 1a06714f3a
commit e1fe373504
9 changed files with 35 additions and 25 deletions

View File

@@ -713,10 +713,11 @@ bool PeerData::slowmodeApplied() const {
int PeerData::slowmodeSecondsLeft() const {
if (const auto channel = asChannel()) {
if (const auto last = channel->slowmodeLastMessage()) {
const auto seconds = channel->slowmodeSeconds();
const auto now = base::unixtime::now();
return std::max(seconds - (now - last), 0);
if (const auto seconds = channel->slowmodeSeconds()) {
if (const auto last = channel->slowmodeLastMessage()) {
const auto now = base::unixtime::now();
return std::max(seconds - (now - last), 0);
}
}
}
return 0;