diff options
Diffstat (limited to 'client.rb')
-rw-r--r-- | client.rb | 19 |
1 files changed, 8 insertions, 11 deletions
@@ -1,7 +1,7 @@ # frozen_string_literal: true # client-server -post '/' do +post '/' do # TODO protected! Time.now.strftime('%Y-%m-%dT%H:%M:%S.%N') @@ -86,7 +86,7 @@ post '/unfollow' do redirect(params['anchor'] || '/inbox') end -post '/share' do +post '/share' do # TODO protected! selection(params).each { |f| FileUtils.mv f, f.sub(%r{/inbox/}, '/shared/') } outbox 'Announce', params['id'], public @@ -112,15 +112,12 @@ end 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| - next unless o['indent'] - - object['indent'] = o['indent'] + 2 - o['replies'] << object - end + @threads << object if object['inReplyTo'].nil? || collection.select { |o| o['id'] == object['inReplyTo'] }.empty? + end + collection.each do |object| + collection.select { |o| o['id'] == object['inReplyTo'] }.each do |o| + object['indent'] = o['indent'] + 2 + o['replies'] << object end end erb :collection |