mirror of
https://github.com/toeverything/AFFiNE.git
synced 2024-11-22 07:52:07 +03:00
fix: only return activated features (#5536)
This commit is contained in:
parent
d7b9462d1c
commit
b9fa002e67
@ -92,7 +92,7 @@ export class FeatureManagementService {
|
||||
|
||||
async getWorkspaceFeatures(workspaceId: string) {
|
||||
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) {
|
||||
|
@ -126,6 +126,11 @@ export class FeatureService {
|
||||
.then(r => r.count);
|
||||
}
|
||||
|
||||
/**
|
||||
* get user's features, will included inactivated features
|
||||
* @param userId user id
|
||||
* @returns list of features
|
||||
*/
|
||||
async getUserFeatures(userId: string) {
|
||||
const features = await this.prisma.userFeatures.findMany({
|
||||
where: {
|
||||
@ -265,6 +270,11 @@ export class FeatureService {
|
||||
.then(r => r.count);
|
||||
}
|
||||
|
||||
/**
|
||||
* get workspace's features, will included inactivated features
|
||||
* @param workspaceId workspace id
|
||||
* @returns list of features
|
||||
*/
|
||||
async getWorkspaceFeatures(workspaceId: string) {
|
||||
const features = await this.prisma.workspaceFeatures.findMany({
|
||||
where: {
|
||||
|
Loading…
Reference in New Issue
Block a user