From c70fd82c301ada8d26fa7ab21869eb423b03bb84 Mon Sep 17 00:00:00 2001 From: Marcel van Remmerden <mvanremmerden@gitlab.com> Date: Fri, 6 Jan 2023 07:12:22 +0100 Subject: [PATCH 1/2] Remove two_line_mention_enabled feature flag Changelog: changed --- app/helpers/markup_helper.rb | 16 +-------------- app/views/dashboard/todos/_todo.html.haml | 20 +++++-------------- .../development/two_line_mention_enabled.yml | 8 -------- spec/features/dashboard/todos/todos_spec.rb | 10 ---------- 4 files changed, 6 insertions(+), 48 deletions(-) delete mode 100644 config/feature_flags/development/two_line_mention_enabled.yml diff --git a/app/helpers/markup_helper.rb b/app/helpers/markup_helper.rb index 0891760be766a1d5..45629d8bd072849e 100644 --- a/app/helpers/markup_helper.rb +++ b/app/helpers/markup_helper.rb @@ -65,17 +65,6 @@ def first_line_in_markdown(object, attribute, max_chars = nil, is_todo: false, * tags = %w(a gl-emoji b strong i em pre code p span) - if Feature.disabled?(:two_line_mention_enabled, current_user) - includes_code = false - - if is_todo - fragment = Nokogiri::HTML.fragment(md) - includes_code = fragment.css('code').any? - - md = fragment - end - end - context = markdown_field_render_context(object, attribute, options) context.reverse_merge!(truncate_visible_max_chars: max_chars || md.length) @@ -90,10 +79,7 @@ def first_line_in_markdown(object, attribute, max_chars = nil, is_todo: false, * data-user ) ) - - if is_todo && !includes_code && Feature.disabled?(:two_line_mention_enabled, current_user) - text = "<span class=\"gl-relative\">\"</span>#{text}<span class=\"gl-relative\">\"</span>" - end + # since <img> tags are stripped, this can leave empty <a> tags hanging around # (as our markdown wraps images in links) strip_empty_link_tags(text).html_safe diff --git a/app/views/dashboard/todos/_todo.html.haml b/app/views/dashboard/todos/_todo.html.haml index c54ad094883c14ac..44848448190eda32 100644 --- a/app/views/dashboard/todos/_todo.html.haml +++ b/app/views/dashboard/todos/_todo.html.haml @@ -1,5 +1,3 @@ -- two_line_mention = Feature.enabled?(:two_line_mention_enabled, current_user) - %li.todo.gl-hover-border-blue-200.gl-hover-bg-blue-50.gl-hover-cursor-pointer.gl-relative{ class: "todo-#{todo.done? ? 'done' : 'pending'}", id: dom_id(todo) } .gl-display-flex.gl-flex-direction-column.gl-sm-flex-direction-row.gl-sm-align-items-center .todo-item.gl-overflow-hidden.gl-overflow-x-auto.gl-align-self-center.gl-w-full{ data: { qa_selector: "todo_item_container" } } @@ -32,20 +30,13 @@ = link_to_author(todo, self_added: todo.self_added?) - else = _('(removed)') - - if todo.note.present? && two_line_mention + - if todo.note.present? \: %span.action-name{ data: { qa_selector: "todo_action_name_content" } }< - - if two_line_mention - - if !todo.note.present? - = todo_action_name(todo) - - unless todo.self_assigned? - \. - - else + - if !todo.note.present? = todo_action_name(todo) - - if todo.note.present? - \: - - unless todo.note.present? || todo.self_assigned? + - unless todo.self_assigned? \. - if todo.self_assigned? @@ -53,9 +44,8 @@ = todo_self_addressing(todo) \. - if todo.note.present? - %span.action-description{ :class => ("gl-font-style-italic" if !two_line_mention) }< - - max_chars = two_line_mention ? 125 : 100 - = first_line_in_markdown(todo, :body, max_chars, is_todo: true, project: todo.project, group: todo.group) + %span.action-description< + = first_line_in_markdown(todo, :body, 125, is_todo: true, project: todo.project, group: todo.group) .todo-timestamp.gl-white-space-nowrap.gl-sm-ml-3.gl-mt-2.gl-mb-2.gl-sm-my-0.gl-px-2.gl-sm-px-0 %span.todo-timestamp.gl-font-sm.gl-text-gray-500 diff --git a/config/feature_flags/development/two_line_mention_enabled.yml b/config/feature_flags/development/two_line_mention_enabled.yml deleted file mode 100644 index d1862109ea54b842..0000000000000000 --- a/config/feature_flags/development/two_line_mention_enabled.yml +++ /dev/null @@ -1,8 +0,0 @@ ---- -name: two_line_mention_enabled -introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/106689 -rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/385889 -milestone: '15.7' -type: development -group: group::project management -default_enabled: false diff --git a/spec/features/dashboard/todos/todos_spec.rb b/spec/features/dashboard/todos/todos_spec.rb index dd1c5e6bd1fab63c..06ccd16932eb9526 100644 --- a/spec/features/dashboard/todos/todos_spec.rb +++ b/spec/features/dashboard/todos/todos_spec.rb @@ -156,11 +156,9 @@ context 'when todo has a note' do let(:note) { create(:note, project: project, note: "Check out stuff", noteable: create(:issue, project: project)) } let!(:todo) { create(:todo, :mentioned, user: user, project: project, author: author, note: note, target: note.noteable) } - let(:two_line_mention_enabled_enabled) { true } before do sign_in(user) - stub_feature_flags(two_line_mention_enabled: two_line_mention_enabled_enabled) visit dashboard_todos_path end @@ -169,14 +167,6 @@ expect(page).to have_no_content('"Check out stuff"') expect(page).to have_content('Check out stuff') end - - context 'when two_line_mention_enabled_enabled is disabled' do - let(:two_line_mention_enabled_enabled) { false } - - it 'shows mention previews on one line' do - expect(page).to have_content("#{author.name} mentioned you: \"Check out stuff\"") - end - end end end -- GitLab From 23a2f40db41d07a188b2b4ba221eaf001846a35b Mon Sep 17 00:00:00 2001 From: Marcel van Remmerden <mvanremmerden@gitlab.com> Date: Fri, 6 Jan 2023 07:15:15 +0100 Subject: [PATCH 2/2] Remove trailing whitespace --- app/helpers/markup_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/helpers/markup_helper.rb b/app/helpers/markup_helper.rb index 45629d8bd072849e..4a5720e757d1e0d9 100644 --- a/app/helpers/markup_helper.rb +++ b/app/helpers/markup_helper.rb @@ -79,7 +79,7 @@ def first_line_in_markdown(object, attribute, max_chars = nil, is_todo: false, * data-user ) ) - + # since <img> tags are stripped, this can leave empty <a> tags hanging around # (as our markdown wraps images in links) strip_empty_link_tags(text).html_safe -- GitLab