Skip to content
代码片段 群组 项目
提交 c102c108 编辑于 作者: Joseph Snyder's avatar Joseph Snyder
浏览文件

Ignore system notes when indexing notes on work items

Before collecting the notes and internal notes for elasticsearch
indexing, downselect to the "user" scope to eliminate the usage of
all of the items that are marked as system notes.

EE: true
Changelog: fixed
上级 f65c0dcf
No related branches found
No related tags found
无相关合并请求
......@@ -69,7 +69,7 @@ def model_klass
private
def populate_notes(target, data)
notes_internal, notes = target.notes.partition(&:internal)
notes_internal, notes = target.notes.user.partition(&:internal)
internal_notes = notes_internal.sort_by(&:created_at).reverse.map(&:note).join("\n").presence
data['notes_internal'] = internal_notes.truncate_bytes(NOTES_MAXIMUM_BYTES) if internal_notes
......
......@@ -95,7 +95,6 @@
let_it_be(:note1) { create(:note_on_issue, noteable: project_work_item, project: project, note: 'Some pig') }
let_it_be(:note2) { create(:note_on_issue, noteable: project_work_item, project: project, note: 'Terrific') }
let_it_be(:note3) { create(:note, :internal, noteable: project_work_item, project: project, note: "Radiant") }
let(:expected_hash) do
base_work_item_hash.merge(
root_namespace_id: project_work_item.namespace.root_ancestor.id,
......@@ -121,6 +120,12 @@
expect(indexed_json[:notes_internal]).to eq("Newest\n…")
end
it 'does not include system notes' do
create(:note, :system, noteable: project_work_item, project: project, note: "Enchanting!")
expect(indexed_json[:notes]).not_to include('Enchanting!')
end
context 'when add_work_item_type_correct_id migration is not complete' do
before do
set_elasticsearch_migration_to :add_work_item_type_correct_id, including: false
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册