Edgewall Software

Ticket #2259: trac_ticket_r2659.3.patch

File trac_ticket_r2659.3.patch, 2.6 KB (added by trac@…, 3 years ago)

full functionality requested. adds remark on timeline

  • trac/attachment.py

     
    2626from trac.core import * 
    2727from trac.env import IEnvironmentSetupParticipant 
    2828from trac.mimeview import * 
     29from trac.Notify import TicketNotifyEmail 
     30from trac.ticket import Ticket 
    2931from trac.web import IRequestHandler 
    3032from trac.web.chrome import add_link, add_stylesheet, INavigationContributor 
    3133from trac.wiki import IWikiSyntaxProvider 
     
    332334                pass # don't worry if there's nothing to replace 
    333335            attachment.filename = None 
    334336        attachment.insert(filename, upload.file, size) 
     337        if attachment.parent_type == 'ticket': 
     338            tn = TicketNotifyEmail(self.env) 
     339            # before we can do this, we have to get the ticket 
     340            # that the attachment will modify 
     341            ticket = Ticket(self.env, tkt_id=attachment.parent_id) 
     342            tn.notify(ticket, newticket=False, modtime=attachment.time) 
     343             
    335344 
    336345        # Redirect the user to the newly created attachment 
    337346        req.redirect(attachment.href()) 
  • trac/ticket/web_ui.py

     
    293293            cursor = db.cursor() 
    294294 
    295295            cursor.execute("SELECT t.id,tc.time,tc.author,t.type,t.summary, " 
    296                            "       tc.field,tc.oldvalue,tc.newvalue " 
     296                           "    tc.field,tc.oldvalue,tc.newvalue " 
    297297                           "  FROM ticket_change tc " 
    298298                           "    INNER JOIN ticket t ON t.id = tc.ticket " 
    299                            "      AND tc.time>=%s AND tc.time<=%s " 
     299                           "      AND tc.time >= %s AND tc.time <= %s " 
     300                           "UNION " 
     301                           "SELECT t.id,att.time,att.author,t.type,t.summary, " 
     302                           "    'attachment', null, att.filename " 
     303                           "  FROM attachment att " 
     304                           "    INNER JOIN ticket t ON t.id = att.id " 
     305                           "      AND att.time >= %s AND att.time <= %s " 
    300306                           "ORDER BY tc.time" 
    301                            % (start, stop)) 
     307                           % (start, stop, start, stop)) 
    302308            previous_update = None 
    303309            for id,t,author,type,summary,field,oldvalue,newvalue in cursor: 
    304310                if not previous_update or (id,t,author) != previous_update[:3]: