summaryrefslogtreecommitdiff
path: root/client.rb
diff options
context:
space:
mode:
Diffstat (limited to 'client.rb')
-rw-r--r--client.rb37
1 files changed, 15 insertions, 22 deletions
diff --git a/client.rb b/client.rb
index b62f139..3016d02 100644
--- a/client.rb
+++ b/client.rb
@@ -134,8 +134,21 @@ end
['/inbox', '/archive', '/outbox'].each do |path|
get path, provides: 'html' do
protected!
- @items = fetch(File.join(SOCIAL_URL, path))['orderedItems']
- threads
+ @dir = path.sub('/', '')
+ collection = ordered_collection(File.join(SOCIAL_DIR, path, 'note'))['orderedItems']
+ @threads = []
+ collection.each do |object|
+ object['indent'] = 0
+ object['replies'] = []
+ if object['inReplyTo'].nil? || collection.select { |o| o['id'] == object['inReplyTo'] }.empty?
+ @threads << object
+ else
+ collection.select { |o| o['id'] == object['inReplyTo'] }.each do |o|
+ object['indent'] = o['indent'] + 4
+ o['replies'] << object
+ end
+ end
+ end
erb :collection
end
end
@@ -145,26 +158,6 @@ helpers do
halt 403 unless session['client']
end
- def outbox(activity)
- curl("-X POST -d #{activity.to_json}", File.join(SOCIAL_URL, 'outbox'))
- end
-
- def threads
- @threads = []
- @items.each do |i|
- i['indent'] = 0
- i['replies'] = []
- if i['inReplyTo'].nil? || @items.select { |it| it['id'] == i['inReplyTo'] }.empty?
- @threads << i
- else
- @items.select { |it| it['id'] == i['inReplyTo'] }.each do |it|
- i['indent'] = it['indent'] + 4
- it['replies'] << i
- end
- end
- end
- end
-
def parse_follow(follow)
case follow
when /^#/