Skip to content

Commit

Permalink
fix: Team app id in permissions (#183)
Browse files Browse the repository at this point in the history
  • Loading branch information
Gorniaky authored Aug 20, 2023
1 parent 66f2b22 commit af7206e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/structures/AppChildTreeItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export default class AppChildTreeItem extends TreeItem {
super(options.label, options.collapsibleState);
this.description = options.description;
this.iconName = options.iconName;
this.tooltip = options.tooltip ?? `${this.description}: ${this.label}`;
this.tooltip = options.tooltip ?? this.description ? `${this.description}: ${this.label}` : `${this.label}`;
this.appId = options.appId;
if (this.iconName)
this.iconPath = getIconPath(this.iconName);
Expand Down
2 changes: 1 addition & 1 deletion src/structures/TeamAppChildTreeItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export default class TeamAppChildTreeItem extends TreeItem {
super(options.label, options.collapsibleState);
this.description = options.description;
this.iconName = options.iconName;
this.tooltip = options.tooltip ?? `${this.description}: ${this.label}`;
this.tooltip = options.tooltip ?? this.description ? `${this.description}: ${this.label}` : `${this.label}`;
this.appId = options.appId;
if (this.iconName)
this.iconPath = getIconPath(this.iconName);
Expand Down
12 changes: 6 additions & 6 deletions src/structures/TeamAppTreeItem.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { t } from "@vscode/l10n";
import { ApiStatusApp, ApiTeamApps, ModPermissionsBF } from "discloud.app";
import { TreeItem, TreeItemCollapsibleState } from "vscode";
import { TreeItemCollapsibleState } from "vscode";
import { TeamAppTreeItemData } from "../@types";
import { JSONparse, calculatePercentage, getIconName, getIconPath } from "../util";
import BaseTreeItem from "./BaseTreeItem";
Expand Down Expand Up @@ -110,14 +110,14 @@ export default class TeamAppTreeItem extends BaseTreeItem<TeamAppChildTreeItem>
const values = this.contextValue.match(/([^\W]+)(?:\W(.*))?/) ?? [];
const json = values[2] ? JSONparse(values[2]) : null;

this.contextValue = `${values[1]}.${JSON.stringify({
...json,
perms: data.perms,
})}`;
this.contextValue = `${values[1]}.${JSON.stringify(Object.assign({}, json, data.perms))}`;

this.children.set("perms", new TeamAppChildTreeItem({
label: t("permissions{s}", { s: `[${data.perms?.length}/${totalModPerms}]` }),
children: data.perms?.map(perm => new TreeItem(t(`permission.${perm}`))),
children: data.perms?.map(perm => new TeamAppChildTreeItem({
label: t(`permission.${perm}`),
appId: this.appId,
})),
appId: this.appId,
collapsibleState: TreeItemCollapsibleState.Collapsed,
}));
Expand Down

0 comments on commit af7206e

Please sign in to comment.