Skip to content
代码片段 群组 项目
未验证 提交 e9d27ce7 编辑于 作者: Dmitry Gruzd's avatar Dmitry Gruzd 提交者: GitLab
浏览文件

Merge branch 'add_notes_work_item_stop_system_notes' into 'master'

Reject system notes when indexing notes on work items

See merge request https://gitlab.com/gitlab-org/gitlab/-/merge_requests/175632



Merged-by: default avatarDmitry Gruzd <dgruzd@gitlab.com>
Approved-by: default avatarTerri Chu <tchu@gitlab.com>
Approved-by: default avatarDmitry Gruzd <dgruzd@gitlab.com>
Reviewed-by: default avatarTerri Chu <tchu@gitlab.com>
Co-authored-by: default avatarJoseph Snyder <joe.snyder@kitware.com>
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.
先完成此消息的编辑!
想要评论请 注册