Skip to content

Commit

Permalink
Merge branch 'master' into nav-580
Browse files Browse the repository at this point in the history
  • Loading branch information
pushcx committed Feb 27, 2022
2 parents 0fb15e4 + be2ccec commit 341735a
Show file tree
Hide file tree
Showing 13 changed files with 244 additions and 115 deletions.
6 changes: 3 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
source "https://rubygems.org"

gem "rails", "~> 6.1.4"
gem "rails", "~> 6.1.4.6"

gem "mysql2"

Expand All @@ -21,7 +21,7 @@ gem "uglifier", ">= 1.3.0"
# deployment
gem "actionpack-page_caching"
gem "exception_notification"
gem "puma"
gem "puma", ">= 5.6.2"

# security
gem "bcrypt", "~> 3.1.2"
Expand All @@ -30,7 +30,7 @@ gem "rqrcode"

# parsing
gem "pdf-reader"
gem "nokogiri", ">= 1.11.0.rc4"
gem "nokogiri", ">= 1.13.2"
gem "htmlentities"
gem "commonmarker", "~> 0.14"

Expand Down
174 changes: 87 additions & 87 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,64 +2,64 @@ GEM
remote: https://rubygems.org/
specs:
Ascii85 (1.1.0)
actioncable (6.1.4.4)
actionpack (= 6.1.4.4)
activesupport (= 6.1.4.4)
actioncable (6.1.4.6)
actionpack (= 6.1.4.6)
activesupport (= 6.1.4.6)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
actionmailbox (6.1.4.4)
actionpack (= 6.1.4.4)
activejob (= 6.1.4.4)
activerecord (= 6.1.4.4)
activestorage (= 6.1.4.4)
activesupport (= 6.1.4.4)
actionmailbox (6.1.4.6)
actionpack (= 6.1.4.6)
activejob (= 6.1.4.6)
activerecord (= 6.1.4.6)
activestorage (= 6.1.4.6)
activesupport (= 6.1.4.6)
mail (>= 2.7.1)
actionmailer (6.1.4.4)
actionpack (= 6.1.4.4)
actionview (= 6.1.4.4)
activejob (= 6.1.4.4)
activesupport (= 6.1.4.4)
actionmailer (6.1.4.6)
actionpack (= 6.1.4.6)
actionview (= 6.1.4.6)
activejob (= 6.1.4.6)
activesupport (= 6.1.4.6)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 2.0)
actionpack (6.1.4.4)
actionview (= 6.1.4.4)
activesupport (= 6.1.4.4)
actionpack (6.1.4.6)
actionview (= 6.1.4.6)
activesupport (= 6.1.4.6)
rack (~> 2.0, >= 2.0.9)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.2.0)
actionpack-page_caching (1.2.4)
actionpack (>= 4.0.0)
actiontext (6.1.4.4)
actionpack (= 6.1.4.4)
activerecord (= 6.1.4.4)
activestorage (= 6.1.4.4)
activesupport (= 6.1.4.4)
actiontext (6.1.4.6)
actionpack (= 6.1.4.6)
activerecord (= 6.1.4.6)
activestorage (= 6.1.4.6)
activesupport (= 6.1.4.6)
nokogiri (>= 1.8.5)
actionview (6.1.4.4)
activesupport (= 6.1.4.4)
actionview (6.1.4.6)
activesupport (= 6.1.4.6)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.1, >= 1.2.0)
activejob (6.1.4.4)
activesupport (= 6.1.4.4)
activejob (6.1.4.6)
activesupport (= 6.1.4.6)
globalid (>= 0.3.6)
activemodel (6.1.4.4)
activesupport (= 6.1.4.4)
activerecord (6.1.4.4)
activemodel (= 6.1.4.4)
activesupport (= 6.1.4.4)
activemodel (6.1.4.6)
activesupport (= 6.1.4.6)
activerecord (6.1.4.6)
activemodel (= 6.1.4.6)
activesupport (= 6.1.4.6)
activerecord-typedstore (1.4.0)
activerecord (>= 5.2)
activestorage (6.1.4.4)
actionpack (= 6.1.4.4)
activejob (= 6.1.4.4)
activerecord (= 6.1.4.4)
activesupport (= 6.1.4.4)
activestorage (6.1.4.6)
actionpack (= 6.1.4.6)
activejob (= 6.1.4.6)
activerecord (= 6.1.4.6)
activesupport (= 6.1.4.6)
marcel (~> 1.0.0)
mini_mime (>= 1.1.0)
activesupport (6.1.4.4)
activesupport (6.1.4.6)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
Expand Down Expand Up @@ -93,12 +93,12 @@ GEM
activerecord (>= 5.a)
database_cleaner-core (~> 2.0.0)
database_cleaner-core (2.0.1)
diff-lcs (1.4.4)
diff-lcs (1.5.0)
docile (1.4.0)
erubi (1.10.0)
exception_notification (4.4.3)
actionmailer (>= 4.0, < 7)
activesupport (>= 4.0, < 7)
exception_notification (4.5.0)
actionmailer (>= 5.2, < 8)
activesupport (>= 5.2, < 8)
execjs (2.8.1)
factory_bot (6.2.0)
activesupport (>= 5.0.0)
Expand All @@ -107,25 +107,25 @@ GEM
railties (>= 5.0.0)
faker (2.19.0)
i18n (>= 1.6, < 2)
ffi (1.15.4)
ffi (1.15.5)
flamegraph (0.9.5)
globalid (1.0.0)
activesupport (>= 5.0)
hashdiff (1.0.1)
hashery (2.1.2)
htmlentities (4.3.4)
i18n (1.8.11)
i18n (1.9.1)
concurrent-ruby (~> 1.0)
jaro_winkler (1.5.4)
jquery-rails (4.4.0)
rails-dom-testing (>= 1, < 3)
railties (>= 4.2.0)
thor (>= 0.14, < 2.0)
json (2.6.1)
listen (3.7.0)
listen (3.7.1)
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
loofah (2.13.0)
loofah (2.14.0)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
mail (2.7.1)
Expand All @@ -135,90 +135,90 @@ GEM
memory_profiler (1.0.0)
method_source (1.0.0)
mini_mime (1.1.2)
mini_portile2 (2.7.1)
mini_portile2 (2.8.0)
minitest (5.15.0)
mysql2 (0.5.3)
nio4r (2.5.8)
nokogiri (1.13.1)
mini_portile2 (~> 2.7.0)
nokogiri (1.13.3)
mini_portile2 (~> 2.8.0)
racc (~> 1.4)
oauth (0.5.6)
oauth (0.5.8)
parallel (1.21.0)
parser (3.0.2.0)
parser (3.1.0.0)
ast (~> 2.4.1)
pdf-reader (2.5.0)
pdf-reader (2.9.1)
Ascii85 (~> 1.0)
afm (~> 0.2.1)
hashery (~> 2.0)
ruby-rc4
ttfunk
public_suffix (4.0.6)
puma (5.5.2)
puma (5.6.2)
nio4r (~> 2.0)
racc (1.6.0)
rack (2.2.3)
rack-attack (6.5.0)
rack-attack (6.6.0)
rack (>= 1.0, < 3)
rack-mini-profiler (2.3.3)
rack (>= 1.2.0)
rack-test (1.1.0)
rack (>= 1.0, < 3)
rails (6.1.4.4)
actioncable (= 6.1.4.4)
actionmailbox (= 6.1.4.4)
actionmailer (= 6.1.4.4)
actionpack (= 6.1.4.4)
actiontext (= 6.1.4.4)
actionview (= 6.1.4.4)
activejob (= 6.1.4.4)
activemodel (= 6.1.4.4)
activerecord (= 6.1.4.4)
activestorage (= 6.1.4.4)
activesupport (= 6.1.4.4)
rails (6.1.4.6)
actioncable (= 6.1.4.6)
actionmailbox (= 6.1.4.6)
actionmailer (= 6.1.4.6)
actionpack (= 6.1.4.6)
actiontext (= 6.1.4.6)
actionview (= 6.1.4.6)
activejob (= 6.1.4.6)
activemodel (= 6.1.4.6)
activerecord (= 6.1.4.6)
activestorage (= 6.1.4.6)
activesupport (= 6.1.4.6)
bundler (>= 1.15.0)
railties (= 6.1.4.4)
railties (= 6.1.4.6)
sprockets-rails (>= 2.0.0)
rails-dom-testing (2.0.3)
activesupport (>= 4.2.0)
nokogiri (>= 1.6)
rails-html-sanitizer (1.4.2)
loofah (~> 2.3)
railties (6.1.4.4)
actionpack (= 6.1.4.4)
activesupport (= 6.1.4.4)
railties (6.1.4.6)
actionpack (= 6.1.4.6)
activesupport (= 6.1.4.6)
method_source
rake (>= 0.13)
thor (~> 1.0)
rainbow (3.0.0)
rainbow (3.1.1)
rake (13.0.6)
rb-fsevent (0.11.0)
rb-fsevent (0.11.1)
rb-inotify (0.10.1)
ffi (~> 1.0)
rb-readline (0.5.5)
regexp_parser (2.1.1)
regexp_parser (2.2.0)
rexml (3.2.5)
rotp (6.2.0)
rqrcode (2.1.0)
rqrcode (2.1.1)
chunky_png (~> 1.0)
rqrcode_core (~> 1.0)
rqrcode_core (1.2.0)
rspec-core (3.10.1)
rspec-support (~> 3.10.0)
rspec-expectations (3.10.1)
rspec-core (3.11.0)
rspec-support (~> 3.11.0)
rspec-expectations (3.11.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.10.0)
rspec-mocks (3.10.2)
rspec-support (~> 3.11.0)
rspec-mocks (3.11.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.10.0)
rspec-rails (5.0.2)
rspec-support (~> 3.11.0)
rspec-rails (5.1.0)
actionpack (>= 5.2)
activesupport (>= 5.2)
railties (>= 5.2)
rspec-core (~> 3.10)
rspec-expectations (~> 3.10)
rspec-mocks (~> 3.10)
rspec-support (~> 3.10)
rspec-support (3.10.2)
rspec-support (3.11.0)
rubocop (0.81.0)
jaro_winkler (~> 1.5.1)
parallel (~> 1.10)
Expand All @@ -237,7 +237,7 @@ GEM
ruby-rc4 (0.1.5)
ruumba (0.1.17)
rubocop
scenic (1.5.4)
scenic (1.5.5)
activerecord (>= 4.0.0)
railties (>= 4.0.0)
scenic-mysql_adapter (1.0.1)
Expand All @@ -249,7 +249,7 @@ GEM
simplecov_json_formatter (~> 0.1)
simplecov-html (0.12.3)
simplecov_json_formatter (0.1.3)
sitemap_generator (6.1.2)
sitemap_generator (6.2.1)
builder (~> 3.0)
sprockets (3.7.2)
concurrent-ruby (~> 1.0)
Expand Down Expand Up @@ -282,7 +282,7 @@ GEM
websocket-extensions (0.1.5)
xpath (3.2.0)
nokogiri (~> 1.8)
zeitwerk (2.5.3)
zeitwerk (2.5.4)

