Incoming email topics/replies can not be processed with user accounts that are less than the approve unless trust level


(T) #1

I have followed the steps outlined in Configuring Reply via Email ✉ and have setup polling POP3 with a Gmail account and can email new topics and replies to existing topics successfully using an Administrator account.

My settings are:
email_in: ticked
email_in_min_trust: 1
min_trust_to_create_topic: 0
enable_staged_users: unticked
reply by email enabled: ticked

The category’s Security permissions are set so that everyone can Create/Reply/See.

I need to always pre-moderate all posts/replies so have approve unless trust level set to 4. (If for testing purposes I change this to 1 the emails are processed and are posted to the category).

If I attempt to post a new category or reply to a topic via email using an account that has a trust level of 1,2 or 3. I get the following warning in the logs:

Email can not be processed: uninitialized constant User::View Delivered-To: category-name@xxx.org
Received: by 10.64.239.143 with SMTP id vs15csp407538iec;
Tue, 5 Apr 2016 06:55:26 -0700 (PDT)

/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/logster-1.2.2/lib/logster/logger.rb:74:in `add_with_opts'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/logster-1.2.2/lib/logster/logger.rb:35:in `add'
/usr/local/lib/ruby/2.0.0/logger.rb:445:in `warn'
/var/www/discourse/app/jobs/scheduled/poll_mailbox.rb:38:in `handle_failure'
/var/www/discourse/app/jobs/scheduled/poll_mailbox.rb:29:in `rescue in process_popmail'
/var/www/discourse/app/jobs/scheduled/poll_mailbox.rb:24:in `process_popmail'
/var/www/discourse/app/jobs/scheduled/poll_mailbox.rb:96:in `block (2 levels) in poll_pop3'
/usr/local/lib/ruby/2.0.0/net/pop.rb:688:in `block in delete_all'
/usr/local/lib/ruby/2.0.0/net/pop.rb:687:in `each'
/usr/local/lib/ruby/2.0.0/net/pop.rb:687:in `delete_all'
/var/www/discourse/app/jobs/scheduled/poll_mailbox.rb:95:in `block in poll_pop3'
/usr/local/lib/ruby/2.0.0/net/pop.rb:531:in `start'
/var/www/discourse/app/jobs/scheduled/poll_mailbox.rb:94:in `poll_pop3'
/var/www/discourse/app/jobs/scheduled/poll_mailbox.rb:15:in `execute'
/var/www/discourse/app/jobs/base.rb:154:in `block (2 levels) in perform'

Followed by the error:
Job exception: uninitialized constant User::View

Backtrace:

/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.6/lib/active_record/inheritance.rb:158:in `compute_type'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.6/lib/active_record/reflection.rb:295:in `compute_class'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.6/lib/active_record/reflection.rb:291:in `klass'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.6/lib/active_record/associations/association.rb:118:in `klass'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.6/lib/active_record/associations/collection_association.rb:41:in `reader'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.6/lib/active_record/associations/builder/association.rb:115:in `views'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activemodel-4.2.6/lib/active_model/serialization.rb:108:in `block in serializable_hash'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activemodel-4.2.6/lib/active_model/serialization.rb:108:in `each'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activemodel-4.2.6/lib/active_model/serialization.rb:108:in `serializable_hash'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.6/lib/active_record/serialization.rb:17:in `serializable_hash'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activemodel-4.2.6/lib/active_model/serializers/json.rb:99:in `as_json'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.6/lib/active_support/core_ext/object/json.rb:159:in `block in as_json'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.6/lib/active_support/core_ext/object/json.rb:159:in `each'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.6/lib/active_support/core_ext/object/json.rb:159:in `map'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.6/lib/active_support/core_ext/object/json.rb:159:in `as_json'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.6/lib/active_support/json/encoding.rb:35:in `encode'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.6/lib/active_support/json/encoding.rb:22:in `encode'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.6/lib/active_record/connection_adapters/postgresql/oid/json.rb:22:in `type_cast_for_database'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.6/lib/active_record/type/mutable.rb:5:in `type_cast_from_user'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.6/lib/active_record/attribute.rb:110:in `type_cast'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.6/lib/active_record/attribute.rb:42:in `original_value'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.6/lib/active_record/attribute.rb:37:in `value'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.6/lib/active_record/attribute.rb:50:in `changed_from?'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.6/lib/active_record/attribute_methods/dirty.rb:143:in `_field_changed?'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.6/lib/active_record/attribute_methods/dirty.rb:116:in `save_changed_attribute'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.6/lib/active_record/attribute_methods/dirty.rb:99:in `write_attribute'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.6/lib/active_record/attribute_methods.rb:50:in `__temp__07f63747f5f6074796f6e637'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.6/lib/active_record/attribute_assignment.rb:54:in `public_send'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.6/lib/active_record/attribute_assignment.rb:54:in `_assign_attribute'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.6/lib/active_record/attribute_assignment.rb:65:in `block in assign_nested_parameter_attributes'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.6/lib/active_record/attribute_assignment.rb:65:in `each'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.6/lib/active_record/attribute_assignment.rb:65:in `assign_nested_parameter_attributes'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.6/lib/active_record/attribute_assignment.rb:45:in `assign_attributes'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.6/lib/active_record/core.rb:566:in `init_attributes'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.6/lib/active_record/core.rb:281:in `initialize'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.6/lib/active_record/inheritance.rb:61:in `new'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.6/lib/active_record/inheritance.rb:61:in `new'
/var/www/discourse/lib/post_enqueuer.rb:14:in `enqueue'
/var/www/discourse/lib/new_post_manager.rb:131:in `enqueue'
/var/www/discourse/lib/new_post_manager.rb:83:in `default_handler'
/var/www/discourse/lib/new_post_manager.rb:113:in `call'
/var/www/discourse/lib/new_post_manager.rb:113:in `block in perform'
/var/www/discourse/lib/new_post_manager.rb:112:in `each'
/var/www/discourse/lib/new_post_manager.rb:112:in `any?'
/var/www/discourse/lib/new_post_manager.rb:112:in `perform'
/var/www/discourse/lib/email/receiver.rb:379:in `create_post'
/var/www/discourse/lib/email/receiver.rb:352:in `create_post_with_attachments'
/var/www/discourse/lib/email/receiver.rb:317:in `create_reply'
/var/www/discourse/lib/email/receiver.rb:112:in `process_internal'
/var/www/discourse/lib/email/receiver.rb:39:in `process!'
/var/www/discourse/app/jobs/scheduled/poll_mailbox.rb:27:in `process_popmail'
/var/www/discourse/app/jobs/scheduled/poll_mailbox.rb:96:in `block (2 levels) in poll_pop3'
/usr/local/lib/ruby/2.0.0/net/pop.rb:688:in `block in delete_all'
/usr/local/lib/ruby/2.0.0/net/pop.rb:687:in `each'
/usr/local/lib/ruby/2.0.0/net/pop.rb:687:in `delete_all'
/var/www/discourse/app/jobs/scheduled/poll_mailbox.rb:95:in `block in poll_pop3'
/usr/local/lib/ruby/2.0.0/net/pop.rb:531:in `start'
/var/www/discourse/app/jobs/scheduled/poll_mailbox.rb:94:in `poll_pop3'
/var/www/discourse/app/jobs/scheduled/poll_mailbox.rb:15:in `execute'
/var/www/discourse/app/jobs/base.rb:154:in `block (2 levels) in perform'

If the incoming email from accounts with trust level 1-3 worked correctly I would expect the post to appear on the Needs Approval page and not be published live. Is that the expected behaviour?
Is there a setting that I have missed or setup incorrectly?


Uninitialized constant User::View
(Régis Hanol) #2

This was fixed by @gdpelican in


(Régis Hanol) #3