Delete spammer ui now displays error message, still deletes spammer

AI-generated summary

The “Delete spammer” feature on a Discourse forum is displaying an error message, despite successfully deleting the spammer and their posts. tobiaseigen reported this issue, sharing screenshots of the error message. codinghorror and sam suggested checking the /logs for a message explaining what failed. Upon reviewing the logs, tobiaseigen found an error message indicating a problem with processing a hijacked response, specifically failing to find all topics with certain IDs.

On my personal site, I have to delete spam users every few days. Usually I just use the flag -> it's spam -> delete spammer -> yes, delete spammer routine which works fine (even though it is many clicks away..).

Recently it’s started displaying an error - see screenshots. When I close the popups the spam post and spammer have been deleted, so not a critical issue but still.. the messaging is confusing!


1 Like

Can you repro this on try.discourse.org?

Can you have a look at your /logs there may be a message there explaining what failed?

1 Like

Ah. Thanks for the reminder. There is indeed a message in the error log.

view log
Message (10 copies reported)

Failed to process hijacked response correctly : Couldn't find all Topics with 'id': (1024, 1042, 61) [WHERE ("topics"."deleted_at" IS NULL)] (found 1 results, but was looking for 3).

Backtrace

activerecord-6.0.2.2/lib/active_record/relation/finder_methods.rb:344:in `raise_record_not_found_exception!'
activerecord-6.0.2.2/lib/active_record/relation/finder_methods.rb:492:in `find_some_ordered'
activerecord-6.0.2.2/lib/active_record/relation/finder_methods.rb:458:in `find_some'
activerecord-6.0.2.2/lib/active_record/relation/finder_methods.rb:437:in `find_with_ids'
activerecord-6.0.2.2/lib/active_record/relation/finder_methods.rb:69:in `find'
activerecord-6.0.2.2/lib/active_record/querying.rb:21:in `find'
activerecord-6.0.2.2/lib/active_record/core.rb:160:in `find'
/var/www/discourse/plugins/discourse-events/plugin.rb:297:in `block in activate!'
/var/www/discourse/lib/plugin/instance.rb:341:in `block in on'
/var/www/discourse/lib/discourse_event.rb:14:in `block in trigger'
/usr/local/lib/ruby/2.6.0/set.rb:338:in `each_key'
/usr/local/lib/ruby/2.6.0/set.rb:338:in `each'
/var/www/discourse/lib/discourse_event.rb:13:in `trigger'
/var/www/discourse/app/models/user.rb:1563:in `trigger_user_destroyed_event'
activesupport-6.0.2.2/lib/active_support/callbacks.rb:429:in `block in make_lambda'
activesupport-6.0.2.2/lib/active_support/callbacks.rb:264:in `block in conditional'
activesupport-6.0.2.2/lib/active_support/callbacks.rb:518:in `block in invoke_after'
activesupport-6.0.2.2/lib/active_support/callbacks.rb:518:in `each'
activesupport-6.0.2.2/lib/active_support/callbacks.rb:518:in `invoke_after'
activesupport-6.0.2.2/lib/active_support/callbacks.rb:136:in `run_callbacks'
activesupport-6.0.2.2/lib/active_support/callbacks.rb:827:in `_run_commit_callbacks'
activerecord-6.0.2.2/lib/active_record/transactions.rb:340:in `committed!'
activerecord-6.0.2.2/lib/active_record/connection_adapters/abstract/transaction.rb:127:in `commit_records'
activerecord-6.0.2.2/lib/active_record/connection_adapters/abstract/transaction.rb:265:in `block in commit_transaction'
/usr/local/lib/ruby/2.6.0/monitor.rb:235:in `mon_synchronize'
activerecord-6.0.2.2/lib/active_record/connection_adapters/abstract/transaction.rb:255:in `commit_transaction'
activerecord-6.0.2.2/lib/active_record/connection_adapters/abstract/transaction.rb:293:in `block in within_new_transaction'
/usr/local/lib/ruby/2.6.0/monitor.rb:235:in `mon_synchronize'
activerecord-6.0.2.2/lib/active_record/connection_adapters/abstract/transaction.rb:278:in `within_new_transaction'
activerecord-6.0.2.2/lib/active_record/connection_adapters/abstract/database_statements.rb:281:in `transaction'
activerecord-6.0.2.2/lib/active_record/transactions.rb:212:in `transaction'
/var/www/discourse/app/services/user_destroyer.rb:140:in `optional_transaction'
/var/www/discourse/app/services/user_destroyer.rb:28:in `destroy'
/var/www/discourse/app/controllers/admin/users_controller.rb:388:in `block in destroy'
/var/www/discourse/lib/hijack.rb:56:in `instance_eval'
/var/www/discourse/lib/hijack.rb:56:in `block in hijack'
/var/www/discourse/lib/scheduler/defer.rb:94:in `block in do_work'
rails_multisite-2.1.1/lib/rails_multisite/connection_management.rb:259:in `with_connection'
rails_multisite-2.1.1/lib/rails_multisite/connection_management.rb:61:in `with_connection'
/var/www/discourse/lib/scheduler/defer.rb:89:in `do_work'
/var/www/discourse/lib/scheduler/defer.rb:79:in `block (2 levels) in start_thread'

Env

hostname	discourse-app
process_id	30507
application_version	0ae504aece5fdcf6187cdde82b1c819fbd67a2b8
HTTP_HOST	discourse.FOO.org
REQUEST_URI	/admin/users/3601.json
REQUEST_METHOD	DELETE
HTTP_USER_AGENT	Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.129 Safari/537.36
HTTP_ACCEPT	*/*
HTTP_REFERER	https://discourse.FOO.org/t/for-employment/6179
HTTP_X_FORWARDED_FOR	73.19.14.84, 73.19.14.84
HTTP_X_REAL_IP	73.19.14.84
username	tobiaseigen
time	6:50 am
params	
delete_posts	true
block_email	true
block_urls	true
block_ip	true
delete_as_spammer	true
context	/t/for-employment/6179
2 Likes