GitLab wurde aktualisiert. Dank regelmäßiger Updates bleibt das THM GitLab sicher und Sie profitieren von den neuesten Funktionen. Vielen Dank für Ihre Geduld.

Commit 3d52e139 authored by Douglas Barbosa Alexandre's avatar Douglas Barbosa Alexandre
Browse files

Rename Tasks to Todos

parent 408e010d
...@@ -75,7 +75,7 @@ v 8.5.0 (unreleased) ...@@ -75,7 +75,7 @@ v 8.5.0 (unreleased)
- Emoji comment on diffs are not award emoji - Emoji comment on diffs are not award emoji
- Add label description (Nuttanart Pornprasitsakul) - Add label description (Nuttanart Pornprasitsakul)
- Show label row when filtering issues or merge requests by label (Nuttanart Pornprasitsakul) - Show label row when filtering issues or merge requests by label (Nuttanart Pornprasitsakul)
- Add Task Queue - Add Todos
v 8.4.4 v 8.4.4
- Update omniauth-saml gem to 1.4.2 - Update omniauth-saml gem to 1.4.2
......
/** /**
* Dashboard tasks queue * Dashboard Todos
* *
*/ */
.navbar-nav { .navbar-nav {
li { li {
.badge.tasks-pending-count { .badge.todos-pending-count {
background-color: #7f8fa4; background-color: #7f8fa4;
margin-top: -5px; margin-top: -5px;
} }
} }
} }
.tasks { .todos {
.panel { .panel {
border-top: none; border-top: none;
margin-bottom: 0; margin-bottom: 0;
} }
} }
.task-item { .todo-item {
font-size: $gl-font-size; font-size: $gl-font-size;
padding: $gl-padding-top 0 $gl-padding-top ($gl-avatar-size + $gl-padding-top); padding: $gl-padding-top 0 $gl-padding-top ($gl-avatar-size + $gl-padding-top);
border-bottom: 1px solid $table-border-color; border-bottom: 1px solid $table-border-color;
color: #7f8fa4; color: #7f8fa4;
&.task-inline { &.todo-inline {
.avatar { .avatar {
position: relative; position: relative;
top: -2px; top: -2px;
} }
.task-title { .todo-title {
line-height: 40px; line-height: 40px;
} }
} }
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
margin-left: -($gl-avatar-size + $gl-padding-top); margin-left: -($gl-avatar-size + $gl-padding-top);
} }
.task-title { .todo-title {
@include str-truncated(calc(100% - 174px)); @include str-truncated(calc(100% - 174px));
font-weight: 600; font-weight: 600;
...@@ -53,10 +53,10 @@ ...@@ -53,10 +53,10 @@
} }
} }
.task-body { .todo-body {
margin-right: 174px; margin-right: 174px;
.task-note { .todo-note {
word-wrap: break-word; word-wrap: break-word;
.md { .md {
...@@ -89,7 +89,7 @@ ...@@ -89,7 +89,7 @@
} }
} }
.task-note-icon { .todo-note-icon {
color: #777; color: #777;
float: left; float: left;
font-size: $gl-font-size; font-size: $gl-font-size;
...@@ -102,10 +102,10 @@ ...@@ -102,10 +102,10 @@
} }
@media (max-width: $screen-xs-max) { @media (max-width: $screen-xs-max) {
.task-item { .todo-item {
padding-left: $gl-padding; padding-left: $gl-padding;
.task-title { .todo-title {
white-space: normal; white-space: normal;
overflow: visible; overflow: visible;
max-width: 100%; max-width: 100%;
...@@ -115,7 +115,7 @@ ...@@ -115,7 +115,7 @@
display: none; display: none;
} }
.task-body { .todo-body {
margin: 0; margin: 0;
border-left: 2px solid #DDD; border-left: 2px solid #DDD;
padding-left: 10px; padding-left: 10px;
......
class Dashboard::TasksController < Dashboard::ApplicationController
def index
@tasks = TasksFinder.new(current_user, params).execute
@tasks = @tasks.page(params[:page]).per(PER_PAGE)
end
def destroy
task.done!
respond_to do |format|
format.html { redirect_to dashboard_tasks_path, notice: 'Task was successfully marked as done.' }
format.js { render nothing: true }
end
end
private
def task
@task ||= current_user.tasks.find(params[:id])
end
end
class Dashboard::TodosController < Dashboard::ApplicationController
def index
@todos = TodosFinder.new(current_user, params).execute
@todos = @todos.page(params[:page]).per(PER_PAGE)
end
def destroy
todo.done!
respond_to do |format|
format.html { redirect_to dashboard_todos_path, notice: 'Todo was successfully marked as done.' }
format.js { render nothing: true }
end
end
private
def todo
@todo ||= current_user.todos.find(params[:id])
end
end
...@@ -181,7 +181,7 @@ def merge ...@@ -181,7 +181,7 @@ def merge
return return
end end
TaskService.new.merge_merge_request(merge_request, current_user) TodoService.new.merge_merge_request(merge_request, current_user)
@merge_request.update(merge_error: nil) @merge_request.update(merge_error: nil)
......
# TasksFinder # TodosFinder
# #
# Used to filter Tasks by set of params # Used to filter Todos by set of params
# #
# Arguments: # Arguments:
# current_user - which user use # current_user - which user use
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
# type: 'Issue' or 'MergeRequest' # type: 'Issue' or 'MergeRequest'
# #
class TasksFinder class TodosFinder
NONE = '0' NONE = '0'
attr_accessor :current_user, :params attr_accessor :current_user, :params
...@@ -23,7 +23,7 @@ def initialize(current_user, params) ...@@ -23,7 +23,7 @@ def initialize(current_user, params)
end end
def execute def execute
items = current_user.tasks items = current_user.todos
items = by_action_id(items) items = by_action_id(items)
items = by_author(items) items = by_author(items)
items = by_project(items) items = by_project(items)
...@@ -36,7 +36,7 @@ def execute ...@@ -36,7 +36,7 @@ def execute
private private
def action_id? def action_id?
action_id.present? && [Task::ASSIGNED, Task::MENTIONED].include?(action_id.to_i) action_id.present? && [Todo::ASSIGNED, Todo::MENTIONED].include?(action_id.to_i)
end end
def action_id def action_id
......
module TasksHelper module TodosHelper
def link_to_author(task) def todos_pending_count
author = task.author current_user.todos.pending.count
if author
link_to author.name, user_path(author.username)
else
task.author_name
end
end
def tasks_pending_count
current_user.tasks.pending.count
end end
def tasks_done_count def todos_done_count
current_user.tasks.done.count current_user.todos.done.count
end end
def task_action_name(task) def todo_action_name(todo)
target = task.target_type.titleize.downcase target = todo.target_type.titleize.downcase
[task.action_name, target].join(" ") [todo.action_name, target].join(" ")
end end
def task_target_link_html(task) def todo_target_link_html(todo)
link_to "##{task.target_iid}", task_target_path(task) link_to "##{todo.target_iid}", todo_target_path(todo)
end end
def task_target_path(task) def todo_target_path(todo)
anchor = dom_id(task.note) if task.note.present? anchor = dom_id(todo.note) if todo.note.present?
polymorphic_path([task.project.namespace.becomes(Namespace), polymorphic_path([todo.project.namespace.becomes(Namespace),
task.project, task.target], anchor: anchor) todo.project, todo.target], anchor: anchor)
end end
def task_actions_options def todo_actions_options
actions = [ actions = [
OpenStruct.new(id: '', title: 'Any Action'), OpenStruct.new(id: '', title: 'Any Action'),
OpenStruct.new(id: Task::ASSIGNED, title: 'Assigned'), OpenStruct.new(id: Todo::ASSIGNED, title: 'Assigned'),
OpenStruct.new(id: Task::MENTIONED, title: 'Mentioned') OpenStruct.new(id: Todo::MENTIONED, title: 'Mentioned')
] ]
options_from_collection_for_select(actions, 'id', 'title', params[:action_id]) options_from_collection_for_select(actions, 'id', 'title', params[:action_id])
end end
def task_projects_options def todo_projects_options
projects = current_user.authorized_projects.sorted_by_activity.non_archived projects = current_user.authorized_projects.sorted_by_activity.non_archived
projects = projects.includes(:namespace) projects = projects.includes(:namespace)
...@@ -57,7 +47,7 @@ def task_projects_options ...@@ -57,7 +47,7 @@ def task_projects_options
options_from_collection_for_select(projects, 'id', 'title', params[:project_id]) options_from_collection_for_select(projects, 'id', 'title', params[:project_id])
end end
def task_types_options def todo_types_options
types = [ types = [
OpenStruct.new(title: 'Any Type', name: ''), OpenStruct.new(title: 'Any Type', name: ''),
OpenStruct.new(title: 'Issue', name: 'Issue'), OpenStruct.new(title: 'Issue', name: 'Issue'),
......
...@@ -37,7 +37,7 @@ class Note < ActiveRecord::Base ...@@ -37,7 +37,7 @@ class Note < ActiveRecord::Base
belongs_to :author, class_name: "User" belongs_to :author, class_name: "User"
belongs_to :updated_by, class_name: "User" belongs_to :updated_by, class_name: "User"
has_many :tasks, dependent: :destroy has_many :todos, dependent: :destroy
delegate :name, to: :project, prefix: true delegate :name, to: :project, prefix: true
delegate :name, :email, to: :author, prefix: true delegate :name, :email, to: :author, prefix: true
......
# == Schema Information # == Schema Information
# #
# Table name: tasks # Table name: todos
# #
# id :integer not null, primary key # id :integer not null, primary key
# user_id :integer not null # user_id :integer not null
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
# updated_at :datetime # updated_at :datetime
# #
class Task < ActiveRecord::Base class Todo < ActiveRecord::Base
ASSIGNED = 1 ASSIGNED = 1
MENTIONED = 2 MENTIONED = 2
......
...@@ -140,7 +140,7 @@ class User < ActiveRecord::Base ...@@ -140,7 +140,7 @@ class User < ActiveRecord::Base
has_one :abuse_report, dependent: :destroy has_one :abuse_report, dependent: :destroy
has_many :spam_logs, dependent: :destroy has_many :spam_logs, dependent: :destroy
has_many :builds, dependent: :nullify, class_name: 'Ci::Build' has_many :builds, dependent: :nullify, class_name: 'Ci::Build'
has_many :tasks, dependent: :destroy has_many :todos, dependent: :destroy
# #
# Validations # Validations
......
...@@ -23,8 +23,8 @@ def event_service ...@@ -23,8 +23,8 @@ def event_service
EventCreateService.new EventCreateService.new
end end
def task_service def todo_service
TaskService.new TodoService.new
end end
def log_info(message) def log_info(message)
......
...@@ -3,7 +3,7 @@ class CloseService < Issues::BaseService ...@@ -3,7 +3,7 @@ class CloseService < Issues::BaseService
def execute(issue, commit = nil) def execute(issue, commit = nil)
if project.jira_tracker? && project.jira_service.active if project.jira_tracker? && project.jira_service.active
project.jira_service.execute(commit, issue) project.jira_service.execute(commit, issue)
task_service.close_issue(issue, current_user) todo_service.close_issue(issue, current_user)
return issue return issue
end end
...@@ -11,7 +11,7 @@ def execute(issue, commit = nil) ...@@ -11,7 +11,7 @@ def execute(issue, commit = nil)
event_service.close_issue(issue, current_user) event_service.close_issue(issue, current_user)
create_note(issue, commit) create_note(issue, commit)
notification_service.close_issue(issue, current_user) notification_service.close_issue(issue, current_user)
task_service.close_issue(issue, current_user) todo_service.close_issue(issue, current_user)
execute_hooks(issue, 'close') execute_hooks(issue, 'close')
end end
......
...@@ -9,7 +9,7 @@ def execute ...@@ -9,7 +9,7 @@ def execute
if issue.save if issue.save
issue.update_attributes(label_ids: label_params) issue.update_attributes(label_ids: label_params)
notification_service.new_issue(issue, current_user) notification_service.new_issue(issue, current_user)
task_service.new_issue(issue, current_user) todo_service.new_issue(issue, current_user)
event_service.open_issue(issue, current_user) event_service.open_issue(issue, current_user)
issue.create_cross_references!(current_user) issue.create_cross_references!(current_user)
execute_hooks(issue, 'open') execute_hooks(issue, 'open')
......
...@@ -6,12 +6,12 @@ def execute(issue) ...@@ -6,12 +6,12 @@ def execute(issue)
def handle_changes(issue, options = {}) def handle_changes(issue, options = {})
if has_changes?(issue, options) if has_changes?(issue, options)
task_service.mark_pending_tasks_as_done(issue, current_user) todo_service.mark_pending_todos_as_done(issue, current_user)
end end
if issue.previous_changes.include?('title') || if issue.previous_changes.include?('title') ||
issue.previous_changes.include?('description') issue.previous_changes.include?('description')
task_service.update_issue(issue, current_user) todo_service.update_issue(issue, current_user)
end end
if issue.previous_changes.include?('milestone_id') if issue.previous_changes.include?('milestone_id')
...@@ -21,7 +21,7 @@ def handle_changes(issue, options = {}) ...@@ -21,7 +21,7 @@ def handle_changes(issue, options = {})
if issue.previous_changes.include?('assignee_id') if issue.previous_changes.include?('assignee_id')
create_assignee_note(issue) create_assignee_note(issue)
notification_service.reassigned_issue(issue, current_user) notification_service.reassigned_issue(issue, current_user)
task_service.reassigned_issue(issue, current_user) todo_service.reassigned_issue(issue, current_user)
end end
end end
......
...@@ -9,7 +9,7 @@ def execute(merge_request, commit = nil) ...@@ -9,7 +9,7 @@ def execute(merge_request, commit = nil)
event_service.close_mr(merge_request, current_user) event_service.close_mr(merge_request, current_user)
create_note(merge_request) create_note(merge_request)
notification_service.close_mr(merge_request, current_user) notification_service.close_mr(merge_request, current_user)
task_service.close_merge_request(merge_request, current_user) todo_service.close_merge_request(merge_request, current_user)
execute_hooks(merge_request, 'close') execute_hooks(merge_request, 'close')
end end
......
...@@ -18,7 +18,7 @@ def execute ...@@ -18,7 +18,7 @@ def execute
merge_request.update_attributes(label_ids: label_params) merge_request.update_attributes(label_ids: label_params)
event_service.open_mr(merge_request, current_user) event_service.open_mr(merge_request, current_user)
notification_service.new_merge_request(merge_request, current_user) notification_service.new_merge_request(merge_request, current_user)
task_service.new_merge_request(merge_request, current_user) todo_service.new_merge_request(merge_request, current_user)
merge_request.create_cross_references!(current_user) merge_request.create_cross_references!(current_user)
execute_hooks(merge_request) execute_hooks(merge_request)
end end
......
...@@ -16,12 +16,12 @@ def execute(merge_request) ...@@ -16,12 +16,12 @@ def execute(merge_request)
def handle_changes(merge_request, options = {}) def handle_changes(merge_request, options = {})
if has_changes?(merge_request, options) if has_changes?(merge_request, options)
task_service.mark_pending_tasks_as_done(merge_request, current_user) todo_service.mark_pending_todos_as_done(merge_request, current_user)
end end
if merge_request.previous_changes.include?('title') || if merge_request.previous_changes.include?('title') ||
merge_request.previous_changes.include?('description') merge_request.previous_changes.include?('description')
task_service.update_merge_request(merge_request, current_user) todo_service.update_merge_request(merge_request, current_user)
end end
if merge_request.previous_changes.include?('target_branch') if merge_request.previous_changes.include?('target_branch')
...@@ -37,7 +37,7 @@ def handle_changes(merge_request, options = {}) ...@@ -37,7 +37,7 @@ def handle_changes(merge_request, options = {})
if merge_request.previous_changes.include?('assignee_id') if merge_request.previous_changes.include?('assignee_id')
create_assignee_note(merge_request) create_assignee_note(merge_request)
notification_service.reassigned_merge_request(merge_request, current_user) notification_service.reassigned_merge_request(merge_request, current_user)
task_service.reassigned_merge_request(merge_request, current_user) todo_service.reassigned_merge_request(merge_request, current_user)
end end
if merge_request.previous_changes.include?('target_branch') || if merge_request.previous_changes.include?('target_branch') ||
......
...@@ -8,7 +8,7 @@ def execute ...@@ -8,7 +8,7 @@ def execute
if note.save if note.save
# Finish the harder work in the background # Finish the harder work in the background
NewNoteWorker.perform_in(2.seconds, note.id, params) NewNoteWorker.perform_in(2.seconds, note.id, params)
TaskService.new.new_note(note, current_user) TodoService.new.new_note(note, current_user)
end end
note note
......