mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-11-05 09:33:25 -08:00
Fix remaining review threads on the user alts tab
- Switch to the User Alts tab when it is created, so the first investigate click does not open it in the background. - Treat an empty RespOk as "user not found" and use a generic message for error codes, matching what the server actually returns. - Exclude the depth-0 seed row from the related-account count. - Guard the reply with the requested user name so a stale response cannot overwrite a newer one. - Move the duplicated formatEpoch body into widgets/utility/epoch_format.h.
This commit is contained in:
parent
1e11f78ac2
commit
ff6c0402a8
5 changed files with 51 additions and 11 deletions
27
cockatrice/src/interface/widgets/utility/epoch_format.h
Normal file
27
cockatrice/src/interface/widgets/utility/epoch_format.h
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
/**
|
||||
* @file epoch_format.h
|
||||
* @brief Shared timestamp formatting for the moderation tables.
|
||||
*/
|
||||
|
||||
#ifndef EPOCH_FORMAT_H
|
||||
#define EPOCH_FORMAT_H
|
||||
|
||||
#include <QDateTime>
|
||||
#include <QString>
|
||||
|
||||
/**
|
||||
* @brief Format a unix timestamp the way the moderation tabs show dates.
|
||||
*
|
||||
* @param ts Seconds since the epoch; 0 means "unknown".
|
||||
* @param unknownText Label returned for 0, translated by the caller so the
|
||||
* translation context stays with the tab.
|
||||
*/
|
||||
inline QString formatEpochTimestamp(quint64 ts, const QString &unknownText)
|
||||
{
|
||||
if (ts == 0) {
|
||||
return unknownText;
|
||||
}
|
||||
return QDateTime::fromSecsSinceEpoch(ts).toLocalTime().toString(QStringLiteral("yyyy-MM-dd HH:mm"));
|
||||
}
|
||||
|
||||
#endif // EPOCH_FORMAT_H
|
||||
Loading…
Add table
Add a link
Reference in a new issue