Skip to content

Commit

Permalink
chore: install spam-module (#82)
Browse files Browse the repository at this point in the history
  • Loading branch information
froger authored Jul 3, 2024
1 parent b259417 commit 4ec9ae5
Show file tree
Hide file tree
Showing 21 changed files with 8,875 additions and 7,753 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

# Ignore bundler config.
/.bundle
.pm2
app/compiled_views
.DS_Store
# Ignore the default SQLite database.
/db/*.sqlite3
Expand Down
1 change: 0 additions & 1 deletion .pm2/module_conf.json

This file was deleted.

1 change: 0 additions & 1 deletion .pm2/touch

This file was deleted.

2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ RUN export RAILS_SECRET_KEY_BASE=assets \
&& bundle install \
&& bundle config set deployment "true"

CMD ["/bin/bash", "-c", "pm2-runtime start /home/decidim/app/config/ecosystem.config.js --only $PM2_RUN"]
CMD ["pm2-runtime", "start", "config/ecosystem.config.js", "--only", "$PM2_RUN"]
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# frozen_string_literal: true
# This migration comes from decidim_spam_signal (originally 20220726153218)

class AddBannedUsersTable < ActiveRecord::Migration[5.2]
def change
create_table :decidim_banned_users do |t|
t.references :banned_user, foreign_key: { to_table: :decidim_users, on_delete: :nullify }
t.references :admin_reporter, foreign_key: { to_table: :decidim_users }
t.datetime :notified_at
t.datetime :removed_at
t.string :banned_email, index: true
t.timestamps
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# frozen_string_literal: true
# This migration comes from decidim_spam_signal (originally 20220728004242)

class CreateSpamSignalConfigTable < ActiveRecord::Migration[5.2]
def change
create_table :spam_signal_config_tables do |t|
t.integer :decidim_organization_id,
foreign_key: true,
index: { name: "index_decidim_spam_signal_on_decidim_organization_id" }
t.string :profile_scan
t.string :comment_scan

t.string :profile_obvious_cop
t.string :profile_suspicious_cop
t.string :comment_obvious_cop
t.string :comment_suspicious_cop

t.jsonb :cops_settings
t.jsonb :scan_settings
t.timestamps
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# frozen_string_literal: true
# This migration comes from decidim_spam_signal (originally 20220728095052)

class AddJustificationToBannedUsers < ActiveRecord::Migration[5.2]
def change
add_column :decidim_banned_users, :justification, :text
end
end
16 changes: 16 additions & 0 deletions db/migrate/20240703124754_unified_config.decidim_spam_signal.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# frozen_string_literal: true
# This migration comes from decidim_spam_signal (originally 20221010141918)

class UnifiedConfig < ActiveRecord::Migration[5.2]
def change
drop_table :spam_signal_config_tables
create_table :spam_signal_config_tables do |t|
t.integer :decidim_organization_id,
foreign_key: true,
index: { name: "index_decidim_spam_signal_on_decidim_organization_id" }
t.jsonb :comment_settings
t.jsonb :profile_settings
t.timestamps
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# frozen_string_literal: true
# This migration comes from decidim_spam_signal (originally 20221010141920)

class DropQuarantine < ActiveRecord::Migration[5.2]
def change
drop_table :decidim_banned_users
end
end
18 changes: 18 additions & 0 deletions db/migrate/20240703124756_copbot_email.decidim_spam_signal.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# frozen_string_literal: true
# This migration comes from decidim_spam_signal (originally 20230920151920)

class CopbotEmail < ActiveRecord::Migration[5.2]
def change
# bot email should never be [email protected]
cop = Decidim::User.where(nickname: "bot").first
if cop
cop.email = ENV.fetch("USER_BOT_EMAIL", "[email protected]")
cop.skip_confirmation!
cop.save
end
Decidim::User.where(email: "[email protected]").each do |legacy_bot|
Decidim::UserReport.where(user: legacy_bot).update(user: cop)
legacy_bot.destroy
end
end
end
6 changes: 3 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ services:
decidim:
container_name: decidim
build: .
entrypoint: ""
entrypoint: bash

ports:
- 8080:8080
volumes:
- bundle:/home/decidim/app/vendor
- .:/home/decidim/app
environment:
RAILS_ENV: production
NODE_ENV: production
Expand Down Expand Up @@ -72,7 +73,6 @@ services:
volumes:
pg-data: {}
redis-data: {}
bundle: {}

networks:
private:
Loading

0 comments on commit 4ec9ae5

Please sign in to comment.