Skip to content
Snippets Groups Projects
Verified Commit 9b16a867 authored by Stanislav Lashmanov's avatar Stanislav Lashmanov Committed by GitLab
Browse files

Add Linked file feature

Remove `pinned_file` feature flag

Changelog: added

- [Introduced](#387246) in GitLab 16.9 [with a flag](../../administration/feature_flags.md) named `pinned_file`. Disabled by default.
- [Enabled on GitLab.com](#433250 (comment 1751596958)) in GitLab 16.9.
- [Generally available](#433250) in GitLab 17.4. Feature flag `pinned_file` removed.
parent 078091b2
No related branches found
No related tags found
1 merge request!162503Remove 'pinned_file' feature flag
......@@ -39,9 +39,7 @@ export const fileContentsId = (diffFile) => {
const createDiffUrl = (diffFile) => {
const url = new URL(window.location);
if (window?.gon?.features?.pinnedFile) {
url.searchParams.set('file', diffFile.file_hash);
}
url.searchParams.set('file', diffFile.file_hash);
return url;
};
......
......@@ -44,7 +44,6 @@ class Projects::MergeRequestsController < Projects::MergeRequests::ApplicationCo
push_frontend_feature_flag(:mr_pipelines_graphql, project)
push_frontend_feature_flag(:ci_graphql_pipeline_mini_graph, project)
push_frontend_feature_flag(:notifications_todos_buttons, current_user)
push_frontend_feature_flag(:pinned_file, project)
push_frontend_feature_flag(:reviewer_assign_drawer, current_user)
push_frontend_feature_flag(:async_merge_request_pipeline_creation, current_user)
end
......@@ -458,9 +457,7 @@ def render_html_page
@update_current_user_path = expose_path(api_v4_user_preferences_path)
@endpoint_metadata_url = endpoint_metadata_url(@project, @merge_request)
@endpoint_diff_batch_url = endpoint_diff_batch_url(@project, @merge_request)
if params[:file] && Feature.enabled?(:pinned_file, @project)
@linked_file_url = linked_file_url(@project, @merge_request)
end
@linked_file_url = linked_file_url(@project, @merge_request) if params[:file]
if merge_request.diffs_batch_cache_with_max_age?
@diffs_batch_cache_key = @merge_request.merge_head_diff&.patch_id_sha
......
---
name: pinned_file
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/137544
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/433250
milestone: '16.9'
type: development
group: group::code review
default_enabled: false
......@@ -81,10 +81,7 @@ DETAILS:
**Offering:** GitLab.com
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/387246) in GitLab 16.9 [with a flag](../../../administration/feature_flags.md) named `pinned_file`. Disabled by default.
FLAG:
The availability of this feature is controlled by a feature flag.
For more information, see the history.
> - [Generally available](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/162503) in GitLab 17.4. Feature flag `pinned_file` removed.
When you share a merge request link with a team member, you might want to show a specific file
first in the list of changed files. To copy a merge request link that shows your desired file first:
......
......@@ -129,14 +129,6 @@ describe('diff_row_utils', () => {
});
describe('linked file enabled', () => {
beforeEach(() => {
window.gon.features = { pinnedFile: true };
});
afterEach(() => {
delete window.gon.features;
});
it(`should return linked file URL`, () => {
const diffFile = getDiffFileMock();
expect(utils.lineHref({ line_code: LINE_CODE }, diffFile)).toContain(
......@@ -147,37 +139,20 @@ describe('diff_row_utils', () => {
});
describe('createFileUrl', () => {
describe('linked file enabled', () => {
beforeEach(() => {
window.gon.features = { pinnedFile: true };
});
afterEach(() => {
delete window.gon.features;
});
it(`should return linked file URL`, () => {
const diffFile = getDiffFileMock();
const url = utils.createFileUrl(diffFile);
expect(url.searchParams.get('file')).toBe(diffFile.file_hash);
expect(url.hash).toBe(`#diff-content-${diffFile.file_hash}`);
});
it(`removes existing linked file search param`, () => {
const newLocation = new URL(window.location);
newLocation.searchParams.append('file', 'foo');
setWindowLocation(newLocation.toString());
const diffFile = getDiffFileMock();
const url = utils.createFileUrl(diffFile);
expect(url.searchParams.get('file')).toBe(diffFile.file_hash);
expect(url.hash).toBe(`#diff-content-${diffFile.file_hash}`);
});
it(`should return linked file URL`, () => {
const diffFile = getDiffFileMock();
const url = utils.createFileUrl(diffFile);
expect(url.searchParams.get('file')).toBe(diffFile.file_hash);
expect(url.hash).toBe(`#diff-content-${diffFile.file_hash}`);
});
it('should return file URL', () => {
it(`removes existing linked file search param`, () => {
const newLocation = new URL(window.location);
newLocation.searchParams.append('file', 'foo');
setWindowLocation(newLocation.toString());
const diffFile = getDiffFileMock();
const url = utils.createFileUrl(diffFile);
expect(url.searchParams.get('file')).toBe(null);
expect(url.searchParams.get('file')).toBe(diffFile.file_hash);
expect(url.hash).toBe(`#diff-content-${diffFile.file_hash}`);
});
});
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment