| 411 | } |
| 412 | |
| 413 | TimeId SortByOnlineValue(not_null<UserData*> user, TimeId now) { |
| 414 | if (user->isServiceUser() || user->isBot()) { |
| 415 | return -1; |
| 416 | } |
| 417 | const auto lastseen = user->lastseen(); |
| 418 | if (const auto till = lastseen.onlineTill()) { |
| 419 | return till; |
| 420 | } else if (lastseen.isRecently()) { |
| 421 | return now - 3 * kSecondsInDay; |
| 422 | } else if (lastseen.isWithinWeek()) { |
| 423 | return now - 7 * kSecondsInDay; |
| 424 | } else if (lastseen.isWithinMonth()) { |
| 425 | return now - 30 * kSecondsInDay; |
| 426 | } else { |
| 427 | return 0; |
| 428 | } |
| 429 | } |
| 430 | |
| 431 | crl::time OnlineChangeTimeout(Data::LastseenStatus status, TimeId now) { |
| 432 | const auto result = OnlinePhraseChangeInSeconds(status, now); |
no test coverage detected