Progress on group account search

Added group member search, group removed account, album add styles
This commit is contained in:
mgabdev
2020-12-20 19:28:32 -05:00
parent 67eb9d5890
commit 1a8ecc672c
20 changed files with 225 additions and 94 deletions

View File

@@ -404,7 +404,7 @@ class Account < ApplicationRecord
records
end
def advanced_search_for(terms, account, limit = 10, following = false, offset = 0, options = {})
def advanced_search_for(terms, account, limit = 10, offset = 0, options = {})
textsearch, query = generate_query_for_search(terms)
@onlyVerified = options[:onlyVerified] || false
@@ -426,7 +426,6 @@ class Account < ApplicationRecord
records = find_by_sql([sql, account.id, account.id, limit, offset])
ActiveRecord::Associations::Preloader.new.preload(records, :account_stat)
records
end

View File

@@ -70,6 +70,16 @@ class Group < ApplicationRecord
.limit(25)
.offset(offset)
end
def search_for_members(group, term, limit)
pattern = '%' + sanitize_sql_like(term.strip) + '%'
group.accounts.where("LOWER(username) LIKE LOWER(?)", pattern).limit(limit)
end
def search_for_removed_accounts(group, term, limit)
pattern = '%' + sanitize_sql_like(term.strip) + '%'
group.removed_accounts.where("LOWER(username) LIKE LOWER(?)", pattern).limit(limit)
end
end
def has_password?