mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-05-25 09:19:15 -04:00
Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d57ca1b4bb | ||
|
|
dc4133abd2 | ||
|
|
0b4bdc6946 | ||
|
|
3d308db0d9 | ||
|
|
bfa1ae3ae2 | ||
|
|
71ef2c058b | ||
|
|
b42385be14 |
1
.github/dependabot.yml
vendored
1
.github/dependabot.yml
vendored
@@ -13,4 +13,3 @@ updates:
|
||||
interval: daily
|
||||
time: "07:00"
|
||||
open-pull-requests-limit: 10
|
||||
|
||||
|
||||
40
.github/workflows/brakeman-analysis.yml
vendored
Normal file
40
.github/workflows/brakeman-analysis.yml
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
# This workflow integrates Brakeman with GitHub's Code Scanning feature
|
||||
# Brakeman is a static analysis security vulnerability scanner for Ruby on Rails applications
|
||||
|
||||
name: Brakeman Scan
|
||||
|
||||
# This section configures the trigger for the workflow. Feel free to customize depending on your convention
|
||||
on:
|
||||
pull_request:
|
||||
branches: [ dev ]
|
||||
|
||||
jobs:
|
||||
brakeman-scan:
|
||||
name: Brakeman Scan
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
# Checkout the repository to the GitHub Actions runner
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
# Customize the ruby version depending on your needs
|
||||
- name: Setup Ruby
|
||||
uses: ruby/setup-ruby@v1
|
||||
|
||||
- name: Setup Brakeman
|
||||
env:
|
||||
BRAKEMAN_VERSION: '5.1.1' # SARIF support is provided in Brakeman version 4.10+
|
||||
run: |
|
||||
gem install brakeman --version $BRAKEMAN_VERSION
|
||||
|
||||
# Execute Brakeman CLI and generate a SARIF output with the security issues identified during the analysis
|
||||
- name: Scan
|
||||
continue-on-error: true
|
||||
run: |
|
||||
brakeman -f sarif -o output.sarif.json .
|
||||
|
||||
# Upload the SARIF file generated in the previous step
|
||||
- name: Upload SARIF
|
||||
uses: github/codeql-action/upload-sarif@v3
|
||||
with:
|
||||
sarif_file: output.sarif.json
|
||||
4
Gemfile
4
Gemfile
@@ -5,13 +5,13 @@ source 'https://rubygems.org'
|
||||
# Match ruby version in .ruby-version
|
||||
ruby File.read('.ruby-version')
|
||||
|
||||
gem 'rails', '~> 7.2.0'
|
||||
gem 'rails', '~> 7.1.0'
|
||||
|
||||
# Keeping old sprockets
|
||||
# https://github.com/rails/sprockets-rails/issues/444#issuecomment-637817050
|
||||
gem "sprockets", "<4"
|
||||
|
||||
gem 'bundler', '>= 2.4.22'
|
||||
gem 'bundler', '>= 2.3.10'
|
||||
|
||||
gem 'coffee-rails'
|
||||
gem 'haml'
|
||||
|
||||
271
Gemfile.lock
271
Gemfile.lock
@@ -33,46 +33,51 @@ GEM
|
||||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
actioncable (7.2.1)
|
||||
actionpack (= 7.2.1)
|
||||
activesupport (= 7.2.1)
|
||||
actioncable (7.1.3.4)
|
||||
actionpack (= 7.1.3.4)
|
||||
activesupport (= 7.1.3.4)
|
||||
nio4r (~> 2.0)
|
||||
websocket-driver (>= 0.6.1)
|
||||
zeitwerk (~> 2.6)
|
||||
actionmailbox (7.2.1)
|
||||
actionpack (= 7.2.1)
|
||||
activejob (= 7.2.1)
|
||||
activerecord (= 7.2.1)
|
||||
activestorage (= 7.2.1)
|
||||
activesupport (= 7.2.1)
|
||||
mail (>= 2.8.0)
|
||||
actionmailer (7.2.1)
|
||||
actionpack (= 7.2.1)
|
||||
actionview (= 7.2.1)
|
||||
activejob (= 7.2.1)
|
||||
activesupport (= 7.2.1)
|
||||
mail (>= 2.8.0)
|
||||
actionmailbox (7.1.3.4)
|
||||
actionpack (= 7.1.3.4)
|
||||
activejob (= 7.1.3.4)
|
||||
activerecord (= 7.1.3.4)
|
||||
activestorage (= 7.1.3.4)
|
||||
activesupport (= 7.1.3.4)
|
||||
mail (>= 2.7.1)
|
||||
net-imap
|
||||
net-pop
|
||||
net-smtp
|
||||
actionmailer (7.1.3.4)
|
||||
actionpack (= 7.1.3.4)
|
||||
actionview (= 7.1.3.4)
|
||||
activejob (= 7.1.3.4)
|
||||
activesupport (= 7.1.3.4)
|
||||
mail (~> 2.5, >= 2.5.4)
|
||||
net-imap
|
||||
net-pop
|
||||
net-smtp
|
||||
rails-dom-testing (~> 2.2)
|
||||
actionpack (7.2.1)
|
||||
actionview (= 7.2.1)
|
||||
activesupport (= 7.2.1)
|
||||
actionpack (7.1.3.4)
|
||||
actionview (= 7.1.3.4)
|
||||
activesupport (= 7.1.3.4)
|
||||
nokogiri (>= 1.8.5)
|
||||
racc
|
||||
rack (>= 2.2.4, < 3.2)
|
||||
rack (>= 2.2.4)
|
||||
rack-session (>= 1.0.1)
|
||||
rack-test (>= 0.6.3)
|
||||
rails-dom-testing (~> 2.2)
|
||||
rails-html-sanitizer (~> 1.6)
|
||||
useragent (~> 0.16)
|
||||
actiontext (7.2.1)
|
||||
actionpack (= 7.2.1)
|
||||
activerecord (= 7.2.1)
|
||||
activestorage (= 7.2.1)
|
||||
activesupport (= 7.2.1)
|
||||
actiontext (7.1.3.4)
|
||||
actionpack (= 7.1.3.4)
|
||||
activerecord (= 7.1.3.4)
|
||||
activestorage (= 7.1.3.4)
|
||||
activesupport (= 7.1.3.4)
|
||||
globalid (>= 0.6.0)
|
||||
nokogiri (>= 1.8.5)
|
||||
actionview (7.2.1)
|
||||
activesupport (= 7.2.1)
|
||||
actionview (7.1.3.4)
|
||||
activesupport (= 7.1.3.4)
|
||||
builder (~> 3.1)
|
||||
erubi (~> 1.11)
|
||||
rails-dom-testing (~> 2.2)
|
||||
@@ -87,45 +92,44 @@ GEM
|
||||
active_utils (3.4.1)
|
||||
activesupport (>= 4.2)
|
||||
i18n
|
||||
activejob (7.2.1)
|
||||
activesupport (= 7.2.1)
|
||||
activejob (7.1.3.4)
|
||||
activesupport (= 7.1.3.4)
|
||||
globalid (>= 0.3.6)
|
||||
activemodel (7.2.1)
|
||||
activesupport (= 7.2.1)
|
||||
activerecord (7.2.1)
|
||||
activemodel (= 7.2.1)
|
||||
activesupport (= 7.2.1)
|
||||
activemodel (7.1.3.4)
|
||||
activesupport (= 7.1.3.4)
|
||||
activerecord (7.1.3.4)
|
||||
activemodel (= 7.1.3.4)
|
||||
activesupport (= 7.1.3.4)
|
||||
timeout (>= 0.4.0)
|
||||
activestorage (7.2.1)
|
||||
actionpack (= 7.2.1)
|
||||
activejob (= 7.2.1)
|
||||
activerecord (= 7.2.1)
|
||||
activesupport (= 7.2.1)
|
||||
activestorage (7.1.3.4)
|
||||
actionpack (= 7.1.3.4)
|
||||
activejob (= 7.1.3.4)
|
||||
activerecord (= 7.1.3.4)
|
||||
activesupport (= 7.1.3.4)
|
||||
marcel (~> 1.0)
|
||||
activesupport (7.2.1)
|
||||
activesupport (7.1.3.4)
|
||||
base64
|
||||
bigdecimal
|
||||
concurrent-ruby (~> 1.0, >= 1.3.1)
|
||||
concurrent-ruby (~> 1.0, >= 1.0.2)
|
||||
connection_pool (>= 2.2.5)
|
||||
drb
|
||||
i18n (>= 1.6, < 2)
|
||||
logger (>= 1.4.2)
|
||||
minitest (>= 5.1)
|
||||
securerandom (>= 0.3)
|
||||
tzinfo (~> 2.0, >= 2.0.5)
|
||||
mutex_m
|
||||
tzinfo (~> 2.0)
|
||||
addressable (2.8.7)
|
||||
public_suffix (>= 2.0.2, < 7.0)
|
||||
ast (2.4.2)
|
||||
autoprefixer-rails (10.4.16.0)
|
||||
execjs (~> 2)
|
||||
axe-core-api (4.10.0)
|
||||
axe-core-api (4.9.1)
|
||||
dumb_delegator
|
||||
virtus
|
||||
axe-core-capybara (4.10.0)
|
||||
axe-core-api (= 4.10.0)
|
||||
axe-core-capybara (4.9.1)
|
||||
axe-core-api (= 4.9.1)
|
||||
dumb_delegator
|
||||
axe-core-rspec (4.10.0)
|
||||
axe-core-api (= 4.10.0)
|
||||
axe-core-rspec (4.9.1)
|
||||
axe-core-api (= 4.9.1)
|
||||
dumb_delegator
|
||||
virtus
|
||||
axiom-types (0.1.1)
|
||||
@@ -179,7 +183,7 @@ GEM
|
||||
image_processing (~> 1.1)
|
||||
marcel (~> 1.0.0)
|
||||
ssrf_filter (~> 1.0)
|
||||
chartkick (5.1.0)
|
||||
chartkick (5.0.7)
|
||||
childprocess (5.0.0)
|
||||
codeclimate-test-reporter (1.0.9)
|
||||
simplecov (<= 0.13)
|
||||
@@ -195,7 +199,7 @@ GEM
|
||||
coffee-script-source (1.12.2)
|
||||
comfy_bootstrap_form (4.0.9)
|
||||
rails (>= 5.0.0)
|
||||
concurrent-ruby (1.3.4)
|
||||
concurrent-ruby (1.3.3)
|
||||
connection_pool (2.4.1)
|
||||
crass (1.0.6)
|
||||
csv (3.3.0)
|
||||
@@ -204,7 +208,7 @@ GEM
|
||||
dalli (3.2.8)
|
||||
database_cleaner (2.0.2)
|
||||
database_cleaner-active_record (>= 2, < 3)
|
||||
database_cleaner-active_record (2.2.0)
|
||||
database_cleaner-active_record (2.1.0)
|
||||
activerecord (>= 5.a)
|
||||
database_cleaner-core (~> 2.0.0)
|
||||
database_cleaner-core (2.0.1)
|
||||
@@ -221,9 +225,9 @@ GEM
|
||||
discard (1.3.0)
|
||||
activerecord (>= 4.2, < 8)
|
||||
docile (1.1.5)
|
||||
dotenv (3.1.4)
|
||||
dotenv-rails (3.1.4)
|
||||
dotenv (= 3.1.4)
|
||||
dotenv (3.1.2)
|
||||
dotenv-rails (3.1.2)
|
||||
dotenv (= 3.1.2)
|
||||
railties (>= 6.1)
|
||||
drb (2.2.1)
|
||||
dumb_delegator (1.0.0)
|
||||
@@ -251,11 +255,10 @@ GEM
|
||||
railties (>= 5.0.0)
|
||||
faker (3.4.2)
|
||||
i18n (>= 1.8.11, < 2)
|
||||
faraday (2.12.0)
|
||||
faraday-net_http (>= 2.0, < 3.4)
|
||||
json
|
||||
faraday (2.10.0)
|
||||
faraday-net_http (>= 2.0, < 3.2)
|
||||
logger
|
||||
faraday-net_http (3.3.0)
|
||||
faraday-net_http (3.1.0)
|
||||
net-http
|
||||
ffi (1.16.3)
|
||||
flickraw (0.9.10)
|
||||
@@ -308,7 +311,7 @@ GEM
|
||||
csv
|
||||
mini_mime (>= 1.0.0)
|
||||
multi_xml (>= 0.5.2)
|
||||
i18n (1.14.6)
|
||||
i18n (1.14.5)
|
||||
concurrent-ruby (~> 1.0)
|
||||
i18n-tasks (1.0.14)
|
||||
activesupport (>= 4.0.2)
|
||||
@@ -320,9 +323,8 @@ GEM
|
||||
rails-i18n
|
||||
rainbow (>= 2.2.2, < 4.0)
|
||||
terminal-table (>= 1.5.1)
|
||||
icalendar (2.10.3)
|
||||
icalendar (2.10.2)
|
||||
ice_cube (~> 0.16)
|
||||
ostruct
|
||||
ice_cube (0.17.0)
|
||||
ice_nine (0.11.2)
|
||||
image_processing (1.12.2)
|
||||
@@ -337,7 +339,7 @@ GEM
|
||||
railties (>= 4.2.0)
|
||||
thor (>= 0.14, < 2.0)
|
||||
json (2.7.2)
|
||||
json-schema (4.3.1)
|
||||
json-schema (4.1.1)
|
||||
addressable (>= 2.8)
|
||||
jsonapi-resources (0.10.7)
|
||||
activerecord (>= 4.1)
|
||||
@@ -359,7 +361,7 @@ GEM
|
||||
listen (3.9.0)
|
||||
rb-fsevent (~> 0.10, >= 0.10.3)
|
||||
rb-inotify (~> 0.9, >= 0.9.10)
|
||||
logger (1.6.1)
|
||||
logger (1.6.0)
|
||||
loofah (2.22.0)
|
||||
crass (~> 1.0.2)
|
||||
nokogiri (>= 1.12.0)
|
||||
@@ -386,15 +388,16 @@ GEM
|
||||
mini_magick (4.12.0)
|
||||
mini_mime (1.1.5)
|
||||
mini_portile2 (2.8.7)
|
||||
minitest (5.25.1)
|
||||
minitest (5.24.1)
|
||||
moneta (1.0.0)
|
||||
msgpack (1.7.2)
|
||||
multi_json (1.15.0)
|
||||
multi_xml (0.7.1)
|
||||
bigdecimal (~> 3.1)
|
||||
mutex_m (0.2.0)
|
||||
net-http (0.4.1)
|
||||
uri
|
||||
net-imap (0.4.14)
|
||||
net-imap (0.4.11)
|
||||
date
|
||||
net-protocol
|
||||
net-pop (0.1.2)
|
||||
@@ -404,15 +407,14 @@ GEM
|
||||
net-smtp (0.5.0)
|
||||
net-protocol
|
||||
nio4r (2.7.3)
|
||||
nokogiri (1.16.7)
|
||||
nokogiri (1.16.6)
|
||||
mini_portile2 (~> 2.8.2)
|
||||
racc (~> 1.4)
|
||||
nokogiri (1.16.7-x86_64-linux)
|
||||
nokogiri (1.16.6-x86_64-linux)
|
||||
racc (~> 1.4)
|
||||
oauth (0.5.6)
|
||||
oj (3.16.6)
|
||||
oj (3.16.4)
|
||||
bigdecimal (>= 3.0)
|
||||
ostruct (>= 0.2)
|
||||
omniauth (1.9.2)
|
||||
hashie (>= 3.4.6)
|
||||
rack (>= 1.6.2, < 3)
|
||||
@@ -426,14 +428,13 @@ GEM
|
||||
omniauth-oauth (~> 1.1)
|
||||
rack
|
||||
orm_adapter (0.5.0)
|
||||
ostruct (0.6.0)
|
||||
parallel (1.26.3)
|
||||
parser (3.3.5.0)
|
||||
parallel (1.25.1)
|
||||
parser (3.3.4.0)
|
||||
ast (~> 2.4.1)
|
||||
racc
|
||||
percy-capybara (5.0.0)
|
||||
capybara (>= 3)
|
||||
pg (1.5.8)
|
||||
pg (1.5.6)
|
||||
platform-api (3.7.0)
|
||||
heroics (~> 0.1.1)
|
||||
moneta (~> 1.0.0)
|
||||
@@ -444,11 +445,11 @@ GEM
|
||||
method_source (~> 1.0)
|
||||
psych (5.1.2)
|
||||
stringio
|
||||
public_suffix (6.0.1)
|
||||
puma (6.4.3)
|
||||
public_suffix (6.0.0)
|
||||
puma (6.4.2)
|
||||
nio4r (~> 2.0)
|
||||
query_diet (0.7.2)
|
||||
racc (1.8.1)
|
||||
query_diet (0.7.1)
|
||||
racc (1.8.0)
|
||||
rack (2.2.9)
|
||||
rack-cors (2.0.2)
|
||||
rack (>= 2.0.0)
|
||||
@@ -462,20 +463,20 @@ GEM
|
||||
rackup (1.0.0)
|
||||
rack (< 3)
|
||||
webrick
|
||||
rails (7.2.1)
|
||||
actioncable (= 7.2.1)
|
||||
actionmailbox (= 7.2.1)
|
||||
actionmailer (= 7.2.1)
|
||||
actionpack (= 7.2.1)
|
||||
actiontext (= 7.2.1)
|
||||
actionview (= 7.2.1)
|
||||
activejob (= 7.2.1)
|
||||
activemodel (= 7.2.1)
|
||||
activerecord (= 7.2.1)
|
||||
activestorage (= 7.2.1)
|
||||
activesupport (= 7.2.1)
|
||||
rails (7.1.3.4)
|
||||
actioncable (= 7.1.3.4)
|
||||
actionmailbox (= 7.1.3.4)
|
||||
actionmailer (= 7.1.3.4)
|
||||
actionpack (= 7.1.3.4)
|
||||
actiontext (= 7.1.3.4)
|
||||
actionview (= 7.1.3.4)
|
||||
activejob (= 7.1.3.4)
|
||||
activemodel (= 7.1.3.4)
|
||||
activerecord (= 7.1.3.4)
|
||||
activestorage (= 7.1.3.4)
|
||||
activesupport (= 7.1.3.4)
|
||||
bundler (>= 1.15.0)
|
||||
railties (= 7.2.1)
|
||||
railties (= 7.1.3.4)
|
||||
rails-controller-testing (1.0.5)
|
||||
actionpack (>= 5.0.1.rc1)
|
||||
actionview (>= 5.0.1.rc1)
|
||||
@@ -495,10 +496,10 @@ GEM
|
||||
rails_stdout_logging
|
||||
rails_serve_static_assets (0.0.5)
|
||||
rails_stdout_logging (0.0.5)
|
||||
railties (7.2.1)
|
||||
actionpack (= 7.2.1)
|
||||
activesupport (= 7.2.1)
|
||||
irb (~> 1.13)
|
||||
railties (7.1.3.4)
|
||||
actionpack (= 7.1.3.4)
|
||||
activesupport (= 7.1.3.4)
|
||||
irb
|
||||
rackup (>= 1.0.0)
|
||||
rake (>= 12.2)
|
||||
thor (~> 1.0, >= 1.2.2)
|
||||
@@ -516,12 +517,13 @@ GEM
|
||||
redis-client (0.22.2)
|
||||
connection_pool
|
||||
regexp_parser (2.9.2)
|
||||
reline (0.5.10)
|
||||
reline (0.5.9)
|
||||
io-console (~> 0.5)
|
||||
responders (3.1.1)
|
||||
actionpack (>= 5.2)
|
||||
railties (>= 5.2)
|
||||
rexml (3.3.7)
|
||||
rexml (3.3.2)
|
||||
strscan
|
||||
rouge (4.1.2)
|
||||
rspec (3.13.0)
|
||||
rspec-core (~> 3.13.0)
|
||||
@@ -531,18 +533,18 @@ GEM
|
||||
activemodel (>= 3.0)
|
||||
activesupport (>= 3.0)
|
||||
rspec-mocks (>= 2.99, < 4.0)
|
||||
rspec-core (3.13.1)
|
||||
rspec-core (3.13.0)
|
||||
rspec-support (~> 3.13.0)
|
||||
rspec-expectations (3.13.2)
|
||||
rspec-expectations (3.13.1)
|
||||
diff-lcs (>= 1.2.0, < 2.0)
|
||||
rspec-support (~> 3.13.0)
|
||||
rspec-mocks (3.13.1)
|
||||
diff-lcs (>= 1.2.0, < 2.0)
|
||||
rspec-support (~> 3.13.0)
|
||||
rspec-rails (7.0.1)
|
||||
actionpack (>= 7.0)
|
||||
activesupport (>= 7.0)
|
||||
railties (>= 7.0)
|
||||
rspec-rails (6.1.3)
|
||||
actionpack (>= 6.1)
|
||||
activesupport (>= 6.1)
|
||||
railties (>= 6.1)
|
||||
rspec-core (~> 3.13)
|
||||
rspec-expectations (~> 3.13)
|
||||
rspec-mocks (~> 3.13)
|
||||
@@ -551,47 +553,48 @@ GEM
|
||||
rspectre (0.1.0)
|
||||
parser (>= 3.2.2.1)
|
||||
rspec (~> 3.9)
|
||||
rswag-api (2.14.0)
|
||||
activesupport (>= 5.2, < 8.0)
|
||||
railties (>= 5.2, < 8.0)
|
||||
rswag-specs (2.14.0)
|
||||
activesupport (>= 5.2, < 8.0)
|
||||
rswag-api (2.13.0)
|
||||
activesupport (>= 3.1, < 7.2)
|
||||
railties (>= 3.1, < 7.2)
|
||||
rswag-specs (2.13.0)
|
||||
activesupport (>= 3.1, < 7.2)
|
||||
json-schema (>= 2.2, < 5.0)
|
||||
railties (>= 5.2, < 8.0)
|
||||
railties (>= 3.1, < 7.2)
|
||||
rspec-core (>= 2.14)
|
||||
rswag-ui (2.14.0)
|
||||
actionpack (>= 5.2, < 8.0)
|
||||
railties (>= 5.2, < 8.0)
|
||||
rubocop (1.66.1)
|
||||
rswag-ui (2.13.0)
|
||||
actionpack (>= 3.1, < 7.2)
|
||||
railties (>= 3.1, < 7.2)
|
||||
rubocop (1.65.0)
|
||||
json (~> 2.3)
|
||||
language_server-protocol (>= 3.17.0)
|
||||
parallel (~> 1.10)
|
||||
parser (>= 3.3.0.2)
|
||||
rainbow (>= 2.2.2, < 4.0)
|
||||
regexp_parser (>= 2.4, < 3.0)
|
||||
rubocop-ast (>= 1.32.2, < 2.0)
|
||||
rexml (>= 3.2.5, < 4.0)
|
||||
rubocop-ast (>= 1.31.1, < 2.0)
|
||||
ruby-progressbar (~> 1.7)
|
||||
unicode-display_width (>= 2.4.0, < 3.0)
|
||||
rubocop-ast (1.32.3)
|
||||
rubocop-ast (1.31.3)
|
||||
parser (>= 3.3.1.0)
|
||||
rubocop-capybara (2.21.0)
|
||||
rubocop (~> 1.41)
|
||||
rubocop-factory_bot (2.26.1)
|
||||
rubocop (~> 1.61)
|
||||
rubocop-rails (2.26.2)
|
||||
rubocop-rails (2.25.1)
|
||||
activesupport (>= 4.2.0)
|
||||
rack (>= 1.1)
|
||||
rubocop (>= 1.52.0, < 2.0)
|
||||
rubocop (>= 1.33.0, < 2.0)
|
||||
rubocop-ast (>= 1.31.1, < 2.0)
|
||||
rubocop-rake (0.6.0)
|
||||
rubocop (~> 1.0)
|
||||
rubocop-rspec (3.0.5)
|
||||
rubocop-rspec (3.0.3)
|
||||
rubocop (~> 1.61)
|
||||
rubocop-rspec_rails (2.30.0)
|
||||
rubocop (~> 1.61)
|
||||
rubocop-rspec (~> 3, >= 3.0.1)
|
||||
ruby-progressbar (1.13.0)
|
||||
ruby-units (4.1.0)
|
||||
ruby-units (4.0.3)
|
||||
ruby-vips (2.2.1)
|
||||
ffi (~> 1.12)
|
||||
rubyzip (2.3.2)
|
||||
@@ -608,19 +611,18 @@ GEM
|
||||
sprockets (> 3.0)
|
||||
sprockets-rails
|
||||
tilt
|
||||
scout_apm (5.4.0)
|
||||
scout_apm (5.3.8)
|
||||
parser
|
||||
searchkick (5.3.1)
|
||||
activemodel (>= 6.1)
|
||||
hashie
|
||||
securerandom (0.3.1)
|
||||
selenium-webdriver (4.25.0)
|
||||
selenium-webdriver (4.23.0)
|
||||
base64 (~> 0.2)
|
||||
logger (~> 1.4)
|
||||
rexml (~> 3.2, >= 3.2.5)
|
||||
rubyzip (>= 1.2.2, < 3.0)
|
||||
websocket (~> 1.0)
|
||||
sidekiq (7.3.2)
|
||||
sidekiq (7.3.0)
|
||||
concurrent-ruby (< 2)
|
||||
connection_pool (>= 2.3.0)
|
||||
logger
|
||||
@@ -631,7 +633,7 @@ GEM
|
||||
json (>= 1.8, < 3)
|
||||
simplecov-html (~> 0.10.0)
|
||||
simplecov-html (0.10.2)
|
||||
sprockets (3.7.5)
|
||||
sprockets (3.7.3)
|
||||
base64
|
||||
concurrent-ruby (~> 1.0)
|
||||
rack (> 1, < 3)
|
||||
@@ -641,13 +643,14 @@ GEM
|
||||
sprockets (>= 3.0.0)
|
||||
ssrf_filter (1.1.2)
|
||||
stringio (3.1.1)
|
||||
strscan (3.1.0)
|
||||
sysexits (1.2.0)
|
||||
temple (0.10.3)
|
||||
terminal-table (3.0.2)
|
||||
unicode-display_width (>= 1.1.1, < 3)
|
||||
terser (1.2.3)
|
||||
execjs (>= 0.3.0, < 3)
|
||||
thor (1.3.2)
|
||||
thor (1.3.1)
|
||||
thread_safe (0.3.6)
|
||||
tilt (2.4.0)
|
||||
timecop (0.9.10)
|
||||
@@ -655,18 +658,16 @@ GEM
|
||||
trollop (1.16.2)
|
||||
tzinfo (2.0.6)
|
||||
concurrent-ruby (~> 1.0)
|
||||
unicode-display_width (2.6.0)
|
||||
unicode-display_width (2.5.0)
|
||||
unicorn (6.1.0)
|
||||
kgio (~> 2.6)
|
||||
raindrops (~> 0.7)
|
||||
uniform_notifier (1.16.0)
|
||||
uri (0.13.1)
|
||||
useragent (0.16.10)
|
||||
uri (0.13.0)
|
||||
validate_url (1.0.15)
|
||||
activemodel (>= 3.0.0)
|
||||
public_suffix
|
||||
vcr (6.3.1)
|
||||
base64
|
||||
vcr (6.2.0)
|
||||
virtus (2.0.0)
|
||||
axiom-types (~> 0.1)
|
||||
coercible (~> 1.0)
|
||||
@@ -677,7 +678,7 @@ GEM
|
||||
nokogiri (>= 1.2.0)
|
||||
rack (>= 1.0)
|
||||
rack-test (>= 0.5.3)
|
||||
webrick (1.8.2)
|
||||
webrick (1.8.1)
|
||||
websocket (1.2.11)
|
||||
websocket-driver (0.7.6)
|
||||
websocket-extensions (>= 0.1.0)
|
||||
@@ -689,7 +690,7 @@ GEM
|
||||
webrick
|
||||
xpath (3.2.0)
|
||||
nokogiri (~> 1.8)
|
||||
zeitwerk (2.6.18)
|
||||
zeitwerk (2.6.16)
|
||||
|
||||
PLATFORMS
|
||||
ruby
|
||||
@@ -708,7 +709,7 @@ DEPENDENCIES
|
||||
bootstrap-datepicker-rails
|
||||
bootstrap_form (>= 4.5.0)
|
||||
bullet
|
||||
bundler (>= 2.4.22)
|
||||
bundler (>= 2.3.10)
|
||||
byebug
|
||||
cancancan
|
||||
capybara
|
||||
@@ -767,7 +768,7 @@ DEPENDENCIES
|
||||
query_diet
|
||||
rack-cors
|
||||
rack-protection (>= 2.0.1)
|
||||
rails (~> 7.2.0)
|
||||
rails (~> 7.1.0)
|
||||
rails-assets-leaflet.markercluster!
|
||||
rails-controller-testing
|
||||
rails_12factor
|
||||
|
||||
@@ -1,19 +1,11 @@
|
||||
$(document).ready(function() {
|
||||
$('.like-btn').show();
|
||||
|
||||
/**
|
||||
* Handles the result of an ajax call and updates UI
|
||||
*
|
||||
* @param {object} data JSON data from ajax response
|
||||
* @param {string} type object type (ie: post, activity, etc)
|
||||
*/
|
||||
var likeableSuccess = function(data, type) {
|
||||
var target = '.' + type + '-' + data.id;
|
||||
var objectClass = type.charAt(0).toUpperCase() + type.slice(1);
|
||||
var likeButton = $(target + ' .' + type + '-like');
|
||||
var likeBadge = $(target + ' .like-badge');
|
||||
$('.post-like').on('ajax:success', function(event, data) {
|
||||
var likeButton = $('#post-' + data.id + ' .post-like');
|
||||
var likeBadge = $('#post-'+ data.id + ' .like-badge');
|
||||
|
||||
$(target + ' .like-count').text(data.like_count);
|
||||
$('#post-' + data.id + ' .like-count').text(data.like_count);
|
||||
if (data.liked_by_member) {
|
||||
likeBadge.addClass('liked');
|
||||
likeButton.data('method', 'delete');
|
||||
@@ -22,26 +14,11 @@ $(document).ready(function() {
|
||||
} else {
|
||||
likeBadge.removeClass('liked');
|
||||
likeButton.data('method', 'post');
|
||||
likeButton.attr('href', '/likes.json?type=' + objectClass + '&id=' + data.id);
|
||||
likeButton.attr('href', '/likes.json?type=Post&id=' + data.id);
|
||||
likeButton.text('Like');
|
||||
}
|
||||
};
|
||||
|
||||
$('.post-like').on('ajax:success', function(event, data) {
|
||||
likeableSuccess(data, 'post');
|
||||
});
|
||||
|
||||
$('.activity-like').on('ajax:success', function(event, data) {
|
||||
likeableSuccess(data, 'activity');
|
||||
});
|
||||
|
||||
$('.planting-like').on('ajax:success', function(event, data) {
|
||||
likeableSuccess(data, 'planting');
|
||||
});
|
||||
|
||||
$('.harvest-like').on('ajax:success', function(event, data) {
|
||||
likeableSuccess(data, 'harvest');
|
||||
});
|
||||
|
||||
$('.photo-like').on('ajax:success', function(event, data) {
|
||||
var likeBadge = $('#photo-'+ data.id + ' .like-badge');
|
||||
|
||||
@@ -8,9 +8,6 @@ body {
|
||||
font-family: $default-font;
|
||||
}
|
||||
|
||||
.navbar {
|
||||
flex-wrap: nowrap;
|
||||
}
|
||||
.navbar-brand {
|
||||
.site-name {
|
||||
font-family: "Modak", cursive;
|
||||
@@ -19,7 +16,7 @@ body {
|
||||
}
|
||||
|
||||
img {
|
||||
height: 100%;
|
||||
height: 60px;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@ class Activity < ApplicationRecord
|
||||
include Ownable
|
||||
include Finishable
|
||||
include SearchActivities
|
||||
include Likeable
|
||||
|
||||
belongs_to :garden, optional: true
|
||||
belongs_to :planting, optional: true
|
||||
|
||||
@@ -6,7 +6,6 @@ class Harvest < ApplicationRecord
|
||||
include PhotoCapable
|
||||
include Ownable
|
||||
include SearchHarvests
|
||||
include Likeable
|
||||
|
||||
friendly_id :harvest_slug, use: %i(slugged finders)
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@ class Planting < ApplicationRecord
|
||||
include PredictPlanting
|
||||
include PredictHarvest
|
||||
include SearchPlantings
|
||||
include Likeable
|
||||
|
||||
friendly_id :planting_slug, use: %i(slugged finders)
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
- if can?(:edit, activity)
|
||||
%span.dropdown.activity-actions
|
||||
.dropdown.activity-actions
|
||||
%a#activity-actions-button.btn.btn-info.dropdown-toggle{"aria-expanded" => "false", "aria-haspopup" => "true", "data-bs-toggle" => "dropdown", type: "button", href: '#'} Actions
|
||||
.dropdown-menu.dropdown-menu-xs{"aria-labelledby" => "planting-actions-button"}
|
||||
= activity_edit_button(activity, classes: 'dropdown-item')
|
||||
|
||||
@@ -22,17 +22,19 @@
|
||||
%small.text-muted= @activity.category
|
||||
%tt
|
||||
= @activity.due_date
|
||||
- if @activity.description.present?
|
||||
:markdown
|
||||
#{strip_tags markdownify(@activity.description)}
|
||||
= render 'likes/likes', object: @activity
|
||||
= render 'activities/actions', activity: @activity
|
||||
|
||||
.col-md-4.col-xs-12
|
||||
= render 'activities/owner', planting: @activity
|
||||
|
||||
.col-md-8.col-xs-12
|
||||
|
||||
- if @activity.description.present?
|
||||
= cute_icon
|
||||
.card
|
||||
.card-header
|
||||
%h2 Description
|
||||
.card-body
|
||||
:markdown
|
||||
#{strip_tags markdownify(@activity.description)}
|
||||
|
||||
- if @activity.garden
|
||||
%section.gardens
|
||||
@@ -46,3 +48,4 @@
|
||||
|
||||
|
||||
.col-md-4.col-xs-12
|
||||
= render 'activities/actions', activity: @activity
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
- if can?(:edit, harvest)
|
||||
%span.dropdown.harvest-actions
|
||||
.dropdown.harvest-actions
|
||||
%a#harvest-actions-button.btn.btn-info.dropdown-toggle{"aria-expanded" => "false", "aria-haspopup" => "true", "data-bs-toggle" => "dropdown", type: "button", href: '#'} Actions
|
||||
.dropdown-menu.dropdown-menu-xs{"aria-labelledby" => "harvest-actions-button"}
|
||||
= harvest_edit_button(harvest, classes: 'dropdown-item')
|
||||
|
||||
@@ -15,26 +15,13 @@
|
||||
.harvest
|
||||
.row
|
||||
.col-md-8.col-xs-12
|
||||
.jumbotron
|
||||
.d-flex.justify-content-between
|
||||
%h1.display-3
|
||||
= harvest_icon
|
||||
%strong= @harvest.crop
|
||||
%small.text-muted
|
||||
harvested by
|
||||
= @harvest.owner
|
||||
|
||||
- if @harvest.description.present?
|
||||
:markdown
|
||||
#{strip_tags markdownify(@harvest.description)}
|
||||
|
||||
= render partial: 'planting'
|
||||
= render 'likes/likes', object: @harvest
|
||||
= render 'harvests/actions', harvest: @harvest
|
||||
|
||||
%h1
|
||||
= harvest_icon
|
||||
#{@harvest.crop} harvested by #{@harvest.owner}
|
||||
.col-md-4.col-xs-12
|
||||
= render 'harvests/owner', harvest: @harvest
|
||||
= render 'harvests/actions', harvest: @harvest
|
||||
.col-md-8.col-xs-12
|
||||
= render partial: 'planting'
|
||||
.index-cards.facts
|
||||
- if @harvest.plant_part
|
||||
.card
|
||||
@@ -66,5 +53,14 @@
|
||||
Havested from
|
||||
= link_to @harvest.planting, @harvest.planting
|
||||
|
||||
- if @harvest.description.present?
|
||||
.card
|
||||
.card-header
|
||||
%h2 Notes
|
||||
.card-body
|
||||
:markdown
|
||||
#{strip_tags markdownify(@harvest.description)}
|
||||
|
||||
.col-md-4.col-xs-12
|
||||
= render 'harvests/owner', harvest: @harvest
|
||||
= render @harvest.crop
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
%span.badge.like-badge{class: liked ? 'liked' : ''}
|
||||
= like_icon
|
||||
|
||||
%span.like-count{title: t('buttons.total_likes')}= likeable.likes_count
|
||||
%span.like-count= likeable.likes_count
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
%span.likes
|
||||
- if member_signed_in? && can?(:new, Like)
|
||||
- if !object.liked_by?(current_member)
|
||||
= link_to likes_path(type: object.class.name, id: object.id, format: :json),
|
||||
title: t('buttons.like'),
|
||||
method: :post,
|
||||
remote: true,
|
||||
class: "#{object.class.name.downcase}-#{object.id} #{object.class.name.downcase}-like like-btn btn" do
|
||||
= render 'likes/count', likeable: object, liked: false
|
||||
- else
|
||||
= link_to likes_path(type: object.class.name, id: object.id, format: :json),
|
||||
title: t('buttons.unlike'),
|
||||
method: :delete,
|
||||
remote: true,
|
||||
class: "#{object.class.name.downcase}-#{object.id} #{object.class.name.downcase}-like like-btn btn" do
|
||||
= render 'likes/count', likeable: object, liked: true
|
||||
- else
|
||||
= render 'likes/count', likeable: object, liked: member_signed_in? && object.liked_by?(current_member)
|
||||
@@ -1,7 +1,7 @@
|
||||
- if can?(:edit, @photo) && can?(:destroy, @photo)
|
||||
.dropdown.float-right.photo-actions
|
||||
%a#photo-actions-button.btn.dropdown-toggle{"aria-expanded" => "false", "aria-haspopup" => "true", "data-bs-toggle" => "dropdown", type: "button", href: '#'} Actions
|
||||
.dropdown-menu.dropdown-menu-xs{"aria-labelledby" => "photo-actions-button"}
|
||||
%a#harvest-actions-button.btn.dropdown-toggle{"aria-expanded" => "false", "aria-haspopup" => "true", "data-bs-toggle" => "dropdown", type: "button", href: '#'} Actions
|
||||
.dropdown-menu.dropdown-menu-xs{"aria-labelledby" => "harvest-actions-button"}
|
||||
= edit_button(edit_photo_path(@photo), classes: 'dropdown-item')
|
||||
.dropdown-divider
|
||||
= delete_button(@photo, classes: 'dropdown-item text-danger')
|
||||
|
||||
@@ -28,12 +28,12 @@
|
||||
= render 'crops/thumbnail', crop: crop
|
||||
.col-md-3
|
||||
%p
|
||||
%span.btn= render 'photos/likes', photo: @photo
|
||||
= render 'photos/actions', photo: @photo
|
||||
= link_to @photo.link_url, class: 'btn btn-info' do
|
||||
- if @photo.source == 'flickr'
|
||||
= icon 'fab', 'flickr'
|
||||
View on #{@photo.source.titleize}
|
||||
%span.btn= render 'photos/likes', photo: @photo
|
||||
- if @photo.date_taken.present?
|
||||
%h3 Taken on #{I18n.l @photo.date_taken.to_date}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
- if can?(:edit, planting)
|
||||
%span.dropdown.planting-actions
|
||||
.dropdown.planting-actions
|
||||
%a#planting-actions-button.btn.btn-info.dropdown-toggle{"aria-expanded" => "false", "aria-haspopup" => "true", "data-bs-toggle" => "dropdown", type: "button", href: '#'} Actions
|
||||
.dropdown-menu.dropdown-menu-xs{"aria-labelledby" => "planting-actions-button"}
|
||||
= planting_edit_button(planting, classes: 'dropdown-item')
|
||||
|
||||
@@ -43,8 +43,6 @@
|
||||
%strong #{@planting.age_in_days}/#{@planting.expected_lifespan} days
|
||||
|
||||
= render 'timeline', planting: @planting
|
||||
= render 'likes/likes', object: @planting
|
||||
= render 'plantings/actions', planting: @planting
|
||||
|
||||
.col-md-4.col-xs-12
|
||||
= render 'plantings/owner', planting: @planting
|
||||
@@ -81,6 +79,8 @@
|
||||
|
||||
|
||||
.col-md-4.col-xs-12
|
||||
= render 'plantings/actions', planting: @planting
|
||||
%hr/
|
||||
= render @planting.crop
|
||||
|
||||
- if @planting.location
|
||||
|
||||
10
app/views/posts/_likes.html.haml
Normal file
10
app/views/posts/_likes.html.haml
Normal file
@@ -0,0 +1,10 @@
|
||||
|
||||
- if member_signed_in? && can?(:new, Like)
|
||||
- if !post.liked_by?(current_member)
|
||||
= link_to 'Like', likes_path(type: 'Post', id: post.id, format: :json),
|
||||
method: :post, remote: true, class: 'post-like btn like-btn'
|
||||
- else
|
||||
= link_to 'Unlike', likes_path(type: 'Post', id: post.id, format: :json),
|
||||
method: :delete, remote: true, class: 'post-like btn like-btn'
|
||||
|
||||
= render 'likes/count', likeable: post, liked: member_signed_in? && post.liked_by?(current_member)
|
||||
@@ -45,7 +45,7 @@
|
||||
= render 'photos/thumbnail', photo: photo
|
||||
|
||||
.card-footer
|
||||
= render 'likes/likes', object: @post
|
||||
= render 'posts/likes', post: @post
|
||||
.float-right
|
||||
- if can? :create, Comment
|
||||
= link_to new_comment_path(post_id: @post.id), class: 'btn' do
|
||||
|
||||
@@ -92,9 +92,6 @@ en:
|
||||
save_seeds: Save seeds
|
||||
timeline: Timeline
|
||||
write_blog_post: Write blog post
|
||||
like: Like
|
||||
unlike: Remove like
|
||||
total_likes: Total likes
|
||||
crops:
|
||||
search: Search crops
|
||||
index:
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class LikeEverything < ActiveRecord::Migration[7.1]
|
||||
def change
|
||||
change_table :activities do |t|
|
||||
t.integer :likes_count, default: 0
|
||||
end
|
||||
|
||||
change_table :plantings do |t|
|
||||
t.integer :likes_count, default: 0
|
||||
end
|
||||
|
||||
change_table :harvests do |t|
|
||||
t.integer :likes_count, default: 0
|
||||
end
|
||||
end
|
||||
end
|
||||
56
db/schema.rb
56
db/schema.rb
@@ -10,7 +10,7 @@
|
||||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema[7.1].define(version: 2024_07_14_024918) do
|
||||
ActiveRecord::Schema[7.1].define(version: 2024_02_18_053122) do
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "plpgsql"
|
||||
|
||||
@@ -54,14 +54,6 @@ ActiveRecord::Schema[7.1].define(version: 2024_07_14_024918) do
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.string "slug"
|
||||
t.integer "cached_votes_total", default: 0
|
||||
t.integer "cached_votes_score", default: 0
|
||||
t.integer "cached_votes_up", default: 0
|
||||
t.integer "cached_votes_down", default: 0
|
||||
t.integer "cached_weighted_score", default: 0
|
||||
t.integer "cached_weighted_total", default: 0
|
||||
t.float "cached_weighted_average", default: 0.0
|
||||
t.integer "likes_count", default: 0
|
||||
t.index ["garden_id"], name: "index_activities_on_garden_id"
|
||||
t.index ["owner_id"], name: "index_activities_on_owner_id"
|
||||
t.index ["planting_id"], name: "index_activities_on_planting_id"
|
||||
@@ -214,13 +206,6 @@ ActiveRecord::Schema[7.1].define(version: 2024_07_14_024918) do
|
||||
t.text "body", null: false
|
||||
t.datetime "created_at", precision: nil
|
||||
t.datetime "updated_at", precision: nil
|
||||
t.integer "cached_votes_total", default: 0
|
||||
t.integer "cached_votes_score", default: 0
|
||||
t.integer "cached_votes_up", default: 0
|
||||
t.integer "cached_votes_down", default: 0
|
||||
t.integer "cached_weighted_score", default: 0
|
||||
t.integer "cached_weighted_total", default: 0
|
||||
t.float "cached_weighted_average", default: 0.0
|
||||
end
|
||||
|
||||
create_table "crop_companions", force: :cascade do |t|
|
||||
@@ -329,7 +314,6 @@ ActiveRecord::Schema[7.1].define(version: 2024_07_14_024918) do
|
||||
t.integer "plant_part_id"
|
||||
t.float "si_weight"
|
||||
t.integer "planting_id"
|
||||
t.integer "likes_count", default: 0
|
||||
t.index ["planting_id"], name: "index_harvests_on_planting_id"
|
||||
end
|
||||
|
||||
@@ -504,13 +488,6 @@ ActiveRecord::Schema[7.1].define(version: 2024_07_14_024918) do
|
||||
t.datetime "date_taken", precision: nil
|
||||
t.integer "likes_count", default: 0
|
||||
t.string "source"
|
||||
t.integer "cached_votes_total", default: 0
|
||||
t.integer "cached_votes_score", default: 0
|
||||
t.integer "cached_votes_up", default: 0
|
||||
t.integer "cached_votes_down", default: 0
|
||||
t.integer "cached_weighted_score", default: 0
|
||||
t.integer "cached_weighted_total", default: 0
|
||||
t.float "cached_weighted_average", default: 0.0
|
||||
t.index ["fullsize_url"], name: "index_photos_on_fullsize_url", unique: true
|
||||
t.index ["thumbnail_url"], name: "index_photos_on_thumbnail_url", unique: true
|
||||
end
|
||||
@@ -553,14 +530,6 @@ ActiveRecord::Schema[7.1].define(version: 2024_07_14_024918) do
|
||||
t.integer "days_to_last_harvest"
|
||||
t.integer "parent_seed_id"
|
||||
t.integer "harvests_count", default: 0
|
||||
t.integer "cached_votes_total", default: 0
|
||||
t.integer "cached_votes_score", default: 0
|
||||
t.integer "cached_votes_up", default: 0
|
||||
t.integer "cached_votes_down", default: 0
|
||||
t.integer "cached_weighted_score", default: 0
|
||||
t.integer "cached_weighted_total", default: 0
|
||||
t.float "cached_weighted_average", default: 0.0
|
||||
t.integer "likes_count", default: 0
|
||||
t.index ["slug"], name: "index_plantings_on_slug", unique: true
|
||||
end
|
||||
|
||||
@@ -574,13 +543,6 @@ ActiveRecord::Schema[7.1].define(version: 2024_07_14_024918) do
|
||||
t.integer "forum_id"
|
||||
t.integer "likes_count", default: 0
|
||||
t.integer "comments_count", default: 0
|
||||
t.integer "cached_votes_total", default: 0
|
||||
t.integer "cached_votes_score", default: 0
|
||||
t.integer "cached_votes_up", default: 0
|
||||
t.integer "cached_votes_down", default: 0
|
||||
t.integer "cached_weighted_score", default: 0
|
||||
t.integer "cached_weighted_total", default: 0
|
||||
t.float "cached_weighted_average", default: 0.0
|
||||
t.index ["created_at", "author_id"], name: "index_posts_on_created_at_and_author_id"
|
||||
t.index ["slug"], name: "index_posts_on_slug", unique: true
|
||||
end
|
||||
@@ -628,22 +590,6 @@ ActiveRecord::Schema[7.1].define(version: 2024_07_14_024918) do
|
||||
t.index ["slug"], name: "index_seeds_on_slug", unique: true
|
||||
end
|
||||
|
||||
create_table "votes", force: :cascade do |t|
|
||||
t.string "votable_type"
|
||||
t.bigint "votable_id"
|
||||
t.string "voter_type"
|
||||
t.bigint "voter_id"
|
||||
t.boolean "vote_flag"
|
||||
t.string "vote_scope"
|
||||
t.integer "vote_weight"
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.index ["votable_id", "votable_type", "vote_scope"], name: "index_votes_on_votable_id_and_votable_type_and_vote_scope"
|
||||
t.index ["votable_type", "votable_id"], name: "index_votes_on_votable"
|
||||
t.index ["voter_id", "voter_type", "vote_scope"], name: "index_votes_on_voter_id_and_voter_type_and_vote_scope"
|
||||
t.index ["voter_type", "voter_id"], name: "index_votes_on_voter"
|
||||
end
|
||||
|
||||
add_foreign_key "active_storage_attachments", "active_storage_blobs", column: "blob_id"
|
||||
add_foreign_key "active_storage_variant_records", "active_storage_blobs", column: "blob_id"
|
||||
add_foreign_key "harvests", "plantings"
|
||||
|
||||
@@ -5,10 +5,7 @@ require 'rails_helper'
|
||||
describe 'Likeable', :js, :search do
|
||||
let(:another_member) { FactoryBot.create(:london_member) }
|
||||
let!(:post) { FactoryBot.create(:post, :reindex, author: member) }
|
||||
let!(:activity) { FactoryBot.create(:activity, :reindex, owner: member) }
|
||||
let!(:photo) { FactoryBot.create(:photo, :reindex, owner: member) }
|
||||
let!(:harvest) { FactoryBot.create(:harvest, :reindex, owner: member) }
|
||||
let!(:planting) { FactoryBot.create(:planting, :reindex, owner: member) }
|
||||
|
||||
before do
|
||||
Photo.reindex
|
||||
@@ -16,55 +13,55 @@ describe 'Likeable', :js, :search do
|
||||
|
||||
include_context 'signed in member'
|
||||
|
||||
shared_examples 'object can be liked' do
|
||||
it 'can be liked' do
|
||||
visit path
|
||||
expect(page).to have_css(like_count_class, text: "0")
|
||||
click_link '0', class: 'like-btn'
|
||||
expect(page).to have_css(like_count_class, text: "1")
|
||||
|
||||
# Reload page
|
||||
visit path
|
||||
expect(page).to have_css(like_count_class, text: "1")
|
||||
expect(page).to have_link '1'
|
||||
|
||||
click_link '1', class: 'like-btn'
|
||||
expect(page).to have_css(like_count_class, text: "0")
|
||||
end
|
||||
|
||||
it 'displays correct number of likes' do
|
||||
visit path
|
||||
expect(page).to have_css(like_count_class, text: "0")
|
||||
expect(page).to have_link '0'
|
||||
click_link '0', class: 'like-btn'
|
||||
expect(page).to have_css(like_count_class, text: "1")
|
||||
|
||||
logout(member)
|
||||
login_as(another_member)
|
||||
visit path
|
||||
|
||||
expect(page).to have_css(like_count_class, text: "1")
|
||||
click_link '1', class: 'like-btn'
|
||||
expect(page).to have_css(like_count_class, text: "2")
|
||||
logout(another_member)
|
||||
end
|
||||
end
|
||||
|
||||
describe 'photos' do
|
||||
def like_count_class
|
||||
"#photo-#{photo.id} .like-count"
|
||||
end
|
||||
|
||||
shared_examples 'photo can be liked' do
|
||||
it 'can be liked' do
|
||||
visit path
|
||||
expect(page).to have_css(like_count_class, text: "0")
|
||||
click_link '0', class: 'like-btn'
|
||||
expect(page).to have_css(like_count_class, text: "1")
|
||||
|
||||
# Reload page
|
||||
visit path
|
||||
expect(page).to have_css(like_count_class, text: "1")
|
||||
expect(page).to have_link '1'
|
||||
|
||||
click_link '1', class: 'like-btn'
|
||||
expect(page).to have_css(like_count_class, text: "0")
|
||||
end
|
||||
|
||||
it 'displays correct number of likes' do
|
||||
visit path
|
||||
expect(page).to have_css(like_count_class, text: "0")
|
||||
expect(page).to have_link '0'
|
||||
click_link '0', class: 'like-btn'
|
||||
expect(page).to have_css(like_count_class, text: "1")
|
||||
|
||||
logout(member)
|
||||
login_as(another_member)
|
||||
visit path
|
||||
|
||||
expect(page).to have_css(like_count_class, text: "1")
|
||||
click_link '1', class: 'like-btn'
|
||||
expect(page).to have_css(like_count_class, text: "2")
|
||||
logout(another_member)
|
||||
end
|
||||
end
|
||||
|
||||
describe 'photos#index' do
|
||||
let(:path) { photos_path }
|
||||
|
||||
include_examples 'object can be liked'
|
||||
include_examples 'photo can be liked'
|
||||
end
|
||||
|
||||
describe 'photos#show' do
|
||||
let(:path) { photo_path(photo) }
|
||||
|
||||
include_examples 'object can be liked'
|
||||
include_examples 'photo can be liked'
|
||||
end
|
||||
|
||||
describe 'crops#show' do
|
||||
@@ -74,35 +71,43 @@ describe 'Likeable', :js, :search do
|
||||
|
||||
before { planting.photos << photo }
|
||||
|
||||
include_examples 'object can be liked'
|
||||
include_examples 'photo can be liked'
|
||||
end
|
||||
end
|
||||
|
||||
describe 'posts' do
|
||||
let(:like_count_class) { ".post-#{post.id} .like-count" }
|
||||
let(:path) { post_path(post) }
|
||||
let(:like_count_class) { "#post-#{post.id} .like-count" }
|
||||
|
||||
include_examples 'object can be liked'
|
||||
end
|
||||
before { visit post_path(post) }
|
||||
|
||||
describe 'activities' do
|
||||
let(:like_count_class) { ".activity-#{activity.id} .like-count" }
|
||||
let(:path) { activity_path(activity) }
|
||||
it 'can be liked' do
|
||||
expect(page).to have_css(like_count_class, text: "0")
|
||||
expect(page).to have_link 'Like'
|
||||
click_link 'Like', class: 'like-btn'
|
||||
expect(page).to have_css(like_count_class, text: "1")
|
||||
|
||||
include_examples 'object can be liked'
|
||||
end
|
||||
# Reload page
|
||||
visit post_path(post)
|
||||
expect(page).to have_css(like_count_class, text: "1")
|
||||
expect(page).to have_link 'Unlike'
|
||||
|
||||
describe 'plantings' do
|
||||
let(:like_count_class) { ".planting-#{planting.id} .like-count" }
|
||||
let(:path) { planting_path(planting) }
|
||||
click_link 'Unlike', class: 'like-btn'
|
||||
expect(page).to have_css(like_count_class, text: "0")
|
||||
end
|
||||
|
||||
include_examples 'object can be liked'
|
||||
end
|
||||
it 'displays correct number of likes' do
|
||||
expect(page).to have_link 'Like'
|
||||
click_link 'Like', class: 'like-btn'
|
||||
expect(page).to have_css(like_count_class, text: "1")
|
||||
|
||||
describe 'harvests' do
|
||||
let(:like_count_class) { ".harvest-#{harvest.id} .like-count" }
|
||||
let(:path) { harvest_path(harvest) }
|
||||
logout(member)
|
||||
login_as(another_member)
|
||||
visit post_path(post)
|
||||
|
||||
include_examples 'object can be liked'
|
||||
expect(page).to have_link 'Like'
|
||||
click_link 'Like', class: 'like-btn'
|
||||
expect(page).to have_css(like_count_class, text: "2")
|
||||
logout(another_member)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
10
yarn.lock
10
yarn.lock
@@ -291,7 +291,7 @@ brace-expansion@^1.1.7:
|
||||
balanced-match "^1.0.0"
|
||||
concat-map "0.0.1"
|
||||
|
||||
braces@^3.0.3:
|
||||
braces@^3.0.2:
|
||||
version "3.0.3"
|
||||
resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.3.tgz#490332f40919452272d55a8480adc0c441358789"
|
||||
integrity sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==
|
||||
@@ -1082,11 +1082,11 @@ merge2@^1.3.0, merge2@^1.4.1:
|
||||
integrity sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==
|
||||
|
||||
micromatch@^4.0.4:
|
||||
version "4.0.8"
|
||||
resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.8.tgz#d66fa18f3a47076789320b9b1af32bd86d9fa202"
|
||||
integrity sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==
|
||||
version "4.0.5"
|
||||
resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.5.tgz#bc8999a7cbbf77cdc89f132f6e467051b49090c6"
|
||||
integrity sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==
|
||||
dependencies:
|
||||
braces "^3.0.3"
|
||||
braces "^3.0.2"
|
||||
picomatch "^2.3.1"
|
||||
|
||||
mime-db@1.52.0:
|
||||
|
||||
Reference in New Issue
Block a user