-
Notifications
You must be signed in to change notification settings - Fork 10.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: New users page pending tab (#31987)
Co-authored-by: Tasso <[email protected]>
- Loading branch information
Showing
18 changed files
with
408 additions
and
155 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
--- | ||
"@rocket.chat/meteor": minor | ||
"@rocket.chat/core-typings": patch | ||
"@rocket.chat/i18n": patch | ||
--- | ||
|
||
Implemented a new "Pending Users" tab on the users page to list users who have not yet been activated and/or have not logged in for the first time. | ||
Additionally, added a "Pending Action" column to aid administrators in identifying necessary actions for each user. Incorporated a "Reason for Joining" field | ||
into the user info contextual bar, along with a callout for exceeding the seats cap in the users page header. Finally, introduced a new logic to disable user creation buttons upon surpassing the seats cap. | ||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import type { LicenseBehavior, LicenseLimitKind } from '@rocket.chat/core-typings'; | ||
import { validateWarnLimit } from '@rocket.chat/license/src/validation/validateLimit'; | ||
|
||
import { useLicense } from './useLicense'; | ||
|
||
type LicenseLimitsByBehavior = Record<LicenseBehavior, LicenseLimitKind[]>; | ||
|
||
export const useLicenseLimitsByBehavior = () => { | ||
const result = useLicense({ loadValues: true }); | ||
|
||
if (result.isLoading || result.isError) { | ||
return null; | ||
} | ||
|
||
const { license, limits } = result.data; | ||
|
||
if (!license || !limits) { | ||
return null; | ||
} | ||
|
||
const keyLimits = Object.keys(limits) as Array<keyof typeof limits>; | ||
|
||
// Get the rule with the highest limit that applies to this key | ||
const rules = keyLimits | ||
.map((key) => { | ||
const rule = license.limits[key] | ||
?.filter((limit) => validateWarnLimit(limit.max, limits[key].value ?? 0, limit.behavior)) | ||
.reduce<{ max: number; behavior: LicenseBehavior } | null>( | ||
(maxLimit, currentLimit) => (!maxLimit || currentLimit.max > maxLimit.max ? currentLimit : maxLimit), | ||
null, | ||
); | ||
|
||
if (!rule) { | ||
return undefined; | ||
} | ||
|
||
if (rule.max === 0) { | ||
return undefined; | ||
} | ||
|
||
if (rule.max === -1) { | ||
return undefined; | ||
} | ||
|
||
return [key, rule.behavior]; | ||
}) | ||
.filter(Boolean) as Array<[keyof typeof limits, LicenseBehavior]>; | ||
|
||
if (!rules.length) { | ||
return null; | ||
} | ||
|
||
// Group by behavior | ||
return rules.reduce((acc, [key, behavior]) => { | ||
if (!acc[behavior]) { | ||
acc[behavior] = []; | ||
} | ||
|
||
acc[behavior].push(key); | ||
|
||
return acc; | ||
}, {} as LicenseLimitsByBehavior); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.