Skip to content

Commit

Permalink
Removed yammer command aliases. Closes #5764
Browse files Browse the repository at this point in the history
  • Loading branch information
SmitaNachan authored and milanholemans committed Aug 24, 2024
1 parent b26c683 commit bb81ff0
Show file tree
Hide file tree
Showing 48 changed files with 49 additions and 631 deletions.
2 changes: 1 addition & 1 deletion docs/docs/cmd/cli/cli-consent.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ m365 cli consent [options]

```md definition-list
`-s, --service <service>`
: Service for which to consent permissions. Allowed values: `VivaEngage`, (deprecated)`yammer`.
: Service for which to consent permissions. Allowed values: `VivaEngage`.
```

<Global />
Expand Down
34 changes: 34 additions & 0 deletions docs/docs/v9-upgrade-guidance.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -174,3 +174,37 @@ Overwriting the SPFx package should be the default behavior of the continuous de
#### What action do I need to take?

Please update your scripts not to use the `overwrite` option.

## Yammer (Viva Engage)

### Removal of deprecated Yammer aliases

We have removed all deprecated `Yammer` command aliases. These aliases were introduced in the previous version to prevent the introduction of breaking changes. Since Yammer has been renamed to Viva Engage a while ago, the following aliases were removed:

Alias | Command
--|--
`yammer search` | [viva engage search](./cmd/viva/engage/engage-search.mdx)
`yammer group list` | [viva engage group list](./cmd/viva/engage/engage-group-list.mdx)
`yammer group user add` | [viva engage user add](./cmd/viva/engage/engage-group-user-add.mdx)
`yammer group user remove` | [viva engage user remove](./cmd/viva/engage/engage-group-user-remove.mdx)
`yammer message add` | [viva engage message add](./cmd/viva/engage/engage-message-add.mdx)
`yammer message get` | [viva engage message get](./cmd/viva/engage/engage-message-get.mdx)
`yammer message list` | [viva engage message list](./cmd/viva/engage/engage-message-list.mdx)
`yammer message remove` | [viva engage message remove](./cmd/viva/engage/engage-message-remove.mdx)
`yammer message like set` | [viva engage message like set](./cmd/viva/engage/engage-message-like-set.mdx)
`yammer network list` | [viva engage network list](./cmd/viva/engage/engage-network-list.mdx)
`yammer report activitycounts` | [viva engage report activitycounts](./cmd/viva/engage/engage-report-activitycounts.mdx)
`yammer report activityusercounts` | [viva engage report activityusercounts](./cmd/viva/engage/engage-report-activityusercounts.mdx)
`yammer report activityuserdetail` | [viva engage report activityuserdetail](./cmd/viva/engage/engage-report-activityuserdetail.mdx)
`yammer report deviceusagedistributionusercounts` | [viva engage report deviceusagedistributionusercounts](./cmd/viva/engage/engage-report-deviceusagedistributionusercounts.mdx)
`yammer report deviceusageusercounts` | [viva engage report deviceusageusercounts](./cmd/viva/engage/engage-report-deviceusageusercounts.mdx)
`yammer report deviceusageuserdetail` | [viva engage report deviceusageuserdetail](./cmd/viva/engage/engage-report-deviceusageuserdetail.mdx)
`yammer report groupsactivitycounts` | [viva engage report groupsactivitycounts](./cmd/viva/engage/engage-report-groupsactivitycounts.mdx)
`yammer report groupsactivitydetail` | [viva engage report groupsactivitydetail](./cmd/viva/engage/engage-report-groupsactivitydetail.mdx)
`yammer report groupsactivitygroupcounts` | [viva engage report groupsactivitygroupcounts](./cmd/viva/engage/engage-report-groupsactivitygroupcounts.mdx)
`yammer user get` | [viva engage user get](./cmd/viva/engage/engage-user-get.mdx)
`yammer user list` | [viva engage user list](./cmd/viva/engage/engage-user-list.mdx)

#### What action do I need to take?

