blob: 63063be5fd9cd3a81ed1697495bb3a9571453c6e (
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
50
51
52
53
54
55
56
57
58
59
60
|
class User
include Rails.application.routes.url_helpers
def default_url_options
{:host => AppConfig[:pod_url]}
end
alias_method :share_with_original, :share_with
def share_with(*args)
fantasy_resque do
share_with_original(*args)
end
end
def post(class_name, opts = {})
fantasy_resque do
p = build_post(class_name, opts)
if p.save!
self.aspects.reload
aspects = self.aspects_from_ids(opts[:to])
add_to_streams(p, aspects)
dispatch_opts = {:url => post_url(p), :to => opts[:to]}
dispatch_opts.merge!(:additional_subscribers => p.root.author) if class_name == :reshare
dispatch_post(p, dispatch_opts)
end
unless opts[:created_at]
p.created_at = Time.now - 1
p.save
end
p
end
end
def comment(text, options = {})
fantasy_resque do
c = build_comment(options.merge(:text => text))
if c.save!
Postzord::Dispatch.new(self, c).post
end
c
end
end
def like(positive, options ={})
fantasy_resque do
l = build_like(options.merge(:positive => positive))
if l.save!
Postzord::Dispatch.new(self, l).post
end
l
end
end
def post_at_time(time)
p = self.post(:status_message, :text => 'hi', :to => self.aspects.first)
p.created_at = time
p.save!
end
end
|