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

Commit 2d0b976

Browse files
authored
Merge pull request #2334 from wadethestealth/jump-to-file
Fix bad jump to file in reviews controller
2 parents ac18538 + 4eae537 commit 2d0b976

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

lib/controllers/reviews-controller.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import React from 'react';
2+
import path from 'path';
23
import PropTypes from 'prop-types';
34
import {createFragmentContainer, graphql} from 'react-relay';
45

@@ -159,7 +160,7 @@ export class BareReviewsController extends React.Component {
159160

160161
openFile = async (filePath, lineNumber) => {
161162
await this.props.workspace.open(
162-
filePath, {
163+
path.join(this.props.workdir, filePath), {
163164
initialLine: lineNumber - 1,
164165
initialColumn: 0,
165166
pending: true,
@@ -288,7 +289,7 @@ export class BareReviewsController extends React.Component {
288289
}
289290
}
290291

291-
addSingleComment = async (commentBody, threadID, replyToID, path, position, callbacks = {}) => {
292+
addSingleComment = async (commentBody, threadID, replyToID, commentPath, position, callbacks = {}) => {
292293
let pendingReviewID = null;
293294
try {
294295
this.setState({postingToThreadID: threadID});
@@ -306,7 +307,7 @@ export class BareReviewsController extends React.Component {
306307
reviewID,
307308
threadID,
308309
viewerID: this.props.viewer.id,
309-
path,
310+
path: commentPath,
310311
position,
311312
});
312313
if (callbacks.didSubmitComment) {

test/controllers/reviews-controller.test.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import React from 'react';
22
import {shallow} from 'enzyme';
3+
import path from 'path';
34

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

0 commit comments

Comments
 (0)