Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] 390 monthly email list #705

Merged
merged 11 commits into from
Jul 27, 2018
Prev Previous commit
Next Next commit
Add separate last_login column to users model
  • Loading branch information
mz99 committed Jul 19, 2018
commit c0e79d1e8b5f1e23b846280398cf2cd9377ace61
2 changes: 1 addition & 1 deletion backend/app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def user_locale

def set_last_login
if current_user
current_user.touch
current_user.update_columns(last_login: Time.current)
end
end

Expand Down
4 changes: 0 additions & 4 deletions backend/app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@ class User < ActiveRecord::Base
validates :email, uniqueness: true, if: proc { |u| u.email.present? }
validates :auth0_uid, uniqueness: true, if: proc { |u| u.auth0_uid.present? }

def last_time_user_was_active
impressions.order(updated_at: 'desc').first&.updated_at || updated_at
end

def self.from_token_payload(payload)
if payload['sub'].blank?
nil
Expand Down
5 changes: 5 additions & 0 deletions backend/db/migrate/20180719134105_add_last_login_to_user.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class AddLastLoginToUser < ActiveRecord::Migration[5.1]
def change
add_column :users, :last_login, :datetime
end
end