Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

get the last change of app polished

  • Loading branch information...
commit ae44651c60cc2764997b6170bbf90459e8de2141 1 parent a688b35
Christian Meier authored
2  app/controllers/remote/domains_controller.rb
View
@@ -8,7 +8,7 @@ def last_changes
# GET /domains/last_changes_of_app
def last_changes_of_app
- @domains = Domain.all_changed_after_for_app( params[ :updated_at ], remote_permission )
+ @domains = Domain.all_changed_after_of_app( params[ :updated_at ], remote_permission )
respond_with serializer( @domains ).use( :update )
end
2  app/controllers/remote/users_controller.rb
View
@@ -8,7 +8,7 @@ def last_changes
# GET /users/last_changes_of_app
def last_changes_of_app
- @users = User.all_changed_after_for_app( params[ :updated_at ], remote_permission )
+ @users = User.all_changed_after_of_app( params[ :updated_at ], remote_permission )
respond_with serializer( @users ).use( :for_app )
end
11 app/models/domain.rb
View
@@ -14,14 +14,15 @@ def self.all_changed_after( from )
end
end
- def self.all_changed_after_for_app( from, app )
- unless from.blank?
- DomainsGroupsUser.uniq.joins( :group => :application ).where( 'application_id = ? and users.updated_at > ?',
- app.id,
- from )
+ def self.all_changed_after_of_app( from, app )
+ set = unless from.blank?
+ DomainsGroupsUser.joins( :group, :domain ).where( 'application_id = ? and domains.updated_at > ?',
+ app.id,
+ from )
else
DomainsGroupsUser.uniq.joins( :group => :application ).where( 'application_id = ?',
app.id )
end
+ set.collect { |d| d.domain }.uniq
end
end
2  app/models/user.rb
View
@@ -258,7 +258,7 @@ def reset_password_and_save
end
end
- def self.all_changed_after_for_app( from, app )
+ def self.all_changed_after_of_app( from, app )
unless from.blank?
User.uniq.joins( :groups => :application ).where( 'application_id = ? and users.updated_at > ?',
app.id,
4 config/routes.rb
View
@@ -4,10 +4,10 @@
get '/applications/last_changes', :controller => 'remote/applications', :action => :last_changes
get '/regions/last_changes', :controller => 'remote/regions', :action => :last_changes
get '/users/last_changes', :controller => 'remote/users', :action => :last_changes
- get '/users/last_changes_for_app', :controller => 'remote/users', :action => :last_changes_for_app
+ get '/users/last_changes_of_app', :controller => 'remote/users', :action => :last_changes_of_app
put '/users/setup', :controller => 'remote/users', :action => :setup
get '/domains/last_changes', :controller => 'remote/domains', :action => :last_changes
- get '/domains/last_changes_for_app', :controller => 'remote/domains', :action => :last_changes_for_app
+ get '/domains/last_changes_of_app', :controller => 'remote/domains', :action => :last_changes_of_app
post '/authentications', :controller => 'remote/authentications', :action => :create
post '/authentications/reset_password', :controller => 'remote/authentications', :action => :reset_password
Please sign in to comment.
Something went wrong with that request. Please try again.