summaryrefslogtreecommitdiff
path: root/client.rb
diff options
context:
space:
mode:
authorpdp8 <pdp8@pdp8.info>2023-07-17 21:58:43 +0200
committerpdp8 <pdp8@pdp8.info>2023-07-17 21:58:43 +0200
commitbd7e17e927824461c1af167fae292906b6212894 (patch)
treeedf5a941ea494e9ce6f2a35fc7c712489613d18e /client.rb
parent8596528d9c0c07cc46279679f61729a3c06d902e (diff)
threads fixed(?)
Diffstat (limited to 'client.rb')
-rw-r--r--client.rb19
1 files changed, 8 insertions, 11 deletions
diff --git a/client.rb b/client.rb
index 386175d..3ee3a7e 100644
--- a/client.rb
+++ b/client.rb
@@ -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