Skip to content

keep org filter (scope) in public search #592

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
162 changes: 81 additions & 81 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,40 +1,40 @@
GEM
remote: https://rubygems.org/
specs:
actioncable (6.1.1)
actionpack (= 6.1.1)
activesupport (= 6.1.1)
actioncable (6.1.3)
actionpack (= 6.1.3)
activesupport (= 6.1.3)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
actionmailbox (6.1.1)
actionpack (= 6.1.1)
activejob (= 6.1.1)
activerecord (= 6.1.1)
activestorage (= 6.1.1)
activesupport (= 6.1.1)
actionmailbox (6.1.3)
actionpack (= 6.1.3)
activejob (= 6.1.3)
activerecord (= 6.1.3)
activestorage (= 6.1.3)
activesupport (= 6.1.3)
mail (>= 2.7.1)
actionmailer (6.1.1)
actionpack (= 6.1.1)
actionview (= 6.1.1)
activejob (= 6.1.1)
activesupport (= 6.1.1)
actionmailer (6.1.3)
actionpack (= 6.1.3)
actionview (= 6.1.3)
activejob (= 6.1.3)
activesupport (= 6.1.3)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 2.0)
actionpack (6.1.1)
actionview (= 6.1.1)
activesupport (= 6.1.1)
actionpack (6.1.3)
actionview (= 6.1.3)
activesupport (= 6.1.3)
rack (~> 2.0, >= 2.0.9)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.2.0)
actiontext (6.1.1)
actionpack (= 6.1.1)
activerecord (= 6.1.1)
activestorage (= 6.1.1)
activesupport (= 6.1.1)
actiontext (6.1.3)
actionpack (= 6.1.3)
activerecord (= 6.1.3)
activestorage (= 6.1.3)
activesupport (= 6.1.3)
nokogiri (>= 1.8.5)
actionview (6.1.1)
activesupport (= 6.1.1)
actionview (6.1.3)
activesupport (= 6.1.3)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
Expand All @@ -48,22 +48,22 @@ GEM
kaminari (~> 1.0, >= 1.2.1)
railties (>= 5.2, < 6.2)
ransack (~> 2.1, >= 2.1.1)
activejob (6.1.1)
activesupport (= 6.1.1)
activejob (6.1.3)
activesupport (= 6.1.3)
globalid (>= 0.3.6)
activemodel (6.1.1)
activesupport (= 6.1.1)
activerecord (6.1.1)
activemodel (= 6.1.1)
activesupport (= 6.1.1)
activestorage (6.1.1)
actionpack (= 6.1.1)
activejob (= 6.1.1)
activerecord (= 6.1.1)
activesupport (= 6.1.1)
activemodel (6.1.3)
activesupport (= 6.1.3)
activerecord (6.1.3)
activemodel (= 6.1.3)
activesupport (= 6.1.3)
activestorage (6.1.3)
actionpack (= 6.1.3)
activejob (= 6.1.3)
activerecord (= 6.1.3)
activesupport (= 6.1.3)
marcel (~> 0.3.1)
mimemagic (~> 0.3.2)
activesupport (6.1.1)
activesupport (6.1.3)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
Expand All @@ -76,8 +76,8 @@ GEM
arbre (1.4.0)
activesupport (>= 3.0.0, < 6.2)
ruby2_keywords (>= 0.0.2, < 1.0)
ast (2.4.1)
autoprefixer-rails (10.2.0.0)
ast (2.4.2)
autoprefixer-rails (10.2.4.0)
execjs
bcrypt (3.1.16)
bindex (0.8.1)
Expand All @@ -99,16 +99,16 @@ GEM
capistrano-rbenv (2.2.0)
capistrano (~> 3.1)
sshkit (~> 1.3)
capybara (3.34.0)
capybara (3.35.3)
addressable
mini_mime (>= 0.1.3)
nokogiri (~> 1.8)
rack (>= 1.6.0)
rack-test (>= 0.6.3)
regexp_parser (~> 1.5)
regexp_parser (>= 1.5, < 3.0)
xpath (~> 3.2)
childprocess (3.0.0)
concurrent-ruby (1.1.7)
concurrent-ruby (1.1.8)
connection_pool (2.2.3)
crass (1.0.6)
database_cleaner (1.8.5)
Expand All @@ -119,7 +119,7 @@ GEM
responders
warden (~> 1.2.3)
diff-lcs (1.4.4)
docile (1.3.4)
docile (1.3.5)
domain_name (0.5.20190701)
unf (>= 0.0.5, < 1.0.0)
dotenv (2.7.6)
Expand All @@ -131,16 +131,16 @@ GEM
tzinfo
execjs (2.7.0)
fabrication (2.21.1)
faker (2.15.1)
faker (2.16.0)
i18n (>= 1.6, < 2)
ffi (1.14.2)
formtastic (3.1.5)
actionpack (>= 3.2.13)
formtastic (4.0.0)
actionpack (>= 5.2.0)
formtastic_i18n (0.6.0)
fugit (1.4.1)
fugit (1.4.2)
et-orbi (~> 1.1, >= 1.1.8)
raabro (~> 1.4)
gli (2.19.2)
gli (2.20.0)
globalid (0.4.2)
activesupport (>= 4.2.0)
has_scope (0.7.2)
Expand All @@ -150,7 +150,7 @@ GEM
http-cookie (1.0.3)
domain_name (~> 0.5)
http_accept_language (2.1.1)
i18n (1.8.7)
i18n (1.8.9)
concurrent-ruby (~> 1.0)
inherited_resources (1.12.0)
actionpack (>= 5.2, < 6.2)
Expand Down Expand Up @@ -189,7 +189,7 @@ GEM
i18n (>= 0.7, < 2)
json (>= 1.7.7)
rest-client (>= 1.8.0)
loofah (2.8.0)
loofah (2.9.0)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
mail (2.7.1)
Expand All @@ -199,7 +199,7 @@ GEM
method_source (1.0.0)
mime-types (3.3.1)
mime-types-data (~> 3.2015)
mime-types-data (3.2020.1104)
mime-types-data (3.2021.0212)
mimemagic (0.3.5)
mini_mime (1.0.2)
mini_portile2 (2.5.0)
Expand All @@ -208,7 +208,7 @@ GEM
net-ssh (>= 2.6.5, < 7.0.0)
net-ssh (6.1.0)
netrc (0.11.0)
nio4r (2.5.4)
nio4r (2.5.5)
nokogiri (1.11.1)
mini_portile2 (~> 2.5.0)
racc (~> 1.4)
Expand All @@ -234,20 +234,20 @@ GEM
rack (2.2.3)
rack-test (1.1.0)
rack (>= 1.0, < 3)
rails (6.1.1)
actioncable (= 6.1.1)
actionmailbox (= 6.1.1)
actionmailer (= 6.1.1)
actionpack (= 6.1.1)
actiontext (= 6.1.1)
actionview (= 6.1.1)
activejob (= 6.1.1)
activemodel (= 6.1.1)
activerecord (= 6.1.1)
activestorage (= 6.1.1)
activesupport (= 6.1.1)
rails (6.1.3)
actioncable (= 6.1.3)
actionmailbox (= 6.1.3)
actionmailer (= 6.1.3)
actionpack (= 6.1.3)
actiontext (= 6.1.3)
actionview (= 6.1.3)
activejob (= 6.1.3)
activemodel (= 6.1.3)
activerecord (= 6.1.3)
activestorage (= 6.1.3)
activesupport (= 6.1.3)
bundler (>= 1.15.0)
railties (= 6.1.1)
railties (= 6.1.3)
sprockets-rails (>= 2.0.0)
rails-controller-testing (1.0.5)
actionpack (>= 5.0.1.rc1)
Expand All @@ -261,16 +261,16 @@ GEM
rails-i18n (6.0.0)
i18n (>= 0.7, < 2)
railties (>= 6.0.0, < 7)
railties (6.1.1)
actionpack (= 6.1.1)
activesupport (= 6.1.1)
railties (6.1.3)
actionpack (= 6.1.3)
activesupport (= 6.1.3)
method_source
rake (>= 0.8.7)
thor (~> 1.0)
rainbow (3.0.0)
raindrops (0.19.1)
rake (13.0.3)
ransack (2.4.1)
ransack (2.4.2)
activerecord (>= 5.2.4)
activesupport (>= 5.2.4)
i18n
Expand All @@ -279,7 +279,7 @@ GEM
ffi (~> 1.0)
rdiscount (2.2.0.2)
redis (4.2.5)
regexp_parser (1.8.2)
regexp_parser (2.0.3)
responders (3.0.1)
actionpack (>= 5.0)
railties (>= 5.0)
Expand All @@ -295,7 +295,7 @@ GEM
rspec-expectations (3.10.1)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.10.0)
rspec-mocks (3.10.1)
rspec-mocks (3.10.2)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.10.0)
rspec-rails (4.0.2)
Expand All @@ -306,8 +306,8 @@ GEM
rspec-expectations (~> 3.10)
rspec-mocks (~> 3.10)
rspec-support (~> 3.10)
rspec-support (3.10.1)
rubocop (1.8.0)
rspec-support (3.10.2)
rubocop (1.10.0)
parallel (~> 1.10)
parser (>= 3.0.0.0)
rainbow (>= 2.2.2, < 4.0)
Expand All @@ -316,14 +316,14 @@ GEM
rubocop-ast (>= 1.2.0, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 3.0)
rubocop-ast (1.4.0)
rubocop-ast (1.4.1)
parser (>= 2.7.1.5)
rubocop-rails (2.9.1)
activesupport (>= 4.2.0)
rack (>= 1.1)
rubocop (>= 0.90.0, < 2.0)
ruby-progressbar (1.11.0)
ruby2_keywords (0.0.2)
ruby2_keywords (0.0.4)
rubyzip (2.3.0)
sassc (2.4.0)
ffi (~> 1.9)
Expand All @@ -337,9 +337,9 @@ GEM
selenium-webdriver (3.142.7)
childprocess (>= 0.5, < 4.0)
rubyzip (>= 1.2.2)
shoulda-matchers (4.4.1)
shoulda-matchers (4.5.1)
activesupport (>= 4.2.0)
sidekiq (6.1.2)
sidekiq (6.1.3)
connection_pool (>= 2.2.2)
rack (~> 2.0)
redis (>= 4.2.0)
Expand All @@ -349,7 +349,7 @@ GEM
simple_form (5.0.3)
actionpack (>= 5.0)
activemodel (>= 5.0)
simplecov (0.21.1)
simplecov (0.21.2)
docile (~> 1.1)
simplecov-html (~> 0.11)
simplecov_json_formatter (~> 0.1)
Expand All @@ -366,10 +366,10 @@ GEM
actionpack (>= 4.0)
activesupport (>= 4.0)
sprockets (>= 3.0.0)
sshkit (1.21.1)
sshkit (1.21.2)
net-scp (>= 1.1.2)
net-ssh (>= 2.8.0)
thor (1.0.1)
thor (1.1.0)
tilt (2.0.10)
ttfunk (1.7.0)
tzinfo (2.0.4)
Expand All @@ -390,7 +390,7 @@ GEM
activemodel (>= 6.0.0)
bindex (>= 0.4.0)
railties (>= 6.0.0)
webdrivers (4.4.2)
webdrivers (4.5.0)
nokogiri (~> 1.6)
rubyzip (>= 1.3.0)
selenium-webdriver (>= 3.0, < 4.0)
Expand Down
12 changes: 4 additions & 8 deletions app/controllers/posts_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,16 @@ class PostsController < ApplicationController

def index
context = model.active.of_active_members

if current_organization.present?
context = context.where(
organization_id: current_organization.id
)
end

posts = if (query = params[:q]).present?
context.
search_by_query(query).
page(params[:page]).
per(25)
else
apply_scopes(context).page(params[:page]).per(25)
end
posts = apply_scopes(context)
posts = posts.search_by_query(params[:q]) if params[:q].present?
posts = posts.page(params[:page]).per(25)

instance_variable_set("@#{resources}", posts)
end
Expand Down
2 changes: 0 additions & 2 deletions app/services/report/csv.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

module Report
module Csv
MIME_TYPE = Mime[:csv]

def self.run(headers, rows)
::CSV.generate do |csv|
csv << headers
Expand Down
17 changes: 17 additions & 0 deletions app/services/report/csv/base.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
module Report
module Csv
class Base
def name
@decorator.name(:csv)
end

def mime_type
Mime[:csv]
end

def run
Report::Csv.run(@decorator.headers, @decorator.rows)
end
end
end
end
Loading