Enabled e-mail action in alert dialog and alerts overview action indicators.
This commit is contained in:
+8
-4
@@ -14,7 +14,7 @@ function curateTemplate(template) {
|
||||
};
|
||||
}
|
||||
|
||||
export function curateUser(user, _assets = {}) {
|
||||
export function curateUser(user, _assets = {}, reqUser) {
|
||||
if (!user) {
|
||||
return null;
|
||||
}
|
||||
@@ -24,13 +24,17 @@ export function curateUser(user, _assets = {}) {
|
||||
const curatedUser = {
|
||||
id: user.id,
|
||||
username: user.username,
|
||||
email: user.email,
|
||||
isEmailVerified: user.email_verified,
|
||||
isIdentityVerified: user.identity_verified,
|
||||
avatar: `/media/avatars/${user.id}_${user.username}.png`,
|
||||
role: user.role,
|
||||
abilities: [...user.role_abilities || [], ...user.abilities || []],
|
||||
createdAt: user.created_at,
|
||||
...(reqUser?.id === user.id
|
||||
? {
|
||||
email: user.email,
|
||||
}
|
||||
: null),
|
||||
};
|
||||
|
||||
return curatedUser;
|
||||
@@ -50,7 +54,7 @@ function whereUser(builder, userId, options = {}) {
|
||||
builder.where('users.id', Number(userId));
|
||||
}
|
||||
|
||||
export async function fetchUser(userId, options = {}, _reqUser) {
|
||||
export async function fetchUser(userId, options = {}, reqUser) {
|
||||
const user = await knex('users')
|
||||
.select(knex.raw('users.*, users_roles.abilities as role_abilities'))
|
||||
.modify((builder) => whereUser(builder, userId, options))
|
||||
@@ -68,7 +72,7 @@ export async function fetchUser(userId, options = {}, _reqUser) {
|
||||
}
|
||||
|
||||
// return curateUser(user, { stashes, templates });
|
||||
return curateUser(user, {});
|
||||
return curateUser(user, {}, reqUser);
|
||||
}
|
||||
|
||||
export async function fetchUserTemplates(reqUser) {
|
||||
|
||||
Reference in New Issue
Block a user