View Issue Details

IDProjectCategoryView StatusLast Update
0011789mantisbtemailpublic2016-04-25 03:59
Reporterobones Assigned To 
PrioritynormalSeverityfeatureReproducibilityalways
Status newResolutionopen 
Summary0011789: Email notification when a file is added
Description

Hello,

Would it be possible to have a notification email sent when a file is added?
This is especially handy when the user uploading the file does not add a note to indicated it added said file.

Tagspatch

Relationships

related to 0003380 acknowledged E-mail notification on editing bugnotes and adding files 
related to 0011790 confirmed Event notification when a file is added 

Activities

M.C.S.

M.C.S.

2010-11-22 03:54

reporter   ~0027443

Voting for this, too :-)

cas

cas

2010-11-22 06:04

reporter   ~0027446

so to whom should the message be sent, just to Reporter and Handler?

obones

obones

2010-11-22 07:34

reporter   ~0027447

To whoever is receiving emails for the issue, just like when a note is posted.

M.C.S.

M.C.S.

2010-11-22 12:11

reporter   ~0027453

Good question. IMHO, "Note added" is a really good choice for this.

M.C.S.

M.C.S.

2010-11-23 12:34

reporter   ~0027460

Last edited: 2010-11-23 12:34

View 2 revisions

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.

cas

cas

2010-11-24 06:38

reporter   ~0027468

Here how to do this:
/* 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 ) {
    log_event( LOG_EMAIL, sprintf( 'Issue #%d , file added by user @U%d', $p_bug_id, $p_user_id ) );

    $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 ) );
    }

/ *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.';

/* 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
email_file_added( $p_bug_id,$c_user_id );

Now if someone was to copy this into core, clearly sending this email should be configurable.

cas

cas

2010-11-24 07:58

reporter   ~0027472

here is the code to receive conditional emails when adding/deleting files

cas

cas

2010-11-24 08:15

reporter  

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() ); 
	}
mail_when_file_add_del.txt (1,740 bytes)   

Issue History

Date Modified Username Field Change
2010-04-12 11:01 obones New Issue
2010-11-22 03:54 M.C.S. Note Added: 0027443
2010-11-22 06:04 cas Note Added: 0027446
2010-11-22 07:34 obones Note Added: 0027447
2010-11-22 12:11 M.C.S. Note Added: 0027453
2010-11-22 14:51 atrol Relationship added duplicate of 0003380
2010-11-22 14:51 atrol Status new => resolved
2010-11-22 14:51 atrol Resolution open => duplicate
2010-11-22 14:51 atrol Assigned To => atrol
2010-11-23 12:34 M.C.S. Note Added: 0027460
2010-11-23 12:34 M.C.S. Note Edited: 0027460 View Revisions
2010-11-23 14:17 atrol Relationship deleted 0003380
2010-11-23 14:18 atrol Relationship added related to 0003380
2010-11-23 14:18 atrol Assigned To atrol =>
2010-11-23 14:18 atrol Status resolved => new
2010-11-23 14:19 atrol Resolution duplicate => open
2010-11-24 06:38 cas Note Added: 0027468
2010-11-24 07:57 cas File Added: mail_when_file_added.txt
2010-11-24 07:58 cas Note Added: 0027472
2010-11-24 08:15 cas File Added: mail_when_file_add_del.txt
2010-11-24 09:17 atrol File Deleted: mail_when_file_added.txt
2013-04-24 07:15 rombert Relationship added has duplicate 0011790
2013-04-24 07:45 atrol Relationship deleted has duplicate 0011790
2013-04-24 07:46 atrol Relationship added related to 0011790
2014-01-31 16:53 atrol Tag Attached: patch