Skip to content

New command: teams channel member remove. Closes #3175#3240

Closed
Jwaegebaert wants to merge 2 commits intopnp:mainfrom
Jwaegebaert:dev/teamsChannelMemberRemove
Closed

New command: teams channel member remove. Closes #3175#3240
Jwaegebaert wants to merge 2 commits intopnp:mainfrom
Jwaegebaert:dev/teamsChannelMemberRemove

Conversation

@Jwaegebaert
Copy link
Copy Markdown
Contributor

Closes #3175

@waldekmastykarz
Copy link
Copy Markdown
Member

Awesome! We'll review it shortly

@waldekmastykarz waldekmastykarz self-assigned this Apr 24, 2022
@waldekmastykarz
Copy link
Copy Markdown
Member

How can I test this command @Jwaegebaert? When I try to run it, I'm getting an error: Operation not supported for this Channel. Team, channel and member resolve properly both by name and ID so that shouldn't be an issue.

@Jwaegebaert
Copy link
Copy Markdown
Contributor Author

Hey @waldekmastykarz, if you get the error Operation not supported for this Channel it will be because you are not referring to a private channel. This command can only be applied to members within a private channel.
Considering that you are running into this now, it might be interesting to build in a check before the prompt to see that it is a private channel that the user is referring to. With this we can prevent users from running into this error in the future.
What do you think?

@waldekmastykarz
Copy link
Copy Markdown
Member

Thanks! I missed that detail in the command's description. An extra check would be awesome. To avoid holding up the PR, let's do it in a separate issue as an enhancement. Could you please create an issue so that we can track it? Thank you for your help!

Copy link
Copy Markdown
Member

@waldekmastykarz waldekmastykarz left a comment

Choose a reason for hiding this comment

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

Works like a charm! Merged with a few small adjustments


```sh
m365 teams channel member remove --teamName "Team Name" --channelName "Channel Name" --userId 00000000-0000-0000-0000-000000000000
``` No newline at end of file
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Let's add an empty line at the end of the file

cb();
}
else {
this
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Let's wrap this logic in a function so that we can keep it in one place without repeating.

}

public validate(args: CommandArgs): boolean | string {
if (args.options.teamId && args.options.teamName) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

assert.strictEqual((alias && alias.indexOf(commands.CONVERSATIONMEMBER_REMOVE) !== -1), true);
});

it('fails validation if required options are not passed', (done) => {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We check for the presence of required options outside of the command so we don't need to have a test for it in the command

@waldekmastykarz
Copy link
Copy Markdown
Member

Merged manually. Thank you! 👏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

New command: teams channel member remove

2 participants