Replace any of the aliases mentioned above with the corresponding command name. The functionality of the command hasn't changed.
3 changes: 0 additions & 3 deletions docs/docusaurus.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,6 @@ const config: Config = {
if (routePath.includes('/entra')) {
return [routePath.replace('/entra', '/aad')];
}
if (routePath.includes('/viva/engage')) {
return [routePath.replace('/viva/engage', '/yammer')];
}

return [];
}
Expand Down
5 changes: 0 additions & 5 deletions src/m365/cli/commands/cli-consent.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,6 @@ describe(commands.CONSENT, () => {
assert(loggerLogSpy.calledWith(`To consent permissions for executing VivaEngage commands, navigate in your web browser to https://login.microsoftonline.com/common/oauth2/v2.0/authorize?client_id=31359c7f-bd7e-475c-86db-fdb8c937548e&response_type=code&scope=https%3A%2F%2Fapi.yammer.com%2Fuser_impersonation`));
});

it('shows consent URL for yammer permissions for the default multi-tenant app', async () => {
await command.action(logger, { options: { service: 'yammer' } });
assert(loggerLogSpy.calledWith(`To consent permissions for executing yammer commands, navigate in your web browser to https://login.microsoftonline.com/common/oauth2/v2.0/authorize?client_id=31359c7f-bd7e-475c-86db-fdb8c937548e&response_type=code&scope=https%3A%2F%2Fapi.yammer.com%2Fuser_impersonation`));
});

