summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouwe Maan <douwe@selenight.nl>2016-02-20 12:01:50 -0800
committerDouwe Maan <douwe@selenight.nl>2016-02-20 12:01:55 -0800
commit42cbcb23478f7b07c0c49e0020a8d3c834322e87 (patch)
tree58abbccf9dc9d40c147658ea293c6f3aed4a82e7
parentd53ae7f14d7c24ee590ba57632d267ec01706aa4 (diff)
downloadgitlab-ce-42cbcb23478f7b07c0c49e0020a8d3c834322e87.tar.gz
"X assigned you Y" instead of "X assigned Y"
-rw-r--r--app/helpers/todos_helper.rb7
-rw-r--r--app/models/todo.rb11
-rw-r--r--app/views/dashboard/todos/_todo.html.haml2
3 files changed, 8 insertions, 12 deletions
diff --git a/app/helpers/todos_helper.rb b/app/helpers/todos_helper.rb
index 9bcfbd2da35..4b745a5b969 100644
--- a/app/helpers/todos_helper.rb
+++ b/app/helpers/todos_helper.rb
@@ -7,6 +7,13 @@ module TodosHelper
current_user.todos.done.count
end
+ def todo_action_name(todo)
+ case todo.action
+ when Todo::ASSIGNED then 'assigned you'
+ when Todo::MENTIONED then 'mentioned you on'
+ end
+ end
+
def todo_target_link(todo)
target = todo.target_type.titleize.downcase
link_to "#{target} #{todo.target.to_reference}", todo_target_path(todo)
diff --git a/app/models/todo.rb b/app/models/todo.rb
index 7a9b0212f9f..34d71c1b0d3 100644
--- a/app/models/todo.rb
+++ b/app/models/todo.rb
@@ -43,13 +43,6 @@ class Todo < ActiveRecord::Base
state :done
end
- def action_name
- case action
- when ASSIGNED then 'assigned'
- when MENTIONED then 'mentioned you on'
- end
- end
-
def body
if note.present?
note.note
@@ -57,8 +50,4 @@ class Todo < ActiveRecord::Base
target.title
end
end
-
- def target_iid
- target.respond_to?(:iid) ? target.iid : target_id
- end
end
diff --git a/app/views/dashboard/todos/_todo.html.haml b/app/views/dashboard/todos/_todo.html.haml
index 773a9f6f4b5..6975f6ed0db 100644
--- a/app/views/dashboard/todos/_todo.html.haml
+++ b/app/views/dashboard/todos/_todo.html.haml
@@ -6,7 +6,7 @@
%span.author_name
= link_to_author todo
%span.todo_label
- = todo.action_name
+ = todo_action_name(todo)
= todo_target_link(todo)
&middot; #{time_ago_with_tooltip(todo.created_at)}