Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

Fix bad jump to file in reviews controller #2334

Merged
merged 2 commits into from
Nov 7, 2019
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
7 changes: 4 additions & 3 deletions lib/controllers/reviews-controller.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React from 'react';
import path from 'path';
import PropTypes from 'prop-types';
import {createFragmentContainer, graphql} from 'react-relay';

Expand Down Expand Up @@ -159,7 +160,7 @@ export class BareReviewsController extends React.Component {

openFile = async (filePath, lineNumber) => {
await this.props.workspace.open(
filePath, {
path.join(this.props.workdir, filePath), {
initialLine: lineNumber - 1,
initialColumn: 0,
pending: true,
Expand Down Expand Up @@ -288,7 +289,7 @@ export class BareReviewsController extends React.Component {
}
}

addSingleComment = async (commentBody, threadID, replyToID, path, position, callbacks = {}) => {
addSingleComment = async (commentBody, threadID, replyToID, commentPath, position, callbacks = {}) => {
let pendingReviewID = null;
try {
this.setState({postingToThreadID: threadID});
Expand All @@ -306,7 +307,7 @@ export class BareReviewsController extends React.Component {
reviewID,
threadID,
viewerID: this.props.viewer.id,
path,
path: commentPath,
position,
});
if (callbacks.didSubmitComment) {
Expand Down
3 changes: 2 additions & 1 deletion test/controllers/reviews-controller.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React from 'react';
import {shallow} from 'enzyme';
import path from 'path';

import {BareReviewsController} from '../../lib/controllers/reviews-controller';
import PullRequestCheckoutController from '../../lib/controllers/pr-checkout-controller';
Expand Down Expand Up @@ -758,7 +759,7 @@ describe('ReviewsController', function() {
it('opens file on disk', async function() {
await wrapper.find(ReviewsView).prop('openFile')('filepath', 420);
assert.isTrue(atomEnv.workspace.open.calledWith(
'filepath', {
path.join(localRepository.getWorkingDirectoryPath(), 'filepath'), {
initialLine: 420 - 1,
initialColumn: 0,
pending: true,
Expand Down