|
| 1 | +module GitHosting |
| 2 | + module Patches |
| 3 | + module UsersControllerPatch |
| 4 | + def create_with_disable_update |
| 5 | + # Turn of updates during repository update |
| 6 | + GitHostingObserver.set_update_active(false); |
| 7 | + |
| 8 | + # Do actual update |
| 9 | + create_without_disable_update |
| 10 | + |
| 11 | + # Reenable updates to perform a single update |
| 12 | + GitHostingObserver.set_update_active(true); |
| 13 | + end |
| 14 | + def update_with_disable_update |
| 15 | + # Turn of updates during repository update |
| 16 | + GitHostingObserver.set_update_active(false); |
| 17 | + |
| 18 | + # Do actual update |
| 19 | + update_without_disable_update |
| 20 | + |
| 21 | + # Reenable updates to perform a single update |
| 22 | + GitHostingObserver.set_update_active(true); |
| 23 | + end |
| 24 | + def destroy_with_disable_update |
| 25 | + # Turn of updates during repository update |
| 26 | + GitHostingObserver.set_update_active(false); |
| 27 | + |
| 28 | + # Do actual update |
| 29 | + destroy_without_disable_update |
| 30 | + |
| 31 | + # Reenable updates to perform a single update |
| 32 | + GitHostingObserver.set_update_active(true); |
| 33 | + end |
| 34 | + def edit_membership_with_disable_update |
| 35 | + # Turn of updates during repository update |
| 36 | + GitHostingObserver.set_update_active(false); |
| 37 | + |
| 38 | + # Do actual update |
| 39 | + edit_membership_without_disable_update |
| 40 | + |
| 41 | + # Reenable updates to perform a single update |
| 42 | + GitHostingObserver.set_update_active(true); |
| 43 | + end |
| 44 | + |
| 45 | + def self.included(base) |
| 46 | + base.class_eval do |
| 47 | + unloadable |
| 48 | + end |
| 49 | + begin |
| 50 | + base.send(:alias_method_chain, :create, :disable_update) |
| 51 | + base.send(:alias_method_chain, :update, :disable_update) |
| 52 | + base.send(:alias_method_chain, :destroy, :disable_update) |
| 53 | + base.send(:alias_method_chain, :edit_membershipt, :disable_update) |
| 54 | + rescue |
| 55 | + end |
| 56 | + end |
| 57 | + end |
| 58 | + end |
| 59 | +end |
0 commit comments