Render user display names in trophy messages

Review Request #1251 — Created May 31, 2018 and submitted

guest1387
Review Board
guest1387
Trophy message rendering has been reworked. Instead of a method that
every `TrophyType` subclass must implement, instead they must only add a
format string attribute. By default, the recipient's name is the only
provided parameter, but `TrophyType.format_display_text` can be
overridden to add extra context. All builtin trophies have been updated
to use this new behaviour.

Testing Done:
Ran unit tests.

Reviewed at https://reviews.reviewboard.org/r/9932/
When it fails it is consider done!
Description From Last Updated

It needs more cow bell!

guest1387guest1387

It needs MORE COW BELL!

guest1387guest1387

Needs more cow bell!

guest3913guest3913

cool

guest3913guest3913

def get_display_text(self, trophy): return 'A trophy for you.!'

guest1387guest1387

Nice!

guest1387guest1387

Cool!

guest1387guest1387

Cool

guest1387guest1387

Can this be written more beutiful!!

guest1387guest1387
guest1387
guest1387
guest1387
guest1387
guest1387
guest1387
  1. 
      
  2. hashsh

  3. 
      
guest1387
  1. 
      
  2. reviewboard/accounts/tests.py (Diff revision 1)
     
     
     
     
     
     
     
     
     
     
     
     

    Greatest code ever!

  3. reviewboard/accounts/tests.py (Diff revision 1)
     
     

    def get_display_text(self, trophy):
    return 'A trophy for you.!'

  4. reviewboard/accounts/trophies.py (Diff revision 1)
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
  5. 
      
guest1387
  1. 
      
  2. reviewboard/accounts/trophies.py (Diff revision 1)
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
  3. reviewboard/accounts/trophies.py (Diff revision 1)
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     

    Can this be written more beutiful!!

  4. 
      
guest1387
  1. COOL

  2. reviewboard/accounts/trophies.py (Diff revision 1)
     
     
  3. NOO!

guest1387
Review request changed

Status: Closed (submitted)

guest3913
  1. 
      
  2. reviewboard/accounts/tests.py (Diff revision 1)
     
     
     
     
     

    Needs more cow bell!

  3. reviewboard/accounts/tests.py (Diff revision 1)
     
     
     
     
     
  4. 
      
guest3913
  1. Ship It!

  2. 
      
guest3913
  1. It fails so it is done!

  2. 
      
guest9248
  1. Ship It!
  2. 
      
Loading...