feat: add better duration selection to ban modal
This commit is contained in:
1 parent
5651ad475d
commit
98cb1992d2
6 files changed
+110
-41
No files matched your search
@@ -76,6 +76,9 @@ const timestamp = (when: string) => publishedToDate(when).getTime()
|
||||
|
||||
export const _toModLog = (item: ModAction): ModLog => {
|
||||
if ('mod_ban_from_community' in item) {
|
||||
const expires = item.mod_ban_from_community.expires
|
||||
? `until ${new Date(item.mod_ban_from_community.expires).toLocaleString()}`
|
||||
: 'permanently'
|
||||
return {
|
||||
moderator: item.moderator,
|
||||
moderatee: item.banned_person,
|
||||
@@ -83,7 +86,7 @@ export const _toModLog = (item: ModAction): ModLog => {
|
||||
actionName: item.mod_ban_from_community.banned
|
||||
? 'banCommunity'
|
||||
: 'unbanCommunity',
|
||||
reason: item.mod_ban_from_community.reason,
|
||||
reason: `${item.mod_ban_from_community.reason ?? ''} (banned ${expires})`,
|
||||
timestamp: timestamp(item.mod_ban_from_community.when_),
|
||||
}
|
||||
} else if ('mod_remove_comment' in item) {
|
||||
@@ -179,12 +182,16 @@ export const _toModLog = (item: ModAction): ModLog => {
|
||||
reason: item.admin_purge_person.reason,
|
||||
}
|
||||
} else if ('mod_ban' in item) {
|
||||
const expires = item.mod_ban.expires
|
||||
? `until ${new Date(item.mod_ban.expires).toLocaleString()}`
|
||||
: 'permanently'
|
||||
|
||||
return {
|
||||
actionName: item.mod_ban.banned ? 'ban' : 'unban',
|
||||
timestamp: timestamp(item.mod_ban.when_),
|
||||
moderator: item.moderator,
|
||||
moderatee: item.banned_person,
|
||||
reason: item.mod_ban.reason,
|
||||
reason: `${item.mod_ban.reason ?? ''} (banned ${expires})`,
|
||||
link: `/u/${fullUserName(item.banned_person)}`,
|
||||
}
|
||||
} else if ('mod_add' in item) {
|
||||
|
||||
Reference in new issue
Block a user