Skip to content
This repository has been archived by the owner on Mar 13, 2024. It is now read-only.

Hide bots and apps UI when managed by Apps Framework #7850

Merged
merged 9 commits into from
Apr 30, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix types and i18n
  • Loading branch information
larkox committed Apr 9, 2021
commit 92360f136e201ce9d3a6683da97b340fc8b0f357
5 changes: 5 additions & 0 deletions components/integrations/bots/bot.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ describe('components/integrations/bots/Bot', () => {
accessTokens={{}}
team={team}
actions={actions}
fromApp={false}
/>,
);

Expand Down Expand Up @@ -79,6 +80,7 @@ describe('components/integrations/bots/Bot', () => {
accessTokens={{}}
team={team}
actions={actions}
fromApp={false}
/>,
);
expect(wrapper.contains(bot.display_name + ' (@' + bot.username + ')')).toEqual(true);
Expand Down Expand Up @@ -122,6 +124,7 @@ describe('components/integrations/bots/Bot', () => {
accessTokens={{}}
team={team}
actions={actions}
fromApp={false}
/>,
);
expect(wrapper.contains(owner.username)).toEqual(true);
Expand Down Expand Up @@ -167,6 +170,7 @@ describe('components/integrations/bots/Bot', () => {
accessTokens={accessTokens}
team={team}
actions={actions}
fromApp={false}
/>,
);

Expand Down Expand Up @@ -206,6 +210,7 @@ describe('components/integrations/bots/Bot', () => {
accessTokens={accessTokens}
team={team}
actions={actions}
fromApp={false}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add a test for a bot that has fromApp={true}?

/>,
);

Expand Down
9 changes: 9 additions & 0 deletions components/integrations/bots/bots.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ describe('components/integrations/bots/Bots', () => {
getUser: jest.fn(),
disableBot: jest.fn(),
enableBot: jest.fn(),
getAppsBotIDs: jest.fn(),
};

it('bots', () => {
Expand All @@ -46,6 +47,8 @@ describe('components/integrations/bots/Bots', () => {
owners={{}}
users={users}
actions={actions}
appsEnabled={false}
appsBotIDs={[]}
/>,
);
wrapperFull.instance().setState({loading: false});
Expand All @@ -60,6 +63,7 @@ describe('components/integrations/bots/Bots', () => {
accessTokens={{}}
team={team}
actions={actions}
fromApp={false}
/>,
)).toEqual(true);
expect(wrapper.find('EnabledSection').shallow().contains(
Expand All @@ -71,6 +75,7 @@ describe('components/integrations/bots/Bots', () => {
accessTokens={{}}
team={team}
actions={actions}
fromApp={false}
/>,
)).toEqual(true);
expect(wrapper.find('EnabledSection').shallow().contains(
Expand All @@ -82,6 +87,7 @@ describe('components/integrations/bots/Bots', () => {
accessTokens={{}}
team={team}
actions={actions}
fromApp={false}
/>,
)).toEqual(true);
});
Expand Down Expand Up @@ -120,6 +126,8 @@ describe('components/integrations/bots/Bots', () => {
owners={owners}
users={users}
actions={actions}
appsEnabled={false}
appsBotIDs={[]}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, can we have some tests that have app bots involved?

/>,
);
wrapperFull.instance().setState({loading: false});
Expand All @@ -134,6 +142,7 @@ describe('components/integrations/bots/Bots', () => {
accessTokens={passedTokens}
team={team}
actions={actions}
fromApp={false}
/>,
)).toEqual(true);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ describe('components/integrations/InstalledOAuthApp', () => {
onRegenerateSecret: jest.fn(),
onDelete: jest.fn(),
filter: '',
fromApp: false,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it make sense to have an apps-related test here?

};

test('should match snapshot', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ describe('components/integrations/InstalledOAuthApps', () => {
deleteOAuthApp: jest.fn(),
},
enableOAuthServiceProvider: true,
appsOAuthAppsIDs: [],
hanzei marked this conversation as resolved.
Show resolved Hide resolved
};

test('should match snapshot', () => {
Expand Down
1 change: 1 addition & 0 deletions i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -3155,6 +3155,7 @@
"installed_integrations.creation": "Created by {creator} on {createAt, date, full}",
"installed_integrations.delete": "Delete",
"installed_integrations.edit": "Edit",
"installed_integrations.fromApp": "Managed by Apps Framework",
"installed_integrations.hideSecret": "Hide Secret",
"installed_integrations.regenSecret": "Regenerate Secret",
"installed_integrations.regenToken": "Regenerate Token",
Expand Down
2 changes: 2 additions & 0 deletions packages/mattermost-redux/src/store/initial_state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@ const state: GlobalState = {
oauthApps: {},
systemCommands: {},
commands: {},
appsBotIDs: [],
appsOAuthAppsIDs: [],
},
files: {
files: {},
Expand Down