about summary refs log tree commit diff
path: root/app/models
diff options
context:
space:
mode:
authorFire Demon <firedemon@creature.cafe>2020-11-24 12:27:15 -0600
committerFire Demon <firedemon@creature.cafe>2020-11-24 12:27:15 -0600
commit69fa4f7d4f3c435018c1e7cb9e6a0fcb5b233695 (patch)
treeffbd8bc1e5c820fce33624874088863c43460299 /app/models
parent90b33ab8af91991217cdce3e2d9163756e58a691 (diff)
parent24696458bf22c8529b49f89b2791e3e07583b7e0 (diff)
Merge remote-tracking branch 'upstream/master' into merge-glitch
Diffstat (limited to 'app/models')
-rw-r--r--app/models/export.rb12
-rw-r--r--app/models/import.rb2
2 files changed, 13 insertions, 1 deletions
diff --git a/app/models/export.rb b/app/models/export.rb
index cab01f11a..5216eed5e 100644
--- a/app/models/export.rb
+++ b/app/models/export.rb
@@ -9,6 +9,14 @@ class Export
     @account = account
   end
 
+  def to_bookmarks_csv
+    CSV.generate do |csv|
+      account.bookmarks.includes(:status).reorder(id: :desc).each do |bookmark|
+        csv << [ActivityPub::TagManager.instance.uri_for(bookmark.status)]
+      end
+    end
+  end
+
   def to_blocked_accounts_csv
     to_csv account.blocking.select(:username, :domain)
   end
@@ -55,6 +63,10 @@ class Export
     account.statuses_count
   end
 
+  def total_bookmarks
+    account.bookmarks.count
+  end
+
   def total_follows
     account.following_count
   end
diff --git a/app/models/import.rb b/app/models/import.rb
index c78a04d07..702453289 100644
--- a/app/models/import.rb
+++ b/app/models/import.rb
@@ -24,7 +24,7 @@ class Import < ApplicationRecord
 
   belongs_to :account
 
-  enum type: [:following, :blocking, :muting, :domain_blocking]
+  enum type: [:following, :blocking, :muting, :domain_blocking, :bookmarks]
 
   validates :type, presence: true