Skip to content

Commit fb82a6a

Browse files
author
Stanislav Colotinschi
committed
Sync only passed space and repository
1 parent 5f79e3b commit fb82a6a

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

lib/travis/api/app/endpoint/assembla.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class Endpoint
1212
class Assembla < Endpoint
1313
include Travis::Api::App::JWTUtils
1414

15-
REQUIRED_JWT_FIELDS = %w[name email login space_id id refresh_token].freeze
15+
REQUIRED_JWT_FIELDS = %w[name email login space_id repository_id id refresh_token].freeze
1616
CLUSTER_HEADER = 'HTTP_X_ASSEMBLA_CLUSTER'.freeze
1717

1818
set prefix: '/assembla'

lib/travis/remote_vcs/user.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,11 @@ def generate_token(provider: :github, token:, app_id: 1)
3535
end
3636
end
3737

38-
def sync(user_id:)
38+
def sync(user_id:, space_id: nil, repository_id: nil)
3939
request(:post, __method__) do |req|
4040
req.url "users/#{user_id}/sync_data"
41+
req.params['space_id'] = space_id if space_id
42+
req.params['repository_id'] = repository_id if repository_id
4143
end && true
4244
end
4345

lib/travis/services/assembla_user_service.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def create_org_subscription(user, organization_id)
3838
private
3939

4040
def sync_user(user_id)
41-
Travis::RemoteVCS::User.new.sync(user_id: user_id)
41+
Travis::RemoteVCS::User.new.sync(user_id: user_id, space_id: @payload['space_id'], repository_id: @payload['repository_id'])
4242
rescue => e
4343
raise SyncError, "Failed to sync user: #{e.message}"
4444
end

0 commit comments

Comments
 (0)