summary refs log tree commit diff
diff options
context:
space:
mode:
authorpdp8 <pdp8@pdp8.info>2024-05-02 14:34:10 +0200
committerpdp8 <pdp8@pdp8.info>2024-05-02 14:34:10 +0200
commit97d98fd5481359b96215f8a50d032c8fe96e9add (patch)
treeb02982c19a49c88abe5a727f40831f7a2e344408
parenta0512473ec1c19643dae4889a321602901df79bc (diff)
VISITED handling
-rw-r--r--server.rb14
1 files changed, 8 insertions, 6 deletions
diff --git a/server.rb b/server.rb
index 0d92f8c..9197ce5 100644
--- a/server.rb
+++ b/server.rb
@@ -65,6 +65,8 @@ helpers do
     save_inbox_object
     return unless @object and @object['inReplyTo'] and @count < 5
 
+    return if File.readlines(VISITED, chomp: true).include?(@object['inReplyTo'])
+
     # recursive thread download
     @object = @object['inReplyTo']
     @count += 1
@@ -132,7 +134,7 @@ helpers do
 
   def handle_activity
     type = @activity['type'].downcase.to_sym
-    # save_item @activity, File.join(INBOX[:dir], @activity['type'].downcase, activity_name)
+    save_item @activity, File.join(INBOX[:dir], @activity['type'].downcase, activity_name)
     if ACTIVITIES.include? type
       send(type)
     else
@@ -157,11 +159,11 @@ helpers do
     # if @activity['type'] != 'Update' && (@object['id'] and File.readlines(VISITED, chomp: true).include? @object['id'])
     # return
     # end
-    if @object['id'] and File.readlines(VISITED, chomp: true).include? @object['id']
-      return unless @activity['type'] = 'Update'
-
-      FileUtils.rm_f find_object(@object['id'])[0]
-
+    if @object['id'] and File.readlines(VISITED, chomp: true).include? @object['id'] && !(@activity['type'] = 'Update')
+      return
+      #
+      #       FileUtils.rm_f find_object(@object['id'])[0]
+      #
     end
 
     save_item @object, File.join(INBOX[:dir], 'object', @object['type'].downcase, activity_name)