2015-04-02 09:45:39 +00:00
|
|
|
class UserEditPagePresenter
|
|
|
|
|
|
|
|
attr_reader :user
|
|
|
|
|
|
|
|
def initialize(user)
|
|
|
|
@user = user
|
|
|
|
end
|
|
|
|
|
|
|
|
def active_tokens
|
|
|
|
sort(user.active_api_tokens)
|
|
|
|
end
|
|
|
|
|
|
|
|
def revoked_tokens
|
|
|
|
sort(user.revoked_api_tokens)
|
|
|
|
end
|
|
|
|
|
|
|
|
def show_tokens?
|
|
|
|
!active_tokens.empty? || !revoked_tokens.empty?
|
|
|
|
end
|
|
|
|
|
2015-04-28 13:11:19 +00:00
|
|
|
def show_privacy_controls?
|
2015-05-10 16:40:39 +00:00
|
|
|
true
|
2015-04-28 13:11:19 +00:00
|
|
|
end
|
|
|
|
|
2015-04-02 09:45:39 +00:00
|
|
|
private
|
|
|
|
|
|
|
|
def sort(tokens)
|
|
|
|
tokens.sort_by { |token| token.created_at }.reverse
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|