PLATFORMS
ruby
Expand All @@ -306,13 +306,13 @@ DEPENDENCIES
mail
memory_profiler
mysql2
nokogiri (>= 1.11.0.rc4)
nokogiri (>= 1.13.2)
oauth
pdf-reader
puma
puma (>= 5.6.2)
rack-attack
rack-mini-profiler
rails (~> 6.1.4)
rails (~> 6.1.4.6)
rb-readline
rotp
rqrcode
Expand Down
20 changes: 14 additions & 6 deletions app/controllers/stories_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def destroy
@story.is_deleted = true
@story.editor = @user

if @story.save(:validate => false)
if @story.save
Keystore.increment_value_for("user:#{@story.user.id}:stories_deleted")
end

Expand Down Expand Up @@ -134,7 +134,12 @@ def show
end

if !@story.can_be_seen_by_user?(@user)
raise ActionController::RoutingError.new("story gone")
@moderation = Moderation
.where(story: @story, comment: nil)
.where("action LIKE 'deleted story%'")
.order('id desc')
.first
return render action: :missing, status: 404
end

@comments = get_arranged_comments_from_cache(params[:id]) do
Expand Down Expand Up @@ -232,7 +237,7 @@ def undelete
@story.is_deleted = false
@story.editor = @user

if @story.save(:validate => false)
if @story.save
Keystore.increment_value_for("user:#{@story.user.id}:stories_deleted", -1)
end

Expand Down Expand Up @@ -404,10 +409,13 @@ def update_story_attributes
end

def find_story
story = Story.where(:short_id => params[:story_id]).first
story = Story.find_by(:short_id => params[:story_id])
if @user && story
story.vote = Vote.where(:user_id => @user.id,
:story_id => story.id, :comment_id => nil).first.try(:vote)
story.vote = Vote.find_by(
user: @user,
story: story.id,
comment: nil
).try(:vote)
end

story
Expand Down
Loading

0 comments on commit 341735a

Please sign in to comment.