feat: enable folders by default and remove from experimental features

This commit is contained in:
Mo
2022-02-01 12:31:37 -06:00
parent a2d775235e
commit 70f4dd6353
16 changed files with 127 additions and 265 deletions

View File

@@ -42,8 +42,6 @@ export class FeaturesState {
_hasFolders: observable,
_hasSmartTags: observable,
hasFolders: computed,
enableNativeFoldersFeature: computed,
enableNativeSmartTagsFeature: computed,
_premiumAlertFeatureName: observable,
showPremiumAlert: action,
closePremiumAlert: action,
@@ -71,14 +69,6 @@ export class FeaturesState {
this.unsub();
}
public get enableNativeFoldersFeature(): boolean {
return this.enableUnfinishedFeatures;
}
public get enableNativeSmartTagsFeature(): boolean {
return this.enableUnfinishedFeatures;
}
public get hasFolders(): boolean {
return this._hasFolders;
}
@@ -97,10 +87,6 @@ export class FeaturesState {
}
private hasNativeFolders(): boolean {
if (!this.enableNativeFoldersFeature) {
return false;
}
const status = this.application.getFeatureStatus(
FeatureIdentifier.TagNesting
);
@@ -109,10 +95,6 @@ export class FeaturesState {
}
private hasNativeSmartTags(): boolean {
if (!this.enableNativeSmartTagsFeature) {
return false;
}
const status = this.application.getFeatureStatus(
FeatureIdentifier.SmartFilters
);

View File

@@ -172,10 +172,6 @@ export class TagsState {
}
getChildren(tag: SNTag): SNTag[] {
if (!this.features.enableNativeFoldersFeature) {
return [];
}
if (this.application.isTemplateItem(tag)) {
return [];
}
@@ -235,10 +231,6 @@ export class TagsState {
}
get rootTags(): SNTag[] {
if (!this.features.enableNativeFoldersFeature) {
return this.tags;
}
return this.tags.filter((tag) => !this.application.getTagParent(tag));
}
@@ -355,35 +347,20 @@ export class TagsState {
}
if (isTemplateChange) {
if (this.features.enableNativeSmartTagsFeature) {
const isSmartTagTitle = this.application.isSmartTagTitle(newTitle);
const isSmartTagTitle = this.application.isSmartTagTitle(newTitle);
if (isSmartTagTitle) {
if (!this.features.hasSmartTags) {
await this.features.showPremiumAlert(SMART_TAGS_FEATURE_NAME);
return;
}
if (isSmartTagTitle) {
if (!this.features.hasSmartTags) {
await this.features.showPremiumAlert(SMART_TAGS_FEATURE_NAME);
return;
}
const insertedTag = await this.application.createTagOrSmartTag(
newTitle
);
runInAction(() => {
this.selected = insertedTag as SNTag;
});
} else {
// Legacy code, remove me after we enableNativeSmartTagsFeature for everyone.
// See https://app.asana.com/0/0/1201612665552831/f
const insertedTag = await this.application.insertItem(tag);
const changedTag = await this.application.changeItem<TagMutator>(
insertedTag.uuid,
(m) => {
m.title = newTitle;
}
);
this.selected = changedTag as SNTag;
await this.application.saveItem(insertedTag.uuid);
}
const insertedTag = await this.application.createTagOrSmartTag(newTitle);
this.application.sync();
runInAction(() => {
this.selected = insertedTag as SNTag;
});
} else {
await this.application.changeAndSaveItem<TagMutator>(
tag.uuid,