diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2017-02-06 23:16:20 +0100 |
---|---|---|
committer | Eugen Rochko <eugen@zeonfederated.com> | 2017-02-06 23:16:20 +0100 |
commit | 347a153b3dc73068aedf7510c395cc350a553629 (patch) | |
tree | 8befe52ea5aa0525aae8ecd08f32a4e820d33471 /app/models | |
parent | 4d2be9f43273d010d683a0fccda97974b7249579 (diff) |
Add API modifiers to limit returned toots from public/hashtag timelines
to only those from local users; Add link to "extended information" to getting started in the UI; Add defaults for posting privacy; Change how publish button looks depending on posting privacy chosen
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/status.rb | 8 | ||||
-rw-r--r-- | app/models/user.rb | 4 |
2 files changed, 10 insertions, 2 deletions
diff --git a/app/models/status.rb b/app/models/status.rb index ab68f4e69..142dec64e 100644 --- a/app/models/status.rb +++ b/app/models/status.rb @@ -102,21 +102,25 @@ class Status < ApplicationRecord where(account: [account] + account.following) end - def as_public_timeline(account = nil) + def as_public_timeline(account = nil, local_only = false) query = joins('LEFT OUTER JOIN accounts ON statuses.account_id = accounts.id') .where(visibility: :public) .where('(statuses.in_reply_to_id IS NULL OR statuses.in_reply_to_account_id = statuses.account_id)') .where('statuses.reblog_of_id IS NULL') + query = query.where('accounts.domain IS NULL') if local_only + account.nil? ? filter_timeline_default(query) : filter_timeline_default(filter_timeline(query, account)) end - def as_tag_timeline(tag, account = nil) + def as_tag_timeline(tag, account = nil, local_only = false) query = tag.statuses .joins('LEFT OUTER JOIN accounts ON statuses.account_id = accounts.id') .where(visibility: :public) .where('statuses.reblog_of_id IS NULL') + query = query.where('accounts.domain IS NULL') if local_only + account.nil? ? filter_timeline_default(query) : filter_timeline_default(filter_timeline(query, account)) end diff --git a/app/models/user.rb b/app/models/user.rb index b34144f2c..08aac2679 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -21,4 +21,8 @@ class User < ApplicationRecord def send_devise_notification(notification, *args) devise_mailer.send(notification, self, *args).deliver_later end + + def setting_default_privacy + settings.default_privacy || (account.locked? ? 'private' : 'public') + end end |