fix: only return activated features (#5536)
This commit is contained in:
@@ -92,7 +92,7 @@ export class FeatureManagementService {
|
|||||||
|
|
||||||
async getWorkspaceFeatures(workspaceId: string) {
|
async getWorkspaceFeatures(workspaceId: string) {
|
||||||
const features = await this.feature.getWorkspaceFeatures(workspaceId);
|
const features = await this.feature.getWorkspaceFeatures(workspaceId);
|
||||||
return features.map(feature => feature.feature.name);
|
return features.filter(f => f.activated).map(f => f.feature.name);
|
||||||
}
|
}
|
||||||
|
|
||||||
async hasWorkspaceFeature(workspaceId: string, feature: FeatureType) {
|
async hasWorkspaceFeature(workspaceId: string, feature: FeatureType) {
|
||||||
|
|||||||
@@ -126,6 +126,11 @@ export class FeatureService {
|
|||||||
.then(r => r.count);
|
.then(r => r.count);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* get user's features, will included inactivated features
|
||||||
|
* @param userId user id
|
||||||
|
* @returns list of features
|
||||||
|
*/
|
||||||
async getUserFeatures(userId: string) {
|
async getUserFeatures(userId: string) {
|
||||||
const features = await this.prisma.userFeatures.findMany({
|
const features = await this.prisma.userFeatures.findMany({
|
||||||
where: {
|
where: {
|
||||||
@@ -265,6 +270,11 @@ export class FeatureService {
|
|||||||
.then(r => r.count);
|
.then(r => r.count);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* get workspace's features, will included inactivated features
|
||||||
|
* @param workspaceId workspace id
|
||||||
|
* @returns list of features
|
||||||
|
*/
|
||||||
async getWorkspaceFeatures(workspaceId: string) {
|
async getWorkspaceFeatures(workspaceId: string) {
|
||||||
const features = await this.prisma.workspaceFeatures.findMany({
|
const features = await this.prisma.workspaceFeatures.findMany({
|
||||||
where: {
|
where: {
|
||||||
|
|||||||
Reference in New Issue
Block a user