Skip to content
代码片段 群组 项目
未验证 提交 095c57fe 编辑于 作者: Madelein van Niekerk's avatar Madelein van Niekerk 提交者: GitLab
浏览文件

Merge branch '424121-quick-refactor-to-use-create_or_find_by' into 'master'

No related branches found
No related tags found
无相关合并请求
......@@ -113,7 +113,7 @@ def ensure_zoekt_indexing_enabled!
search = params.fetch(:search, nil)
attributes = { root_namespace_id: root_namespace.id }
zoekt_enabled_namespace = ::Search::Zoekt::EnabledNamespace.find_or_create_by(attributes) # rubocop:disable CodeReuse/ActiveRecord -- only be called from this API
zoekt_enabled_namespace = ::Search::Zoekt::EnabledNamespace.create_or_find_by(attributes) # rubocop:disable Performance/ActiveRecordSubtransactionMethods -- only be called from this API
if !search.nil? && zoekt_enabled_namespace.search != search
zoekt_enabled_namespace.update(search: search)
end
......@@ -123,7 +123,7 @@ def ensure_zoekt_indexing_enabled!
zoekt_enabled_namespace_id: zoekt_enabled_namespace.id,
namespace_id: zoekt_enabled_namespace.root_namespace_id
}
zoekt_index = ::Search::Zoekt::Index.find_or_create_by(attributes) do |record| # rubocop:disable CodeReuse/ActiveRecord -- only be called from this API
zoekt_index = ::Search::Zoekt::Index.create_or_find_by(attributes) do |record| # rubocop:disable Performance/ActiveRecordSubtransactionMethods -- only be called from this API
record.state = ::Search::Zoekt::Index.states[:ready]
end
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册