enterprise_activation.rb
933 Bytes
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
class EnterpriseActivation < Task
class RequestorRequired < Exception; end
settings_items :enterprise_id, :integer
validates_presence_of :enterprise_id
def enterprise
Enterprise.find(enterprise_id)
end
def enterprise=(ent)
self.enterprise_id = ent.id
end
def perform
raise EnterpriseActivation::RequestorRequired if requestor.nil?
self.enterprise.enable(requestor)
end
def title
_("Enterprise activation")
end
def linked_subject
{:text => target.name, :url => target.public_profile_url}
end
def information
{:message => _('%{requestor} wants to activate enterprise %{linked_subject}.')}
end
def icon
{:type => :profile_image, :profile => requestor, :url => requestor.url}
end
def target_notification_description
_('%{requestor} wants to activate enterprise %{enterprise}.') % {:requestor => requestor.name, :enterprise => enterprise.name}
end
end