Render user display names in trophy messages
Review Request #9932 — Created May 11, 2018 and submitted
Trophy message rendering has been reworked. Instead of a method that
everyTrophyType
subclass must implement, instead they must only add a
format string attribute. By default, the recipient's name is the only
provided parameter, butTrophyType.format_display_text
can be
overridden to add extra context. All builtin trophies have been updated
to use this new behaviour.
Ran unit tests.
Description | From | Last Updated |
---|---|---|
I think there was a misunderstanding on what I was saying regarding legacy support. if a trophy only implements get_display_text, … |
chipx86 | |
"favor" |
chipx86 | |
This is currently checking for its own existence. It should be display_format_str. We can also keep all the legacy support … |
chipx86 | |
I think the review request ID should be a standard thing passed. This lets us simplify all subclasses. |
chipx86 | |
F401 'reviewboard.accounts.models.Trophy' imported but unused |
reviewbot | |
Needs to be in alphabetical order. |
chipx86 | |
F401 'reviewboard.accounts.trophies.MilestoneTrophy' imported but unused |
reviewbot | |
F841 local variable 'trophy' is assigned to but never used |
reviewbot | |
E303 too many blank lines (2) |
reviewbot | |
F401 'warnings.catch_warnings' imported but unused |
reviewbot | |
F401 'warnings' imported but unused |
reviewbot | |
F401 'warnings.catch_warnings' imported but unused |
reviewbot |
Description: |
|
---|
-
-
-
reviewboard/accounts/trophies.py (Diff revision 1) This is currently checking for its own existence. It should be
display_format_str
.We can also keep all the legacy support confined here, reducing the work needed in the caller, by doing:
if self.display_format_str is None: warnings.warn(...) return self.get_display_text(trophy)
-
reviewboard/accounts/trophies.py (Diff revision 1) I think the review request ID should be a standard thing passed. This lets us simplify all subclasses.
Change Summary:
Addressed feedback.
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 2 (+57 -34) |
Checks run (2 succeeded)
Change Summary:
Add more tests
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 3 (+165 -34) |
Checks run (1 failed, 1 succeeded)
flake8
-
reviewboard/reviews/tests/test_reviewtags.py (Diff revision 3) F401 'reviewboard.accounts.models.Trophy' imported but unused
Description: |
|
---|
Change Summary:
Remove unused import.
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 4 (+164 -34) |
Checks run (2 succeeded)
Change Summary:
Addressed feedback.
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 5 (+175 -33) |
Checks run (1 failed, 1 succeeded)
flake8
-
reviewboard/accounts/tests.py (Diff revision 5) F401 'reviewboard.accounts.trophies.MilestoneTrophy' imported but unused
-
reviewboard/accounts/tests.py (Diff revision 5) F841 local variable 'trophy' is assigned to but never used
-
Change Summary:
Flake8 fixups
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 6 (+174 -33) |
Checks run (2 succeeded)
Change Summary:
Fix weirdo catch_warnings edge case
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 7 (+163 -33) |
Checks run (1 failed, 1 succeeded)
flake8
-
-
-
reviewboard/reviews/tests/test_reviewtags.py (Diff revision 7) F401 'warnings.catch_warnings' imported but unused
Change Summary:
Flake8 fixups
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 8 (+156 -33) |