mirror of
https://github.com/jech/galene.git
synced 2024-11-09 18:25:58 +01:00
Improve token formatting.
This commit is contained in:
parent
cfb5d936ee
commit
1afd995844
1 changed files with 9 additions and 3 deletions
|
@ -2704,13 +2704,19 @@ function formatToken(token, details) {
|
||||||
if(token.group)
|
if(token.group)
|
||||||
togroup = ' to group ' + token.group;
|
togroup = ' to group ' + token.group;
|
||||||
}
|
}
|
||||||
|
let since = '';
|
||||||
|
if(token["not-before"])
|
||||||
|
since = ` since ${(new Date(token['not-before'])).toLocaleString()}`
|
||||||
/** @type{Date} */
|
/** @type{Date} */
|
||||||
let expires = null;
|
let expires = null;
|
||||||
if(token.expires)
|
let until = '';
|
||||||
expires = new Date(token.expires);
|
if(token.expires) {
|
||||||
|
expires = new Date(token.expires)
|
||||||
|
until = ` until ${expires.toLocaleString()}`;
|
||||||
|
}
|
||||||
return [
|
return [
|
||||||
(expires && (expires >= new Date())) ?
|
(expires && (expires >= new Date())) ?
|
||||||
`Invitation${foruser}${togroup}${by} valid until ${expires.toLocaleString()}` :
|
`Invitation${foruser}${togroup}${by} valid${since}${until}` :
|
||||||
`Expired invitation${foruser}${togroup}${by}`,
|
`Expired invitation${foruser}${togroup}${by}`,
|
||||||
url.toString(),
|
url.toString(),
|
||||||
];
|
];
|
||||||
|
|
Loading…
Reference in a new issue