about summary refs log tree commit diff
path: root/app/models
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2018-05-07 09:31:07 +0200
committerGitHub <noreply@github.com>2018-05-07 09:31:07 +0200
commit42cd363542abf0a12a4e877b3ad26024f24577ef (patch)
treeb9539c370516cf0dcf1cc64b4975a1b6e84b9e56 /app/models
parent0f0cc3f2eba9c8a701d735cd54206629eeea4ddb (diff)
Bot nameplates (#7391)
* Store actor type in database

* Add bot nameplate to web UI, add setting to preferences, API, AP
Fix #7365

* Fix code style issues
Diffstat (limited to 'app/models')
-rw-r--r--app/models/account.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/app/models/account.rb b/app/models/account.rb
index 4467d1512..2b3ef5cdc 100644
--- a/app/models/account.rb
+++ b/app/models/account.rb
@@ -45,6 +45,7 @@
 #  moved_to_account_id     :bigint(8)
 #  featured_collection_url :string
 #  fields                  :jsonb
+#  actor_type              :string
 #
 
 class Account < ApplicationRecord
@@ -149,6 +150,16 @@ class Account < ApplicationRecord
     moved_to_account_id.present?
   end
 
+  def bot?
+    %w(Application Service).include? actor_type
+  end
+
+  alias bot bot?
+
+  def bot=(val)
+    self.actor_type = ActiveModel::Type::Boolean.new.cast(val) ? 'Service' : 'Person'
+  end
+
   def acct
     local? ? username : "#{username}@#{domain}"
   end