it('shows consent URL for VivaEngage permissions for a custom single-tenant app', async () => {
config.tenant = 'fb5cb38f-ecdb-4c6a-a93b-b8cfd56b4a89';
config.cliEntraAppId = '2587b55d-a41e-436d-bb1d-6223eb185dd4';
Expand Down
10 changes: 3 additions & 7 deletions src/m365/cli/commands/cli-consent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class CliConsentCommand extends AnonymousCommand {
#initValidators(): void {
this.validators.push(
async (args: CommandArgs) => {
if (args.options.service !== 'VivaEngage' && args.options.service !== 'yammer') {
if (args.options.service !== 'VivaEngage') {
return `${args.options.service} is not a valid value for the service option. Allowed values: VivaEngage`;
}

Expand All @@ -60,12 +60,8 @@ class CliConsentCommand extends AnonymousCommand {

public async commandAction(logger: Logger, args: CommandArgs): Promise<void> {
let scope = '';
switch (args.options.service) {
case 'yammer':
await this.warn(logger, 'The yammer service is deprecated. Please use the VivaEngage service instead.');
case 'VivaEngage':
scope = 'https://api.yammer.com/user_impersonation';
break;
if (args.options.service === 'VivaEngage') {
scope = 'https://api.yammer.com/user_impersonation';
}

await logger.log(`To consent permissions for executing ${args.options.service} commands, navigate in your web browser to https://login.microsoftonline.com/${config.tenant}/oauth2/v2.0/authorize?client_id=${config.cliEntraAppId}&response_type=code&scope=${encodeURIComponent(scope)}`);
Expand Down
18 changes: 0 additions & 18 deletions src/m365/viva/commands/engage/engage-group-list.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import { session } from '../../../../utils/session.js';
import { sinonUtil } from '../../../../utils/sinonUtil.js';
import commands from '../../commands.js';
import command from './engage-group-list.js';
import yammerCommands from './yammerCommands.js';
import { accessToken } from '../../../../utils/accessToken.js';

describe(commands.ENGAGE_GROUP_LIST, () => {
Expand Down Expand Up @@ -235,23 +234,6 @@ describe(commands.ENGAGE_GROUP_LIST, () => {
assert.deepStrictEqual(command.defaultProperties(), ['id', 'name', 'email', 'privacy', 'external', 'moderated']);
});

it('defines correct alias', () => {
const alias = command.alias();
assert.deepStrictEqual(alias, [yammerCommands.GROUP_LIST]);
});

it('correctly logs deprecation warning for yammer command', async () => {
const chalk = (await import('chalk')).default;
const loggerErrSpy = sinon.spy(logger, 'logToStderr');
const commandNameStub = sinon.stub(cli, 'currentCommandName').value(yammerCommands.GROUP_LIST);
sinon.stub(request, 'get').resolves([]);

await command.action(logger, { options: {} });
assert.deepStrictEqual(loggerErrSpy.firstCall.firstArg, chalk.yellow(`Command '${yammerCommands.GROUP_LIST}' is deprecated. Please use '${commands.ENGAGE_GROUP_LIST}' instead.`));

sinonUtil.restore([loggerErrSpy, commandNameStub]);
});

it('correctly handles error', async () => {
sinon.stub(request, 'get').rejects(
{
Expand Down
7 changes: 0 additions & 7 deletions src/m365/viva/commands/engage/engage-group-list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import GlobalOptions from '../../../../GlobalOptions.js';
import request, { CliRequestOptions } from '../../../../request.js';
import VivaEngageCommand from '../../../base/VivaEngageCommand.js';
import commands from '../../commands.js';
import yammerCommands from './yammerCommands.js';

interface CommandArgs {
options: Options;
Expand All @@ -25,10 +24,6 @@ class VivaEngageGroupListCommand extends VivaEngageCommand {
return 'Returns the list of groups in a Viva Engage network or the groups for a specific user';
}

public alias(): string[] | undefined {
return [yammerCommands.GROUP_LIST];
}

constructor() {
super();
this.items = [];
Expand Down Expand Up @@ -114,8 +109,6 @@ class VivaEngageGroupListCommand extends VivaEngageCommand {
}

public async commandAction(logger: Logger, args: CommandArgs): Promise<void> {
await this.showDeprecationWarning(logger, this.alias()![0], this.name);

this.items = []; // this will reset the items array in interactive mode

try {
Expand Down
18 changes: 0 additions & 18 deletions src/m365/viva/commands/engage/engage-group-user-add.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import { session } from '../../../../utils/session.js';
import { sinonUtil } from '../../../../utils/sinonUtil.js';
import commands from '../../commands.js';
import command from './engage-group-user-add.js';
import yammerCommands from './yammerCommands.js';
import { accessToken } from '../../../../utils/accessToken.js';

describe(commands.ENGAGE_GROUP_USER_ADD, () => {
Expand Down Expand Up @@ -65,23 +64,6 @@ describe(commands.ENGAGE_GROUP_USER_ADD, () => {
assert.notStrictEqual(command.description, null);
});

it('defines correct alias', () => {
const alias = command.alias();
assert.deepStrictEqual(alias, [yammerCommands.GROUP_USER_ADD]);
});

it('correctly logs deprecation warning for yammer command', async () => {
const chalk = (await import('chalk')).default;
const loggerErrSpy = sinon.spy(logger, 'logToStderr');
const commandNameStub = sinon.stub(cli, 'currentCommandName').value(yammerCommands.GROUP_USER_ADD);
sinon.stub(request, 'post').resolves();

await command.action(logger, { options: { groupId: 1231231, id: 989998789 } });
assert.deepStrictEqual(loggerErrSpy.firstCall.firstArg, chalk.yellow(`Command '${yammerCommands.GROUP_USER_ADD}' is deprecated. Please use '${commands.ENGAGE_GROUP_USER_ADD}' instead.`));

sinonUtil.restore([loggerErrSpy, commandNameStub]);
});

it('correctly handles error', async () => {
sinon.stub(request, 'post').callsFake(async () => {
throw {
Expand Down
7 changes: 0 additions & 7 deletions src/m365/viva/commands/engage/engage-group-user-add.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import GlobalOptions from '../../../../GlobalOptions.js';
import request from '../../../../request.js';
import VivaEngageCommand from '../../../base/VivaEngageCommand.js';
import commands from '../../commands.js';
import yammerCommands from './yammerCommands.js';

interface CommandArgs {
options: Options;
Expand All @@ -24,10 +23,6 @@ class VivaEngageGroupUserAddCommand extends VivaEngageCommand {
return 'Adds a user to a Viva Engage Group';
}

public alias(): string[] | undefined {
return [yammerCommands.GROUP_USER_ADD];
}

constructor() {
super();

Expand Down Expand Up @@ -76,8 +71,6 @@ class VivaEngageGroupUserAddCommand extends VivaEngageCommand {
}

public async commandAction(logger: Logger, args: CommandArgs): Promise<void> {
await this.showDeprecationWarning(logger, this.alias()![0], this.name);

const requestOptions: any = {
url: `${this.resource}/v1/group_memberships.json`,
headers: {
Expand Down
18 changes: 0 additions & 18 deletions src/m365/viva/commands/engage/engage-group-user-remove.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import { session } from '../../../../utils/session.js';
import { sinonUtil } from '../../../../utils/sinonUtil.js';
import commands from '../../commands.js';
import command from './engage-group-user-remove.js';
import yammerCommands from './yammerCommands.js';
import { accessToken } from '../../../../utils/accessToken.js';

describe(commands.ENGAGE_GROUP_USER_REMOVE, () => {
Expand Down Expand Up @@ -67,23 +66,6 @@ describe(commands.ENGAGE_GROUP_USER_REMOVE, () => {
assert.notStrictEqual(command.description, null);
});

it('defines correct alias', () => {
const alias = command.alias();
assert.deepStrictEqual(alias, [yammerCommands.GROUP_USER_REMOVE]);
});

it('correctly logs deprecation warning for yammer command', async () => {
const chalk = (await import('chalk')).default;
const loggerErrSpy = sinon.spy(logger, 'logToStderr');
const commandNameStub = sinon.stub(cli, 'currentCommandName').value(yammerCommands.GROUP_USER_REMOVE);
sinon.stub(request, 'delete').resolves();

await command.action(logger, { options: { groupId: 1231231, id: 989998789, force: true } });
assert.deepStrictEqual(loggerErrSpy.firstCall.firstArg, chalk.yellow(`Command '${yammerCommands.GROUP_USER_REMOVE}' is deprecated. Please use '${commands.ENGAGE_GROUP_USER_REMOVE}' instead.`));

sinonUtil.restore([loggerErrSpy, commandNameStub]);
});

it('correctly handles error', async () => {
sinon.stub(request, 'delete').callsFake(async () => {
throw {
Expand Down
7 changes: 0 additions & 7 deletions src/m365/viva/commands/engage/engage-group-user-remove.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import GlobalOptions from '../../../../GlobalOptions.js';
import request, { CliRequestOptions } from '../../../../request.js';
import VivaEngageCommand from "../../../base/VivaEngageCommand.js";
import commands from '../../commands.js';
import yammerCommands from './yammerCommands.js';

interface CommandArgs {
options: Options;
Expand All @@ -25,10 +24,6 @@ class VivaEngageGroupUserRemoveCommand extends VivaEngageCommand {
return 'Removes a user from a Viva Engage group';
}

public alias(): string[] | undefined {
return [yammerCommands.GROUP_USER_REMOVE];
}

constructor() {
super();

Expand Down Expand Up @@ -77,8 +72,6 @@ class VivaEngageGroupUserRemoveCommand extends VivaEngageCommand {
}

public async commandAction(logger: Logger, args: CommandArgs): Promise<void> {
await this.showDeprecationWarning(logger, this.alias()![0], this.name);

if (args.options.force) {
await this.executeRemoveAction(args.options);
}
Expand Down
18 changes: 0 additions & 18 deletions src/m365/viva/commands/engage/engage-message-add.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import { session } from '../../../../utils/session.js';
import { sinonUtil } from '../../../../utils/sinonUtil.js';
import commands from '../../commands.js';
import command from './engage-message-add.js';
import yammerCommands from './yammerCommands.js';
import { accessToken } from '../../../../utils/accessToken.js';

describe(commands.ENGAGE_MESSAGE_ADD, () => {
Expand Down Expand Up @@ -67,23 +66,6 @@ describe(commands.ENGAGE_MESSAGE_ADD, () => {
assert.notStrictEqual(command.description, null);
});

it('defines correct alias', () => {
const alias = command.alias();
assert.deepStrictEqual(alias, [yammerCommands.MESSAGE_ADD]);
});

it('correctly logs deprecation warning for yammer command', async () => {
const chalk = (await import('chalk')).default;
const loggerErrSpy = sinon.spy(logger, 'logToStderr');
const commandNameStub = sinon.stub(cli, 'currentCommandName').value(yammerCommands.MESSAGE_ADD);
sinon.stub(request, 'post').resolves(firstMessage);

await command.action(logger, { options: { body: 'send a letter to me', groupId: 13114941440 } });
assert.deepStrictEqual(loggerErrSpy.firstCall.firstArg, chalk.yellow(`Command '${yammerCommands.MESSAGE_ADD}' is deprecated. Please use '${commands.ENGAGE_MESSAGE_ADD}' instead.`));

sinonUtil.restore([loggerErrSpy, commandNameStub]);
});

it('defines correct properties for the default output', () => {
assert.deepStrictEqual(command.defaultProperties(), ['id']);
});
Expand Down
7 changes: 0 additions & 7 deletions src/m365/viva/commands/engage/engage-message-add.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import GlobalOptions from '../../../../GlobalOptions.js';
import request from '../../../../request.js';
import VivaEngageCommand from '../../../base/VivaEngageCommand.js';
import commands from '../../commands.js';
import yammerCommands from './yammerCommands.js';

interface CommandArgs {
options: Options;
Expand All @@ -26,10 +25,6 @@ class VivaEngageMessageAddCommand extends VivaEngageCommand {
return 'Posts a Viva Engage network message on behalf of the current user';
}

public alias(): string[] | undefined {
return [yammerCommands.MESSAGE_ADD];
}

public defaultProperties(): string[] | undefined {
return ['id'];
}
Expand Down Expand Up @@ -100,8 +95,6 @@ class VivaEngageMessageAddCommand extends VivaEngageCommand {
}

public async commandAction(logger: Logger, args: CommandArgs): Promise<void> {
await this.showDeprecationWarning(logger, this.alias()![0], this.name);

const requestOptions: any = {
url: `${this.resource}/v1/messages.json`,
headers: {
Expand Down
18 changes: 0 additions & 18 deletions src/m365/viva/commands/engage/engage-message-get.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import { sinonUtil } from '../../../../utils/sinonUtil.js';
import commands from '../../commands.js';
import command from './engage-message-get.js';
import { settingsNames } from '../../../../settingsNames.js';
import yammerCommands from './yammerCommands.js';
import { accessToken } from '../../../../utils/accessToken.js';

describe(commands.ENGAGE_MESSAGE_GET, () => {
Expand Down Expand Up @@ -71,23 +70,6 @@ describe(commands.ENGAGE_MESSAGE_GET, () => {
assert.notStrictEqual(command.description, null);
});

it('defines correct alias', () => {
const alias = command.alias();
assert.deepStrictEqual(alias, [yammerCommands.MESSAGE_GET]);
});

it('correctly logs deprecation warning for yammer command', async () => {
const chalk = (await import('chalk')).default;
const loggerErrSpy = sinon.spy(logger, 'logToStderr');
const commandNameStub = sinon.stub(cli, 'currentCommandName').value(yammerCommands.MESSAGE_GET);
sinon.stub(request, 'get').resolves(firstMessage);

await command.action(logger, { options: { id: 10123190123123 } });
assert.deepStrictEqual(loggerErrSpy.firstCall.firstArg, chalk.yellow(`Command '${yammerCommands.MESSAGE_GET}' is deprecated. Please use '${commands.ENGAGE_MESSAGE_GET}' instead.`));

sinonUtil.restore([loggerErrSpy, commandNameStub]);
});

it('defines correct properties for the default output', () => {
assert.deepStrictEqual(command.defaultProperties(), ['id', 'sender_id', 'replied_to_id', 'thread_id', 'group_id', 'created_at', 'direct_message', 'system_message', 'privacy', 'message_type', 'content_excerpt']);
});
Expand Down
7 changes: 0 additions & 7 deletions src/m365/viva/commands/engage/engage-message-get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import GlobalOptions from '../../../../GlobalOptions.js';
import request from '../../../../request.js';
import VivaEngageCommand from '../../../base/VivaEngageCommand.js';
import commands from '../../commands.js';
import yammerCommands from './yammerCommands.js';

interface CommandArgs {
options: Options;
Expand All @@ -22,10 +21,6 @@ class VivaEngageMessageGetCommand extends VivaEngageCommand {
return 'Returns a Viva Engage message';
}

public alias(): string[] | undefined {
return [yammerCommands.MESSAGE_GET];
}

public defaultProperties(): string[] | undefined {
return ['id', 'sender_id', 'replied_to_id', 'thread_id', 'group_id', 'created_at', 'direct_message', 'system_message', 'privacy', 'message_type', 'content_excerpt'];
}
Expand Down Expand Up @@ -58,8 +53,6 @@ class VivaEngageMessageGetCommand extends VivaEngageCommand {
}

public async commandAction(logger: Logger, args: CommandArgs): Promise<void> {
await this.showDeprecationWarning(logger, this.alias()![0], this.name);

const requestOptions: any = {
url: `${this.resource}/v1/messages/${args.options.id}.json`,
headers: {
Expand Down
Loading

0 comments on commit bb81ff0

Please sign in to comment.