feat: Improve translations, fade inactive collection members
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
import { subMinutes } from "date-fns";
|
||||
import { computed, observable } from "mobx";
|
||||
import { now } from "mobx-utils";
|
||||
import type { Role } from "@shared/types";
|
||||
import ParanoidModel from "./ParanoidModel";
|
||||
import Field from "./decorators/Field";
|
||||
@@ -39,6 +41,17 @@ class User extends ParanoidModel {
|
||||
return !this.lastActiveAt;
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the user has been recently active. Recently is currently defined
|
||||
* as within the last 5 minutes.
|
||||
*
|
||||
* @returns true if the user has been active recently
|
||||
*/
|
||||
@computed
|
||||
get isRecentlyActive(): boolean {
|
||||
return new Date(this.lastActiveAt) > subMinutes(now(10000), 5);
|
||||
}
|
||||
|
||||
@computed
|
||||
get role(): Role {
|
||||
if (this.isAdmin) {
|
||||
|
||||
Reference in New Issue
Block a user