about summary refs log tree commit diff
path: root/app/models
diff options
context:
space:
mode:
authorThibaut Girka <thib@sitedethib.com>2020-11-20 13:27:48 +0100
committerThibaut Girka <thib@sitedethib.com>2020-11-20 13:27:48 +0100
commit48f0f3ffeeb2b3dfb8af7d4d0fba3b64697d125c (patch)
tree665a41c2543505b75b24b41761bc5d0ff9e9b458 /app/models
parentdb01f8b942b72eaa2eacbb144261b002f8079c9c (diff)
parent8b8004a9626442ae31e4dffd79e874e9cde050c6 (diff)
Merge branch 'master' into glitch-soc/merge-upstream
Conflicts:
- `.github/ISSUE_TEMPLATE/bug_report.md`:
  Upstream added the `bug` label to bug reports.
  Did the same.
- `app/services/fan_out_on_write_service.rb`:
  Upstream put DMs back into timelines, glitch-soc was already doing it.
  Ignored upstream changes.
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