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

Merge branch '428072-reflect-star-count-update' into 'master'

No related branches found
No related tags found
无相关合并请求
...@@ -257,6 +257,12 @@ def clear_group_with_ai_available_cache(ids) ...@@ -257,6 +257,12 @@ def clear_group_with_ai_available_cache(ids)
end end
end end
override :toggle_star
def toggle_star(project)
super
project.maintain_elasticsearch_update if self.active? && project.maintaining_elasticsearch?
end
def pending_billable_invitations def pending_billable_invitations
if ::License.current.exclude_guests_from_active_count? if ::License.current.exclude_guests_from_active_count?
pending_invitations.where('access_level > ?', ::Gitlab::Access::GUEST) pending_invitations.where('access_level > ?', ::Gitlab::Access::GUEST)
......
...@@ -3897,6 +3897,44 @@ ...@@ -3897,6 +3897,44 @@
end end
end end
describe 'starred_projects' do
let_it_be(:project) { create(:project) }
let_it_be(:user) { create(:user) }
context 'when project is not maintaining elasticsearch' do
before do
stub_ee_application_setting(elasticsearch_indexing: false)
end
it 'doest not call Elastic::ProcessBookkeepingService' do
expect(::Elastic::ProcessBookkeepingService).not_to receive(:track!)
user.toggle_star(project)
end
end
context 'when project is maintaining elasticsearch' do
before do
stub_ee_application_setting(elasticsearch_indexing: true)
end
it 'calls Elastic::ProcessBookkeepingService' do
expect(::Elastic::ProcessBookkeepingService).to receive(:track!).with(project).once
user.toggle_star(project)
end
end
context 'when user is inactive' do
before do
user.block
end
it 'doest not call Elastic::ProcessBookkeepingService' do
expect(::Elastic::ProcessBookkeepingService).not_to receive(:track!)
user.toggle_star(project)
end
end
end
describe '#external?' do describe '#external?' do
subject { user.external? } subject { user.external? }
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册