about summary refs log tree commit diff
path: root/app/models/status.rb
diff options
context:
space:
mode:
authorOndřej Hruška <ondra@ondrovo.com>2017-09-28 09:12:17 +0200
committerOndřej Hruška <ondra@ondrovo.com>2017-09-28 09:12:17 +0200
commit9330ea1f4d34b6ef4ce6e841f1aa931a7f10f749 (patch)
tree81e346b3d9ca532b3d252135d82ce20f61780a36 /app/models/status.rb
parent06e299cef591b63bd96f320eadc873b047cd2664 (diff)
parent4aea3f88a6d30f102a79c2da7fcfac96465ba1a8 (diff)
Merge commit '4aea3f88a6d30f102a79c2da7fcfac96465ba1a8' into merging-upstream
Diffstat (limited to 'app/models/status.rb')
-rw-r--r--app/models/status.rb9
1 files changed, 6 insertions, 3 deletions
diff --git a/app/models/status.rb b/app/models/status.rb
index 514cab2e4..326d128d6 100644
--- a/app/models/status.rb
+++ b/app/models/status.rb
@@ -55,7 +55,7 @@ class Status < ApplicationRecord
   has_one :notification, as: :activity, dependent: :destroy
   has_one :stream_entry, as: :activity, inverse_of: :status
 
-  validates :uri, uniqueness: true, unless: :local?
+  validates :uri, uniqueness: true, presence: true, unless: :local?
   validates :text, presence: true, unless: :reblog?
   validates_with StatusLengthValidator
   validates :reblog, uniqueness: { scope: :account }, if: :reblog?
@@ -70,7 +70,6 @@ class Status < ApplicationRecord
   scope :without_reblogs, -> { where('statuses.reblog_of_id IS NULL') }
   scope :with_public_visibility, -> { where(visibility: :public) }
   scope :tagged_with, ->(tag) { joins(:statuses_tags).where(statuses_tags: { tag_id: tag }) }
-  scope :local_only, -> { left_outer_joins(:account).where(accounts: { domain: nil }) }
   scope :excluding_silenced_accounts, -> { left_outer_joins(:account).where(accounts: { silenced: false }) }
   scope :including_silenced_accounts, -> { left_outer_joins(:account).where(accounts: { silenced: true }) }
   scope :not_excluded_by_account, ->(account) { where.not(account_id: account.excluded_from_timeline_account_ids) }
@@ -132,6 +131,10 @@ class Status < ApplicationRecord
     !sensitive? && media_attachments.any?
   end
 
+  def emojis
+    CustomEmoji.from_text(text, account.domain)
+  end
+
   after_create :store_uri, if: :local?
 
   before_validation :prepare_contents, if: :local?
@@ -221,7 +224,7 @@ class Status < ApplicationRecord
     private
 
     def timeline_scope(local_only = false)
-      starting_scope = local_only ? Status.local_only : Status
+      starting_scope = local_only ? Status.local : Status
       starting_scope
         .with_public_visibility
         .without_reblogs