Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding issue contextual bar #95

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
TextObjectType,
UIKitInteractionContext,
} from "@rocket.chat/apps-engine/definition/uikit";
import { IUIKitModalViewParam } from "@rocket.chat/apps-engine/definition/uikit/UIKitInteractionResponder";
import { IUIKitContextualBarViewParam, IUIKitModalViewParam } from "@rocket.chat/apps-engine/definition/uikit/UIKitInteractionResponder";
import { ModalsEnum } from "../enum/Modals";
import { OcticonIcons } from "../enum/OcticonIcons";
import { getBasicUserInfo, getUserAssignedIssues } from "../helpers/githubSDK";
Expand All @@ -20,7 +20,7 @@ import {
storeInteractionRoomData,
} from "../persistance/roomInteraction";

export async function userIssuesModal({
export async function userIssuesContextualBar({
filter,
access_token,
modify,
Expand All @@ -42,7 +42,8 @@ export async function userIssuesModal({
http: IHttp;
slashcommandcontext?: SlashCommandContext;
uikitcontext?: UIKitInteractionContext;
}): Promise<IUIKitModalViewParam> {
}): Promise<IUIKitContextualBarViewParam> {

const viewId = ModalsEnum.USER_ISSUE_VIEW;
const block = modify.getCreator().getBlockBuilder();
const room =
Expand Down
2 changes: 1 addition & 1 deletion github/enum/Modals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export enum ModalsEnum {
MENTIONED_ISSUE_FILTER = 'mentioned',
SWITCH_ISSUE_FILTER = 'switch-issue-filter',
USER_ISSUE_VIEW = 'user-issue-view',
TRIGGER_ISSUES_MODAL = 'trigger-issue-modal',
TRIGGER_ISSUES_CONTEXTUAL_BAR = 'trigger-issue-modal',
TRIGGER_REPOS_MODAL = 'trigger-repos-modal',
TRIGGER_ACTIVITY_MODAL = 'trigger-activity-modal',
TRIGGER_NOTIFICATIONS_MODAL = 'trigger-notifications-modal',
Expand Down
16 changes: 7 additions & 9 deletions github/handlers/ExecuteBlockActionHandler.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import {
IHttp,
ILogger,
IModify,
IPersistence,
IRead,
} from "@rocket.chat/apps-engine/definition/accessors";
import { IApp } from "@rocket.chat/apps-engine/definition/IApp";
import { IRoom } from "@rocket.chat/apps-engine/definition/rooms";
import { basicQueryMessage } from "../helpers/basicQueryMessage";
import { ModalsEnum } from "../enum/Modals";
Expand Down Expand Up @@ -43,7 +41,7 @@ import { GithubRepoIssuesStorage } from "../persistance/githubIssues";
import { IGitHubIssueData } from "../definitions/githubIssueData";
import { shareProfileModal } from "../modals/profileShareModal";
import { RocketChatAssociationModel, RocketChatAssociationRecord } from "@rocket.chat/apps-engine/definition/metadata";
import { userIssuesModal } from "../modals/UserIssuesModal";
import { userIssuesContextualBar } from "../ContextualBars/UserIssuesContextualBar";
import { IssueDisplayModal } from "../modals/IssueDisplayModal";
import { IGitHubIssue } from "../definitions/githubIssue";
import { BodyMarkdownRenderer } from "../processors/bodyMarkdowmRenderer";
Expand Down Expand Up @@ -179,7 +177,7 @@ export class ExecuteBlockActionHandler {
uikitcontext : context
})

return context.getInteractionResponder().updateModalViewResponse(issueDisplayModal);
return context.getInteractionResponder().openContextualBarViewResponse(issueDisplayModal);
}
case ModalsEnum.SWITCH_ISSUE_SORT :
case ModalsEnum.SWITCH_ISSUE_STATE :
Expand Down Expand Up @@ -236,7 +234,7 @@ export class ExecuteBlockActionHandler {
}

let access_token = await getAccessTokenForUser(this.read, user, this.app.oauth2Config) as IAuthData;
const issueModal = await userIssuesModal({
const issuesContextualBar = await userIssuesContextualBar({
access_token : access_token.token,
filter : filter,
modify : this.modify,
Expand All @@ -247,9 +245,9 @@ export class ExecuteBlockActionHandler {

await this.persistence.updateByAssociation(record, filter);

return context.getInteractionResponder().updateModalViewResponse(issueModal);
return context.getInteractionResponder().updateContextualBarViewResponse(issuesContextualBar);
}
case ModalsEnum.TRIGGER_ISSUES_MODAL : {
case ModalsEnum.TRIGGER_ISSUES_CONTEXTUAL_BAR : {

const {user} = context.getInteractionData();

Expand All @@ -261,7 +259,7 @@ export class ExecuteBlockActionHandler {
sort : ModalsEnum.ISSUE_SORT_CREATED
}

const issuesModal = await userIssuesModal({
const issuesContextualBar = await userIssuesContextualBar({
filter : filter,
access_token : access_token.token,
modify: this.modify,
Expand All @@ -271,7 +269,7 @@ export class ExecuteBlockActionHandler {
uikitcontext : context
});

return context.getInteractionResponder().openModalViewResponse(issuesModal);
return context.getInteractionResponder().openContextualBarViewResponse(issuesContextualBar);
}
case ModalsEnum.TRIGGER_REPOS_MODAL : {
break;
Expand Down
4 changes: 2 additions & 2 deletions github/modals/UserProfileModal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export async function userProfileModal({
}),
block.newButtonElement(
{
actionId: ModalsEnum.TRIGGER_ISSUES_MODAL,
actionId: ModalsEnum.TRIGGER_ISSUES_CONTEXTUAL_BAR,
value: "Trigger Issues Modal",
text: {
type: TextObjectType.PLAINTEXT,
Expand All @@ -110,7 +110,7 @@ export async function userProfileModal({
type: TextObjectType.PLAINTEXT,
text: userInfo.name
},
blocks: block.getBlocks()
blocks: block.getBlocks(),
}

}
5 changes: 3 additions & 2 deletions github/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"@rocket.chat/apps-engine": "^1.36.0",
"@types/node": "14.14.6",
"tslint": "^5.10.0",
"typescript": "^4.0.5"
"typescript": "^4.0.5",
"@rocket.chat/ui-kit": "^0.31.22"
}
}
}