View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0011789 | mantisbt | public | 2010-04-12 11:01 | 2016-04-25 03:59 | |
Reporter | obones | Assigned To | |||
Priority | normal | Severity | feature | Reproducibility | always |
Status | new | Resolution | open | ||
Summary | 0011789: Email notification when a file is added | ||||
Description | Hello, Would it be possible to have a notification email sent when a file is added? | ||||
Tags | patch | ||||
Attached Files | mail_when_file_add_del.txt (1,740 bytes)
/* addition to config_inc.php $g_email_file_action = ON; /* Addition to email_api.php /** * Send notices that a user has added a file. * @param int $p_bug_id * @param int $p_user_id * @return null */ function email_file_added( $p_bug_id, $p_user_id,$p_file_name ) { $t_opt = array(); $t_opt[] = bug_format_id( $p_bug_id ); $t_opt[] = user_get_name( $p_user_id ); email_generic( $p_bug_id, 'bugnote', 'email_notification_title_for_action_addfile', $t_opt, array( $p_user_id ) ); } /** * Send notices that a user has added a file. * @param int $p_bug_id * @param int $p_user_id * @return null */ function email_file_deleted( $p_bug_id, $p_user_id,$p_file_name ) { $t_opt = array(); $t_opt[] = bug_format_id( $p_bug_id ); $t_opt[] = user_get_name( $p_user_id ); email_generic( $p_bug_id, 'bugnote', 'email_notification_title_for_action_delfile', $t_opt, array( $p_user_id ) ); } / *Addition to the various strings scripts (or minimum to custom_strings_inc.php) $s_email_notification_title_for_action_addfile = 'Issue %1$s, file added by user %2$s.'; $s_email_notification_title_for_action_delfile = 'Issue %1$s, file deleted by user %2$s.'; /* addition fo file_api.php /** * requires email_api */ require_once( 'email_api.php' ); // now find function file_add // and add as last line before the closing bracket // // send email // if( config_get( 'email_file_action' ) == ON ){ email_file_added( $t_bug_id,$c_user_id ); } // Next find function File_delete // and add at the end, just before : Return true; // // send email // if( config_get( 'email_file_action' ) == ON ){ email_file_deleted( $p_bug_id,auth_get_current_user_id() ); } | ||||
Voting for this, too :-) |
|
so to whom should the message be sent, just to Reporter and Handler? |
|
To whoever is receiving emails for the issue, just like when a note is posted. |
|
Good question. IMHO, "Note added" is a really good choice for this. |
|
Don't know if marking this as duplicate is a good idea. The original ticket seems to be pending because there are two issues reported. The question if editing notes should trigger an email is still open - and probably blocks the progress of the "file added" email. |
|
Here how to do this: /**
/ *Addition to the various strings scripts (or minimum to custom_strings_inc.php) /* addition fo file_api.php
// now find function file_add Now if someone was to copy this into core, clearly sending this email should be configurable. |
|
here is the code to receive conditional emails when adding/deleting files |
|