Welcome to mirror list, hosted at ThFree Co, Russian Federation.

user_application_presenter.rb « presenters « app - github.com/diaspora/diaspora.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: ee0d170ea2b18ecb2ecdb04959d27ef665421380 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# frozen_string_literal: true

class UserApplicationPresenter
  attr_reader :scopes

  def initialize(application, scopes, authorization_id=nil)
    @app = application
    @scopes = scopes
    @authorization_id = authorization_id
  end

  def id
    @authorization_id
  end

  def name
    @app.client_name
  end

  def image
    @app.image_uri
  end

  def terms_of_services
    @app.tos_uri
  end

  def policy
    @app.policy_uri
  end

  def name?
    @app.client_name.present?
  end

  def terms_of_services?
    @app.tos_uri.present?
  end

  def policy?
    @app.policy_uri.present?
  end

  def url
    client_redirect = URI(@app.redirect_uris[0])
    client_redirect.path = "/"
    client_redirect.to_s
  end
end