Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FEATURE: Allow manual assignment of related post to badge
PERF: clean up performance of user badges admin when large number of badges exist
- Loading branch information
1 parent
ff84275
commit fe578f9
Showing
9 changed files
with
146 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1440,3 +1440,9 @@ tr.not-activated { | |
.preview { | ||
margin-top: 5px; | ||
} | ||
|
||
table#user-badges { | ||
.reason { | ||
max-width: 200px; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
class DetailedUserBadgeSerializer < BasicUserBadgeSerializer | ||
has_one :granted_by | ||
|
||
attributes :post_number, :topic_id, :topic_title | ||
|
||
def include_post_number? | ||
object.post | ||
end | ||
|
||
alias :include_topic_id? :include_post_number? | ||
alias :include_topic_title? :include_post_number? | ||
|
||
|
||
def post_number | ||
object.post.post_number if object.post | ||
end | ||
|
||
def topic_id | ||
object.post.topic_id if object.post | ||
end | ||
|
||
def topic_title | ||
object.post.topic.title if object.post && object.post.topic | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This could be
const
too - it only protects against reassignment, it doesn't freeze objects from mutating themselves.