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

Release 3.0 #75

Merged
merged 6 commits into from
Nov 7, 2024
Merged
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
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
{
"version": "2.0.1",
"version": "3.0.0",
"configurations": [
{
"name": "Run Extension",
Expand Down
2 changes: 1 addition & 1 deletion .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
{
"version": "2.0.1",
"version": "2.0.0",
"tasks": [
{
"type": "npm",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"publisher": "Pullflow",
"displayName": "Pullflow",
"description": "Code review collaboration across GitHub, Slack, and VS Code.",
"version": "2.0.1",
"version": "3.0.0",
"preview": true,
"license": "MIT",
"engines": {
Expand Down
12 changes: 6 additions & 6 deletions src/api/messageApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ export const MessageApi = {
body,
parentMessageXid,
chatChannelId,
authToken,
accessToken,
context,
}: {
body: string
parentMessageXid: string
chatChannelId: string
authToken: string
accessToken: string
context: ExtensionContext
}) => {
log.info(
Expand All @@ -38,7 +38,7 @@ export const MessageApi = {
module
)

const pullflowApi = new PullflowApi(context, authToken)
const pullflowApi = new PullflowApi(context, accessToken)
try {
const data = await pullflowApi.fetch(SEND_CODE_REVIEW_THREAD_MESSAGE, {
body,
Expand All @@ -57,22 +57,22 @@ export const MessageApi = {
codeAccountXid,
codeReviewId,
chatLink,
authToken,
accessToken,
message,
fromAuthor,
context,
}: {
codeAccountXid: string
chatLink: string
authToken: string
accessToken: string
codeReviewId: string
message: string
fromAuthor: boolean
context: ExtensionContext
}) => {
log.info(`nudging user: ${{ codeAccountXid }}, ${{ chatLink }}`, module)

const pullflowApi = new PullflowApi(context, authToken)
const pullflowApi = new PullflowApi(context, accessToken)
try {
const data = await pullflowApi.fetch(SEND_CODE_REVIEW_DIRECT_MESSAGE, {
codeAccountXid,
Expand Down
6 changes: 3 additions & 3 deletions src/api/presenceApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,18 @@ const SET_USER_PRESENCE = `
export const PresenceApi = {
setPresence: async ({
status,
authToken,
accessToken,
repoInfo,
context,
}: {
status: PresenceStatus
authToken: string
accessToken: string
repoInfo: RepoInfo
context: ExtensionContext
}) => {
log.info(`setting user presence: ${{ status }}`, module)

const pullflowApi = new PullflowApi(context, authToken)
const pullflowApi = new PullflowApi(context, accessToken)
try {
const data = await pullflowApi.fetch(SET_USER_PRESENCE, {
status,
Expand Down
36 changes: 18 additions & 18 deletions src/api/pullRequestQuickActionsApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,19 +61,19 @@ mutation setCodeReviewReminder($codeReviewId: String!, $duration: Int!) {

export const PullRequestQuickActionsApi = {
addLabels: async ({
authToken,
accessToken,
labels,
codeReviewId,
context,
}: {
authToken: string
accessToken: string
labels: string
codeReviewId: string
context: ExtensionContext
}) => {
log.info(`adding labels to pull request: ${{ labels }}}`, module)

const pullflowApi = new PullflowApi(context, authToken)
const pullflowApi = new PullflowApi(context, accessToken)
try {
const data = await pullflowApi.fetch(ADD_LABELS, {
labels,
Expand All @@ -88,19 +88,19 @@ export const PullRequestQuickActionsApi = {
},

approve: async ({
authToken,
accessToken,
codeReviewId,
body,
context,
}: {
authToken: string
accessToken: string
codeReviewId: string
body: string
context: ExtensionContext
}) => {
log.info(`approving pull request: ${{ codeReviewId }}}`, module)

const pullflowApi = new PullflowApi(context, authToken)
const pullflowApi = new PullflowApi(context, accessToken)
try {
const data = await pullflowApi.fetch(APPROVE_CODE_REVIEW, {
codeReviewId,
Expand All @@ -115,19 +115,19 @@ export const PullRequestQuickActionsApi = {
},

addAssignee: async ({
authToken,
accessToken,
codeReviewId,
assigneeXid,
context,
}: {
authToken: string
accessToken: string
codeReviewId: string
assigneeXid: string
context: ExtensionContext
}) => {
log.info(`add assignee to pull request: ${{ assigneeXid }}}`, module)

const pullflowApi = new PullflowApi(context, authToken)
const pullflowApi = new PullflowApi(context, accessToken)
try {
const data = await pullflowApi.fetch(ADD_ASSIGNEE, {
codeReviewId,
Expand All @@ -144,17 +144,17 @@ export const PullRequestQuickActionsApi = {
requestReview: async ({
codeReviewId,
reviewerXid,
authToken,
accessToken,
context,
}: {
codeReviewId: string
reviewerXid: string
authToken: string
accessToken: string
context: ExtensionContext
}) => {
log.info(`requesting review: ${{ reviewerXid }}}`, module)

const pullflowApi = new PullflowApi(context, authToken)
const pullflowApi = new PullflowApi(context, accessToken)
try {
const data = await pullflowApi.fetch(REQUEST_REVIEW, {
codeReviewId,
Expand All @@ -170,16 +170,16 @@ export const PullRequestQuickActionsApi = {

refresh: async ({
codeReviewId,
authToken,
accessToken,
context,
}: {
codeReviewId: string
authToken: string
accessToken: string
context: ExtensionContext
}) => {
log.info(`requesting review: ${{ codeReviewId }}}`, module)

const pullflowApi = new PullflowApi(context, authToken)
const pullflowApi = new PullflowApi(context, accessToken)
try {
const data = await pullflowApi.fetch(REFRESH_CODE_REVIEW, {
codeReviewId,
Expand All @@ -194,17 +194,17 @@ export const PullRequestQuickActionsApi = {
setReminder: async ({
duration,
codeReviewId,
authToken,
accessToken,
context,
}: {
duration: number
codeReviewId: string
authToken: string
accessToken: string
context: ExtensionContext
}) => {
log.info(`setting reminder: ${{ duration, codeReviewId }}}`, module)

const pullflowApi = new PullflowApi(context, authToken)
const pullflowApi = new PullflowApi(context, accessToken)
try {
const data = await pullflowApi.fetch(SET_REMINDER, {
codeReviewId,
Expand Down
6 changes: 3 additions & 3 deletions src/api/spaceUsersApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@ const SPACE_USERS_QUERY = `query spaceUsersForVscode($codeReviewId: String!) {
`
export const SpaceUsersApi = {
get: async ({
authToken,
accessToken,
codeReviewId,
context,
}: {
authToken: string
accessToken: string
codeReviewId: string
context: ExtensionContext
}) => {
log.info(`fetching space users`, module)

const pullflowApi = new PullflowApi(context, authToken)
const pullflowApi = new PullflowApi(context, accessToken)
try {
const data = await pullflowApi.fetch(SPACE_USERS_QUERY, { codeReviewId })
return data.spaceUsersForVscode
Expand Down
4 changes: 1 addition & 3 deletions src/commands/reconnect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,7 @@ export const Reconnect = async (

if (codeReviews.error) {
log.info(`Failed to reconnect`, module)
window.showInformationMessage(
`Pullflow: Failed to reconnect. Please check your internet connection and try again.`
)
StatusBar.update({ context, statusBar, state: StatusBarState.Error })
return
}

Expand Down
1 change: 1 addition & 0 deletions src/commands/signOut.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export const SignOut = async ({
}
}) => {
await context.secrets.store(AppConfig.app.sessionSecret, '')
await context.secrets.store('userRefreshToken', '')
await Store.clear(context)
StatusBar.update({ context, statusBar, state: StatusBarState.SignedOut })
clearInterval(pollIntervalId) // stopping polling interval
Expand Down
5 changes: 3 additions & 2 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,13 @@ export async function activate(context: ExtensionContext) {
const query = new URLSearchParams(uri.query)
const user = {
username: query.get('username') as string,
authToken: query.get('accessToken') as string,
accessToken: query.get('accessToken') as string,
refreshToken: query.get('refreshToken') as string,
}
await Store.set(context, {
user,
})
if (user.authToken) {
if (user.accessToken) {
await Authorization.createSession({ user, context })
await initialize({ context, statusBar })
}
Expand Down
4 changes: 2 additions & 2 deletions src/messages/messagePublisher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export const MessagePublisher = {
body: inputText || "I'm on it.",
parentMessageXid: codeReview.parentMessageXid,
chatChannelId: codeReview.chatChannelId,
authToken: session?.accessToken ?? '',
accessToken: session?.accessToken ?? '',
context,
})

Expand Down Expand Up @@ -98,7 +98,7 @@ export const MessagePublisher = {
message,
codeAccountXid: toAccount.xid,
chatLink,
authToken: session?.accessToken ?? '',
accessToken: session?.accessToken ?? '',
codeReviewId,
fromAuthor,
context,
Expand Down
2 changes: 1 addition & 1 deletion src/models/presence.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export const Presence = {

const response = await PresenceApi.setPresence({
status,
authToken: session.accessToken,
accessToken: session.accessToken,
context,
repoInfo,
})
Expand Down
2 changes: 1 addition & 1 deletion src/models/spaceUsers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const SpaceUsers = {
const session = await Authorization.currentSession(context)
const response = await SpaceUsersApi.get({
codeReviewId,
authToken: session?.accessToken ?? '',
accessToken: session?.accessToken ?? '',
context,
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ describe('Pull Request Quick Actions', () => {
).toHaveBeenCalledWith({
body: mockText,
codeReviewId: mockModel.id,
authToken: mockSession.accessToken,
accessToken: mockSession.accessToken,
context: mockModel,
})
expect(mockPresence.Presence.set).toBeCalled()
Expand Down
12 changes: 6 additions & 6 deletions src/pullRequestQuickActions/pullRequestQuickActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export const PullRequestQuickActions = {
const response = await PullRequestQuickActionsApi.addLabels({
labels: inputText,
codeReviewId: codeReview.id,
authToken: session?.accessToken ?? '',
accessToken: session?.accessToken ?? '',
context,
})

Expand Down Expand Up @@ -80,7 +80,7 @@ export const PullRequestQuickActions = {
const response = await PullRequestQuickActionsApi.approve({
body: inputText,
codeReviewId: codeReview.id,
authToken: session?.accessToken ?? '',
accessToken: session?.accessToken ?? '',
context,
})

Expand Down Expand Up @@ -139,7 +139,7 @@ export const PullRequestQuickActions = {
const response = await PullRequestQuickActionsApi.addAssignee({
assigneeXid: item[0].description,
codeReviewId: codeReview.id,
authToken: session?.accessToken ?? '',
accessToken: session?.accessToken ?? '',
context,
})

Expand Down Expand Up @@ -198,7 +198,7 @@ export const PullRequestQuickActions = {
const response = await PullRequestQuickActionsApi.requestReview({
reviewerXid: item[0].description,
codeReviewId: codeReview.id,
authToken: session?.accessToken ?? '',
accessToken: session?.accessToken ?? '',
context,
})

Expand Down Expand Up @@ -244,7 +244,7 @@ export const PullRequestQuickActions = {
const session = await Authorization.currentSession(context)
const response = await PullRequestQuickActionsApi.refresh({
codeReviewId,
authToken: session?.accessToken ?? '',
accessToken: session?.accessToken ?? '',
context,
})
if (response.error || response.message) {
Expand Down Expand Up @@ -287,7 +287,7 @@ export const PullRequestQuickActions = {
const response = await PullRequestQuickActionsApi.setReminder({
codeReviewId: codeReview.id,
duration,
authToken: session?.accessToken ?? '',
accessToken: session?.accessToken ?? '',
context,
})
if (response.message || response.error || !response.success) {
Expand Down
Loading
Loading