Skip to content

Commit

Permalink
apply changes
Browse files Browse the repository at this point in the history
  • Loading branch information
mraitersw committed Mar 9, 2022
1 parent 21c47d7 commit 1764479
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -117,22 +117,19 @@ export class GetActivityMembers<O extends object = {}> extends Dialog implements
}

if (!context.activity.conversation) {
throw new Error('{nameof(GetActivityMembers)}.{nameof(GetActivityMembersAsync) : missing conversation');
throw new Error('[GetActivityMembers]: Missing conversation');
}
var conversationId = context.activity.conversation.id;
const conversationId = context.activity.conversation.id;

if (typeof conversationId === 'undefined' || conversationId == null) {
throw new Error('{nameof(GetActivityMembers)}.{nameof(GetActivityMembersAsync) : missing conversation.id');
if (!conversationId || conversationId.trim() === '') {
throw new Error('[GetActivityMembers]: Missing conversation.id');
}

const connectorClient = this.getConnectorClient(context);
var accounts = await connectorClient.conversations.getActivityMembers(conversationId, activityId);
const accounts = await connectorClient.conversations.getActivityMembers(conversationId, activityId);
return accounts;
}

/**
* @private
*/
private getConnectorClient(context: TurnContext): ConnectorClient {
const client =
context.adapter && 'createConnectorClient' in context.adapter
Expand All @@ -144,6 +141,7 @@ export class GetActivityMembers<O extends object = {}> extends Dialog implements

return client;
}

/**
* @protected
* Builds the compute Id for the [Dialog](xref:botbuilder-dialogs.Dialog).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,26 +88,22 @@ export class GetConversationMembers<O extends object = {}>
if (this.disabled && this.disabled.getValue(dc.state)) {
return await dc.endDialog();
}
const result = await this.GetMembers(dc.context);
const result = await this.getMembers(dc.context);
dc.state.setValue(this.property.getValue(dc.state), result);
return await dc.endDialog(result);
}

private async GetMembers(context: TurnContext) {
var conversationId = context.activity?.conversation?.id;
if (conversationId == null) {
throw new Error('The GetMembersAsync operation needs a valid conversation Id.');
private async getMembers(context: TurnContext) {
const conversationId = context.activity?.conversation?.id;
if (!conversationId) {
throw new Error('[GetConversationMembers]: The getMembers operation needs a valid conversation id.');
}

const connectorClient = this.getConnectorClient(context);

var teamMembers = await connectorClient.conversations.getConversationMembers(conversationId);
const teamMembers = await connectorClient.conversations.getConversationMembers(conversationId);
return teamMembers;
}

/**
* @private
*/
private getConnectorClient(context: TurnContext): ConnectorClient {
const client =
context.adapter && 'createConnectorClient' in context.adapter
Expand Down

0 comments on commit 1764479

Please sign in to comment.