Skip to content

refactor: move discussion thread initialization to MrReviewItem

Tomas Vik requested to merge 404-indicate-discussions-on-diff into main

This is the first MR for #404 (closed) and it doesn't change user-facing behaviour. It might be easier to review the two commits separately.

mr_item_model_ts___gitlab-vscode-extension

The MrItemModel (powering the MR items in the picture above) didn't keep information about discussions and where are they placed (meaning what are the diff file URIs that have a discussion).

All of the logic for generating URI for threads was placed in the GitLabCommentThread class and MrItemModel didn't have access to it.

This MR moves URI generating logic to MrItemModel.

This is important because the file tree decoration that we are going to introduce in the next MR will do roughly the following logic:

// MrItemModel produces a list of URIs that have a discussion on them

cosnt shouldShowDiscussionIndicator = (uri) => urisWithDiscussions.includes(uri);

That's why the URI generating logic had to move one class up in the hierarchy to MrItemModel.

For reference, this is the discussion indicator in the UI:

discussion indicator

Related to #404 (closed)

Edited by Tomas Vik

Merge request reports