Przeglądaj źródła

show diff when a thread description is updated

Damien ACCORSI 10 lat temu
rodzic
commit
c34140aa82

+ 20 - 14
tracim/tracim/lib/notifications.py Wyświetl plik

@@ -282,7 +282,7 @@ class EmailNotifier(object):
282 282
 
283 283
         action = content.get_last_action().id
284 284
         if ActionDescription.COMMENT == action:
285
-            content_intro = _('<span id="content-intro-username">{}</span> added a comment:'.format(actor.display_name))
285
+            content_intro = _('<span id="content-intro-username">{}</span> added a comment:').format(actor.display_name)
286 286
             content_text = content.description
287 287
             call_to_action_text = _('Answer')
288 288
 
@@ -332,6 +332,13 @@ class EmailNotifier(object):
332 332
 
333 333
             elif ContentType.Thread == content.type:
334 334
                 content_intro = _('<span id="content-intro-username">{}</span> updated the thread description.').format(actor.display_name)
335
+                previous_revision = content.get_previous_revision()
336
+                title_diff = ''
337
+                if previous_revision.label != content.label:
338
+                    title_diff = htmldiff(previous_revision.label, content.label)
339
+                content_text = _('<p id="content-body-intro">Here is an overview of the changes:</p>')+ \
340
+                    title_diff + \
341
+                    htmldiff(previous_revision.description, content.description)
335 342
 
336 343
             # elif ContentType.Thread == content.type:
337 344
             #     content_intro = _('<span id="content-intro-username">{}</span> updated this page.').format(actor.display_name)
@@ -359,18 +366,17 @@ class EmailNotifier(object):
359 366
             )
360 367
             raise ValueError('Unexpected empty notification')
361 368
 
362
-        # Thread - create
363
-        # logger.debug(self, 'This is a NOT comment <--------------------- {}'.format(content.type))
364
-        body_content = template.render(base_url=self._global_config.WEBSITE_BASE_URL,
365
-                               _=_,
366
-                               h=helpers,
367
-                               user_display_name=role.user.display_name,
368
-                               user_role_label=role.role_as_label(),
369
-                               workspace_label=role.workspace.label,
370
-                               content_intro=content_intro,
371
-                               content_text=content_text,
372
-                               main_title=main_title,
373
-                               call_to_action_text=call_to_action_text,
374
-                               result = DictLikeClass(item=dictified_item, actor=dictified_actor))
369
+        body_content = template.render(
370
+            base_url=self._global_config.WEBSITE_BASE_URL,
371
+            _=_,
372
+            h=helpers,
373
+            user_display_name=role.user.display_name,
374
+            user_role_label=role.role_as_label(),
375
+            workspace_label=role.workspace.label,
376
+            content_intro=content_intro,
377
+            content_text=content_text,
378
+            main_title=main_title,
379
+            call_to_action_text=call_to_action_text,
380
+            result = DictLikeClass(item=dictified_item, actor=dictified_actor))
375 381
 
376 382
         return body_content

+ 2 - 2
tracim/tracim/templates/mail/content_update_body_html.mak Wyświetl plik

@@ -25,7 +25,7 @@
25 25
       #content-body del { background-color: #FAA; }
26 26
 
27 27
 
28
-      #call-to-action-button { background-color: #5CB85C; border: 1px solid #4CAE4C; color: #FFF; text-decoration: none; font-weight: bold; padding: 4px; border-radius: 3px; font-size: 2em; padding-right: 0.5em;}
28
+      #call-to-action-button { background-color: #5CB85C; border: 1px solid #4CAE4C; color: #FFF; text-decoration: none; font-weight: bold; border-radius: 3px; font-size: 2em; padding: 4px 0.3em;}
29 29
       #call-to-action-container { text-align: right; margin-top: 2em; }
30 30
 
31 31
       #footer hr { border: 0px solid #CCC; border-top-width: 1px; width: 8em; max-width:25%; margin-left: 0;}
@@ -38,7 +38,7 @@
38 38
     <table style="width: 100%; cell-padding: 0; border-collapse: collapse; margin: 0">
39 39
       <tr style="background-color: F5F5F5; border-bottom: 1px solid #CCC;" >
40 40
         <td style="background-color: #666;">
41
-          <img src="http://team.trac.im/assets/img/logo.png" style="vertical-align: middle;"/>
41
+          <img src="${base_url+'/assets/img/logo.png'}" style="vertical-align: middle;" alt=""/>
42 42
         </td>
43 43
         <td style="padding: 0.5em; background-color: #666; text-align: left;">
44 44
           <span style="font-size: 1.3em; color: #FFF; font-weight: bold;">