Project

General

Profile

Actions

Patch #38284

open

New settings for mail_handler

Added by Mayama Takeshi almost 2 years ago. Updated almost 2 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
Email receiving
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:

Description

Hi,
aside from dev work my company uses redmine to track internal issues from other teams.
However, too frequently, people start discussing things via email and don't edit quoted messages.
This ends up causing duplication of attachments several times.

So I have implemented new setting mail_handler_avoid_attachment_duplication
to avoid creating new Attachment records for an item that already exists (I know redmine already avoids duplication of the same item in the filesystem).

Also, people want emails with images to retain text/image layout and not just have images attached.
So I have also implemented new setting mail_handler_keep_layout that will replace image references in description/notes by markup language set in settings.text_formmating (currently: markdown/textile/common_mark)

Currently they are settable in config/settings.yml only but if this patch is approved I will add them to the "Incoming emails" setting panel.

Obs: I wrote this patch mostly to learn more about RoR development.
It was worthy even if this patch ends up not being accepted.

The only tests that failed were the ones related to revision control, filesystem and LDAP:

$ rake test
Bazaar test repository NOT FOUND. Skipping functional tests !!!
CVS test repository NOT FOUND. Skipping functional tests !!!
Filesystem test repository NOT FOUND. Skipping functional tests !!!
Git test repository NOT FOUND. Skipping functional tests !!!
Mercurial test repository NOT FOUND. Skipping functional tests !!!
Subversion test repository NOT FOUND. Skipping functional tests !!!
Git test repository NOT FOUND. Skipping integration tests !!!
(Test LDAP server not configured)
Bazaar test repository NOT FOUND. Skipping unit tests !!!
Cvs test repository NOT FOUND. Skipping unit tests !!!
Filesystem test repository NOT FOUND. Skipping unit tests !!! See doc/RUNNING_TESTS.
Git test repository NOT FOUND. Skipping unit tests !!!
Mercurial test repository NOT FOUND. Skipping unit tests !!!
Subversion test repository NOT FOUND. Skipping unit tests !!!
Bazaar test repository NOT FOUND. Skipping unit tests !!!
CVS test repository NOT FOUND. Skipping unit tests !!!
Filesystem test repository NOT FOUND. Skipping unit tests !!! See doc/RUNNING_TESTS.
Git test repository NOT FOUND. Skipping unit tests !!!
Git UTF-8 test repository NOT FOUND. Skipping unit tests !!!
Mercurial test repository NOT FOUND. Skipping unit tests !!!
Subversion test repository NOT FOUND. Skipping unit tests !!!
Skipping LDAP tests.
Run options: --seed 32481

# Running:
...ABRIDGED...

Finished in 505.205749s, 10.2335 runs/s, 43.5743 assertions/s.
5170 runs, 22014 assertions, 0 failures, 0 errors, 7 skips

You have skipped tests. Run with --verbose for details.

So I think it is OK as my changes would not affect those.

But I can try to adjust to pass such tests if necessary for the patch to be evaluated (the "See doc/RUNNING_TESTS." actually is incomplete and doesn't mention filesystem at all)

I'm attaching browser screenshots showing redmine running with the new settings on and off for comparison.


Files

new_settings_off.png (408 KB) new_settings_off.png Mayama Takeshi, 2023-02-20 10:17
new_settings_on.png (545 KB) new_settings_on.png Mayama Takeshi, 2023-02-20 10:17
new_mail_handler_settings.diff (55.8 KB) new_mail_handler_settings.diff Mayama Takeshi, 2023-02-20 10:28
Actions #2

Updated by Mayama Takeshi almost 2 years ago

Forgot to mention:
work was done against svn revision 22112.

And now I realize it is filesystem-based revision control. I will prepare one of them and the LDAP database to run the tests.

Actions #3

Updated by Mayama Takeshi almost 2 years ago

Some of the revision control tests failed.
Then I prepared openldap to run the LDAP tests this way (for future reference):

# set domain name as redmine tests will connect to it based on ldap.example.com
echo MACHINE_IP_ADDRESS ldap.example.com >> /etc/hosts

# install openldap
apt install slapd ldap-utils

# set remdine.org and admin password
dpkg-reconfigure slapd 

# configure domain redmine.org using test file
ldapadd -x -D cn=admin,dc=redmine,dc=org -W -f test/fixtures/ldap/test-ldap.ldif 

# confirm configuration worked
ldapsearch -x -D cn=admin,dc=redmine,dc=org -W -b dc=redmine,dc=org

But LDAP tests failed.
But checking the build tests (ex: https://www.redmine.org/builds/logs/build_trunk_mysql_ruby-3.1_2156.html), the LDAP tests are disabled.

Actions

Also available in: Atom PDF