summaryrefslogtreecommitdiff
path: root/lib/gitlab/gitaly_client/notifications.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gitlab/gitaly_client/notifications.rb')
-rw-r--r--lib/gitlab/gitaly_client/notifications.rb14
1 files changed, 5 insertions, 9 deletions
diff --git a/lib/gitlab/gitaly_client/notifications.rb b/lib/gitlab/gitaly_client/notifications.rb
index cbfb129c002..719554eac52 100644
--- a/lib/gitlab/gitaly_client/notifications.rb
+++ b/lib/gitlab/gitaly_client/notifications.rb
@@ -3,18 +3,14 @@ module Gitlab
class Notifications
attr_accessor :stub
- def initialize(repo_path)
- full_path = Gitlab::RepoPath.strip_storage_path(repo_path).
- sub(/\.git\z/, '').sub(/\.wiki\z/, '')
- @project = Project.find_by_full_path(full_path)
-
- channel = GitalyClient.get_channel(@project.repository_storage)
- @stub = Gitaly::Notifications::Stub.new(nil, nil, channel_override: channel)
+ # 'repository' is a Gitlab::Git::Repository
+ def initialize(repository)
+ @gitaly_repo = repository.gitaly_repository
+ @stub = GitalyClient.stub(:notifications, repository.storage)
end
def post_receive
- repository = Gitaly::Repository.new(path: @project.repository.path_to_repo)
- request = Gitaly::PostReceiveRequest.new(repository: repository)
+ request = Gitaly::PostReceiveRequest.new(repository: @gitaly_repo)
@stub.post_receive(request)
end
end