Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJack Davison <jack.davison@student.manchester.ac.uk>2016-06-20 02:06:57 +0300
committerJack Davison <jack.davison@student.manchester.ac.uk>2016-08-17 15:33:50 +0300
commitbcdc3694919f6cc9777dd982325469fb87468835 (patch)
tree14d67ec8ed6cd1a0fdb8a4baf8740d97102aca5c /app/helpers/issues_helper.rb
parentd1da2e8180d92e5f4a8b5ebb36b0f4e4d0618bf8 (diff)
Truncated user list in award emoji tooltips
* Only the first 10 names are displayed * Further users are indicated by "and X more." * String "and X more" is appended to the array THEN join is called * An oxford comma seperates the last name from "and X more" * In coffeescript "me" is now always prepended * Tests included
Diffstat (limited to 'app/helpers/issues_helper.rb')
-rw-r--r--app/helpers/issues_helper.rb8
1 files changed, 6 insertions, 2 deletions
diff --git a/app/helpers/issues_helper.rb b/app/helpers/issues_helper.rb
index 2e82b44437b..15f08fd5918 100644
--- a/app/helpers/issues_helper.rb
+++ b/app/helpers/issues_helper.rb
@@ -114,9 +114,13 @@ module IssuesHelper
end
def award_user_list(awards, current_user)
- awards.map do |award|
+ names = awards.first(10).map do |award|
award.user == current_user ? 'me' : award.user.name
- end.join(', ')
+ end
+
+ names << "and #{awards.size - names.size} more." if awards.size > names.size
+
+ names.join(', ')
end
def award_active_class(awards, current_user)