Merge remote-tracking branch 'origin/master' into gs-master

This commit is contained in:
David Yip
2017-11-28 11:45:13 -06:00
56 changed files with 867 additions and 77 deletions

View File

@@ -7,7 +7,7 @@ module AccountInteractions
def following_map(target_account_ids, account_id)
Follow.where(target_account_id: target_account_ids, account_id: account_id).each_with_object({}) do |follow, mapping|
mapping[follow.target_account_id] = {
reblogs: follow.show_reblogs?
reblogs: follow.show_reblogs?,
}
end
end
@@ -31,7 +31,7 @@ module AccountInteractions
def requested_map(target_account_ids, account_id)
FollowRequest.where(target_account_id: target_account_ids, account_id: account_id).each_with_object({}) do |follow_request, mapping|
mapping[follow_request.target_account_id] = {
reblogs: follow_request.show_reblogs?
reblogs: follow_request.show_reblogs?,
}
end
end

View File

@@ -5,8 +5,6 @@ class Form::Migration
attr_accessor :acct, :account
validates :acct, presence: true
def initialize(attrs = {})
@account = attrs[:account]
@acct = attrs[:account].acct unless @account.nil?
@@ -22,6 +20,6 @@ class Form::Migration
private
def set_account
self.account = ResolveRemoteAccountService.new.call(acct) if account.nil? && acct.present?
self.account = (ResolveRemoteAccountService.new.call(acct) if account.nil? && acct.present?)
end
end

View File

@@ -27,13 +27,17 @@ class Invite < ApplicationRecord
end
def valid_for_use?
(max_uses.nil? || uses < max_uses) && (expires_at.nil? || expires_at >= Time.now.utc)
(max_uses.nil? || uses < max_uses) && !expired?
end
def expire!
touch(:expires_at)
end
def expired?
!expires_at.nil? && expires_at < Time.now.utc
end
private
def set_code