Commit 5be424565ebe71b6c4d93adfecea9d7b057ae086
1 parent
b0a86cb3
Exists in
spb-stable
and in
3 other branches
Create event and clear cache on new trag push
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Showing
1 changed file
with
13 additions
and
0 deletions
Show diff stats
app/services/git_tag_push_service.rb
| 1 | class GitTagPushService | 1 | class GitTagPushService |
| 2 | attr_accessor :project, :user, :push_data | 2 | attr_accessor :project, :user, :push_data |
| 3 | + | ||
| 3 | def execute(project, user, oldrev, newrev, ref) | 4 | def execute(project, user, oldrev, newrev, ref) |
| 4 | @project, @user = project, user | 5 | @project, @user = project, user |
| 5 | @push_data = create_push_data(oldrev, newrev, ref) | 6 | @push_data = create_push_data(oldrev, newrev, ref) |
| 7 | + | ||
| 8 | + create_push_event | ||
| 9 | + project.repository.expire_cache | ||
| 6 | project.execute_hooks(@push_data.dup, :tag_push_hooks) | 10 | project.execute_hooks(@push_data.dup, :tag_push_hooks) |
| 7 | end | 11 | end |
| 8 | 12 | ||
| @@ -24,4 +28,13 @@ class GitTagPushService | @@ -24,4 +28,13 @@ class GitTagPushService | ||
| 24 | } | 28 | } |
| 25 | } | 29 | } |
| 26 | end | 30 | end |
| 31 | + | ||
| 32 | + def create_push_event | ||
| 33 | + Event.create!( | ||
| 34 | + project: project, | ||
| 35 | + action: Event::PUSHED, | ||
| 36 | + data: push_data, | ||
| 37 | + author_id: push_data[:user_id] | ||
| 38 | + ) | ||
| 39 | + end | ||
| 27 | end | 40 | end |