[18.0] mail_drop_target: uploading a file to a Discuss channel fails (_get_as_sudo_from_request_or_raise no longer exists)

Open Beginner friendly
#351 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@parabol123654 is already working on this.

Since Nov 12, 2026.

  • #352 by @parabol123654 — open

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
76/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
python
Domain
backend

Research direction

Read mail_drop_target/controllers/discuss.py, especially mail_attachment_upload_email() around lines 31–35, and compare its channel access check with the 18.0 upload controller’s _get_thread_with_access() approach. Run core mail tests TestToggleUpload.test_upload_allowed and test_upload_denied with this module installed; done means direct channel uploads succeed and .eml/.msg imports continue to work.

Written by the indexing model from the issue text.

Description

Module: mail_drop_target (18.0)

Steps to reproduce

  1. Install mail_drop_target.
  2. Upload a file to a Discuss channel through /mail/attachment/upload without is_pending (a file attached directly to the thread). Core test mail TestToggleUpload does this, and so does any client posting a file to a channel.

Actual

AttributeError: 'discuss.channel.member' object has no attribute '_get_as_sudo_from_request_or_raise'
  File ".../mail_drop_target/controllers/discuss.py", line 20, in mail_attachment_upload
  File ".../mail_drop_target/controllers/discuss.py", line 33, in mail_attachment_upload_email

The upload fails with a server error. Core TestToggleUpload.test_upload_allowed and test_upload_denied fail with this module installed.

Expected

The file is uploaded, or the email is imported when it is an .eml/.msg file, as on other threads.

Cause

mail_attachment_upload_email() (controllers/discuss.py:31-35) gets the channel member with discuss.channel.member._get_as_sudo_from_request_or_raise(). That helper existed in 17.0 but not in 18.0, where the upload controller checks the access with _get_thread_with_access().

Dominant language
Python
Stars
36
Forks
180
Avg merge
4d 2h
Merged PRs (30d)
14

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from OCA/mail

All issues in OCA/mail

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.