Edgewall Software

Ticket #3919 (new defect)

Opened 2 years ago

Last modified 3 months ago

Notifications use field name instead of label for custom fields

Reported by: jflorian@… Owned by: eblot
Priority: normal Milestone: 0.12
Component: notification Version: 0.9.3
Severity: minor Keywords: custom fields i18n labels
Cc: trac.dev@…, hju@…

Description

While it is very nice to have the custom fields appear in the notification mail, it would be better if they used the label given to them instead.

Often the field name is an abbreviation that can be quite confusing for most of our users whereas the labels would be something they'd recognize immediately.

Attachments

Change History

Changed 2 years ago by jflorian@…

  • version changed from 0.10 to 0.9.3

Sorry, forgot to set the version to what we're actually using.

Changed 2 years ago by trac_dev at mail.ru

  • cc trac.dev@… added

add to cc

Changed 22 months ago by cboos

  • keywords custom fields added
  • owner changed from jonas to eblot
  • component changed from ticket system to notification
  • severity changed from normal to minor
  • milestone set to 0.12

Changed 11 months ago by osimons

  • keywords i18n labels added

It is exactly as we do it on the regular fields also for web ui, so either we need to change the current practice for all fields, or else this won't make sense.

However, with current i18n effort underway, I suppose this is also related to that as it for many will make the default labels and fieldnames very different. Currently all labels and field names are the same (except capitalization) - that won't be the case later.

Changed 11 months ago by cboos

... not to mention the fact that currently it's the same mail sent to everyone, and that with i18n we probably need to partition the recipient list according to their language and send as many differently translated mails as needed.

Changed 11 months ago by cboos

#6854 was closed as duplicate

Changed 6 months ago by cboos

  • milestone changed from 0.13 to 0.12

Changed 3 months ago by hju@…

  • cc hju@… added

while localization is an very interesting feature, I'm much more interested on the basic defect Notifications use field name instead of label for custom fields at the moment. It's exactly what I was looking for at the moment.

Changed 3 months ago by hju@…

Taking a brief look in the code, I implemented a little patch to change to label instead of names for all fields in notification.

Its not the overall solution, just a "hard change" to label.

The patch concerns notification.py:

  • trac/ticket/notification.py

     
    156          for f in [f['name'] for f in fields if f['type'] != 'textarea']: 
    157              if not tkt.values.has_key(f): 
     156         for f in [f for f in fields if f['type'] != 'textarea']: 
     157             if not tkt.values.has_key(f['name']): 
    158158                 continue 
    159              fval = tkt[f] 
     159             fval = tkt[f['name']] 
    160160             if fval.find('\n') != -1: 
    161161                 continue 
    162162             idx = 2 * (i % 2) 
    163              if len(f) > width[idx]: 
    164                  width[idx] = len(f) 
     163             if len(f['label']) > width[idx]: 
     164                 width[idx] = len(f['label']) 
    165165             if len(fval) > width[idx + 1]: 
    166166                 width[idx + 1] = len(fval) 
    167167             i += 1 
     
    175176         for f in [f for f in fields if f['name'] != 'description']: 
    176177             fname = f['name'] 
     178             flabel = f['label'] 
     179             if not flabel: 
     180                 flabel = fname 
    177181             if not tkt.values.has_key(fname): 
    178182                 continue 
    179183             fval = tkt[fname] 
    180184             if f['type'] == 'textarea' or '\n' in unicode(fval): 
    181                  big.append((fname.capitalize(), CRLF.join(fval.splitlines()))) 
     185                 big.append((flabel.capitalize(), CRLF.join(fval.splitlines()))) 
    182186             else: 
    183                  txt += format[i % 2] % (fname.capitalize(), fval) 
     187                 txt += format[i % 2] % (flabel.capitalize(), fval) 
    184188                 i += 1 

The patch ist not overall tested, but implemented in our environment (0.11) an running properly (till now).

Add/Change #3919 (Notifications use field name instead of label for custom fields)

Author



Change Properties
<Author field>
Action
as new
as The resolution will be set. Next status will be 'closed'
to The owner will change from eblot. Next status will be 'new'
The owner will change from eblot to anonymous. Next status will be 'assigned'
 
Note: See TracTickets for help on using tickets.