Skip to content

Commit

Permalink
(to unstable branch) Adjust opengraph tag to show scrapped image (#8291)
Browse files Browse the repository at this point in the history
* paginate tag page listings (#8243)

* Update _graph.html.erb

* Update show.html.erb

* topic card count fixes for #7965 (#8249)

* fixes for #7965

* count fixes

* Update _topicCard.html.erb

* Delete _related_tags.html.erb (#8247)

* Fixes to tag counting logic (#8245)

* Update tag_test.rb

* Update tag_test.rb

* Update tag_test.rb

* Update tag.rb

* Spam2: Moderator's Queue  feature (#8196)

* queue feature spam2

* indentation issue

* bulk moderation for comments and tag count in queue

* indentation

* moderator queue

* batch controller

* first-timmer issue

* tag filter

* queue indentation

* all tags filter queue

* Don't let newcomers edit wiki pages (controller-level) (#8250)

* Don't let newcomers edit wiki pages (controller-level)

* Update wiki_controller.rb

* Update wiki_controller_test.rb

* Update wiki_controller_test.rb

* Update wiki_controller_test.rb

* Update wiki_controller_test.rb

* Update wiki_controller.rb

* Update wiki_controller.rb

* Update wiki_controller_test.rb

* Update wiki_controller_test.rb

* Bump rubocop from 0.88.0 to 0.89.0

Bumps [rubocop](https://github.com/rubocop-hq/rubocop) from 0.88.0 to 0.89.0.
- [Release notes](https://github.com/rubocop-hq/rubocop/releases)
- [Changelog](https://github.com/rubocop-hq/rubocop/blob/master/CHANGELOG.md)
- [Commits](rubocop/rubocop@v0.88.0...v0.89.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

* Bump codecov from 0.2.3 to 0.2.5

Bumps [codecov](https://github.com/codecov/codecov-ruby) from 0.2.3 to 0.2.5.
- [Release notes](https://github.com/codecov/codecov-ruby/releases)
- [Changelog](https://github.com/codecov/codecov-ruby/blob/master/CHANGELOG.md)
- [Commits](codecov/codecov-ruby@v0.2.3...v0.2.5)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

* Bump rdiscount from 2.2.0.1 to 2.2.0.2

Bumps [rdiscount](https://github.com/davidfstr/rdiscount) from 2.2.0.1 to 2.2.0.2.
- [Release notes](https://github.com/davidfstr/rdiscount/releases)
- [Changelog](https://github.com/davidfstr/rdiscount/blob/master/CHANGELOG.md)
- [Commits](davidfstr/rdiscount@2.2.0.1...2.2.0.2)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

* Adding tags to Modals of Nodes (#8238)

* adding tags in modals of Nodes #8230

* refactored #8230

* fixed tag path in the modal #8230
also fixed extra spacing when no tags on the modal

* update _flags.html.erb (#8237)

Changed "btn btn-xs" to "btn btn-sm"

* adjust opengraph tag

Co-authored-by: Jeffrey Warren <jeff@unterbahn.com>
Co-authored-by: Keshav Sethi <36025262+keshavsethi@users.noreply.github.com>
Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
Co-authored-by: renugasaraswathy <renugasaraswathy@gmail.com>
Co-authored-by: siddhama <54734665+siddhama@users.noreply.github.com>
  • Loading branch information
6 people committed Aug 12, 2020
1 parent 243e405 commit 073d3f1
Show file tree
Hide file tree
Showing 25 changed files with 648 additions and 408 deletions.
4 changes: 2 additions & 2 deletions Gemfile
Expand Up @@ -49,10 +49,10 @@ gem 'rails-dom-testing'
gem 'rails-i18n', '~> 5.1.3'
gem 'rails_autolink'
gem 'rb-readline'
gem 'rdiscount', '~> 2.2', '>= 2.2.0.1'
gem 'rdiscount', '~> 2.2'
gem "recaptcha", require: "recaptcha/rails"
gem 'responders', '~> 3.0'
gem 'rubocop', '~> 0.88.0', require: false
gem 'rubocop', '~> 0.89.0', require: false
gem "ruby-openid", :require => "openid"
gem 'sanitize'
gem 'sentry-raven'
Expand Down
14 changes: 7 additions & 7 deletions Gemfile.lock
Expand Up @@ -82,7 +82,7 @@ GEM
ci_reporter (~> 2.0)
test-unit (>= 2.5.5, < 4.0)
climate_control (0.2.0)
codecov (0.2.3)
codecov (0.2.5)
colorize
json
simplecov
Expand Down Expand Up @@ -421,7 +421,7 @@ GEM
rb-inotify (0.10.1)
ffi (~> 1.0)
rb-readline (0.5.5)
rdiscount (2.2.0.1)
rdiscount (2.2.0.2)
recaptcha (4.14.0)
json
redis (4.1.4)
Expand Down Expand Up @@ -458,7 +458,7 @@ GEM
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.9.0)
rspec-support (3.9.0)
rubocop (0.88.0)
rubocop (0.89.0)
parallel (~> 1.10)
parser (>= 2.7.1.1)
rainbow (>= 2.2.2, < 4.0)
Expand All @@ -467,8 +467,8 @@ GEM
rubocop-ast (>= 0.1.0, < 1.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 2.0)
rubocop-ast (0.1.0)
parser (>= 2.7.0.1)
rubocop-ast (0.3.0)
parser (>= 2.7.1.4)
ruby-openid (2.9.2)
ruby-progressbar (1.10.1)
ruby2_keywords (0.0.2)
Expand Down Expand Up @@ -656,13 +656,13 @@ DEPENDENCIES
rails_autolink
rake (~> 13.0.1)
rb-readline
rdiscount (~> 2.2, >= 2.2.0.1)
rdiscount (~> 2.2)
recaptcha
responders (~> 3.0)
rest-client
reverse_markdown
rspec
rubocop (~> 0.88.0)
rubocop (~> 0.89.0)
ruby-openid
sanitize
sassc-rails
Expand Down
3 changes: 2 additions & 1 deletion app/assets/javascripts/spam2.js
Expand Up @@ -50,7 +50,8 @@ function pagination(id, url) {
function search_table(filter, url) {
localStorage.setItem('filter', filter);
localStorage.setItem('page-select', pageselect);
window.location = url + filter + "/" + $("#pageselect").val();
window.location = url + filter + "/30";
localStorage.setItem('page-select', "30");
}

function batch_nav(bulk) {
Expand Down
26 changes: 5 additions & 21 deletions app/assets/stylesheets/spam2.css
Expand Up @@ -49,10 +49,6 @@
width: 100%;
}

#card-top {
margin-top: 2vh;
}

#bulk-nav {
margin-top: 2vh;
margin-bottom: 1vh;
Expand All @@ -68,6 +64,7 @@
text-align: center;
line-height: 1.6;
}

.border-curve {
border-radius: 40px;
}
Expand All @@ -76,24 +73,14 @@
color: white !important;
}

#col-search {
cursor: text;
text-align: left !important;
margin-top: 2px;
}

#col-select {
margin-top: 2px;
}

.page-table {
width: 100%;
margin-top: 10px;
}

.card .navbar .nav .nav-item .active {
color: blue;
border-bottom: 2px blue solid;
color: #343a40;
border-bottom: 2px #343a40 solid;
}

.spam-alert {
Expand All @@ -106,18 +93,15 @@
#table-card,
#bulk-nav,
.nav_top,
.page-table,
#card-top {
.page-table
{
margin-left: 5vw;
width: 90vw;
}
.nav_title {
font-size: 18px;
margin-bottom: 10px;
}
#card-top .card-header {
font-size: 18px;
}
#info-btn {
margin-left: 5vw;
}
Expand Down
149 changes: 149 additions & 0 deletions app/controllers/batch_controller.rb
@@ -0,0 +1,149 @@
class BatchController < ApplicationController
before_action :require_user

def batch_spam
if logged_in_as(%w(moderator admin))
user_spamed = []
node_spamed = 0
params[:ids].split(',').uniq.each do |nid|
node = Node.find nid
node_spamed += 1
node.spam
user = node.author
user_spamed << user.id
user.ban
end
flash[:notice] = node_spamed.to_s + ' nodes spammed and ' + user_spamed.length.to_s + ' users banned.'
redirect_to '/spam2'
else
flash[:error] = 'Only admins and moderators can mark a batch spam.'
redirect_to '/dashboard'
end
end

def batch_publish
if logged_in_as(%w(moderator admin))
node_published = 0
user_published = []
params[:ids].split(',').uniq.each do |nid|
node = Node.find nid
node_published += 1
node.publish
user = node.author
user.unban
user_published << user.id
end
flash[:notice] = node_published.to_s + ' nodes published and ' + user_published.length.to_s + ' users unbanned.'
redirect_to '/spam2'
else
flash[:error] = 'Only admins and moderators can batch publish.'
redirect_to '/dashboard'
end
end

def batch_delete
if logged_in_as(%w(moderator admin))
node_delete = 0
params[:ids].split(',').uniq.each do |nid|
node = Node.find nid
node_delete += 1
node.delete
end
flash[:notice] = node_delete.to_s + ' nodes deleted'
redirect_back fallback_location: root_path
else
flash[:error] = 'Only admins and moderators can batch delete.'
redirect_to '/dashboard'
end
end

def batch_ban
if logged_in_as(%w(admin moderator))
user_ban = []
params[:ids].split(',').uniq.each do |nid|
node = Node.find nid
user = node.author
user_ban << user.id
user.ban
end
flash[:notice] = user_ban.length.to_s + ' users banned.'
redirect_back fallback_location: root_path
else
flash[:error] = 'Only admins and moderators can ban users.'
redirect_to '/dashboard'
end
end

def batch_unban
unbanned_users = []
if logged_in_as(%w(moderator admin))
params[:ids].split(',').uniq.each do |node_id|
node = Node.find node_id
user_unban = node.author
unbanned_users << user_unban.id
user_unban.unban
end
flash[:notice] = unbanned_users.length.to_s + ' users unbanned.'
redirect_back fallback_location: root_path
else
flash[:error] = 'Only admins and moderators can unban users.'
redirect_to '/dashboard'
end
end

def batch_ban_user
users = []
if logged_in_as(%w(admin moderator))
params[:ids].split(',').uniq.each do |user_id|
user_ban = User.find user_id
users << user_ban.id
user_ban.ban
end
flash[:notice] = users.length.to_s + ' users banned.'
redirect_back fallback_location: root_path
else
flash[:error] = 'Only moderators can moderate users.'
redirect_to '/dashboard'
end
end

def batch_unban_user
if logged_in_as(%w(moderator admin))
params[:ids].split(',').uniq.each do |id|
unban_user = User.find id
unban_user.unban
end
flash[:notice] = 'Success! users unbanned.'
redirect_back fallback_location: root_path
else
flash[:error] = 'Only admins and moderators can moderate users.'
redirect_to '/dashboard'
end
end

def batch_comment
if logged_in_as(%w(moderator admin))
comment_total = 0
params[:ids].split(',').uniq.each do |cid|
comment = Comment.find cid
comment_total += 1
case params[:type]
when 'publish'
comment.publish
when 'spam'
comment.spam
user.ban
when 'delete'
comment.delete
else
flash[:notice] = 'Invalid Url'
end
end
flash[:notice] = comment_total.to_s + ' comment moderated'
redirect_back fallback_location: root_path
else
flash[:error] = 'Only admins and moderators can moderate comments.'
redirect_to '/dashboard'
end
end
end

0 comments on commit 073d3f1

Please sign in to comment.