#1955: Use existing user parameter in taggable models instead of passing it

This commit is contained in:
Jyri-Petteri Paloposki 2019-06-26 00:19:32 +03:00
parent 5394973346
commit f6d1f243c5
5 changed files with 12 additions and 12 deletions

View file

@ -106,7 +106,7 @@ class TodosController < ApplicationController
if @todo.errors.empty?
@todo.add_predecessor_list(p.predecessor_list)
@saved = @todo.save
@todo.tag_with(tag_list, current_user) if @saved && tag_list.present?
@todo.tag_with(tag_list) if @saved && tag_list.present?
@todo.block! if @todo.uncompleted_predecessors?
else
@saved = false
@ -194,7 +194,7 @@ class TodosController < ApplicationController
todo.block!
end
todo.tag_with(tag_list, current_user) if @saved && tag_list.present?
todo.tag_with(tag_list) if @saved && tag_list.present?
@todos << todo
@not_done_todos << todo if p.new_context_created || p.new_project_created
@ -1218,7 +1218,7 @@ end
def update_tags
if params[:tag_list]
@todo.tag_with(params[:tag_list], current_user)
@todo.tag_with(params[:tag_list])
@todo.tags.reload #force a reload for proper rendering
end
end

View file

@ -129,7 +129,7 @@ module RecurringTodos
end
def save_tags
@recurring_todo.tag_with(@filterred_attributes[:tag_list], @user) if @filterred_attributes[:tag_list].present?
@recurring_todo.tag_with(@filterred_attributes[:tag_list]) if @filterred_attributes[:tag_list].present?
@recurring_todo.reload
end

View file

@ -349,7 +349,7 @@ class Todo < ApplicationRecord
def add_tags=(params)
unless params[:tag].nil?
tag_list = params[:tag].inject([]) { |list, value| list << value[:name] }
tag_with tag_list.join(", "), user
tag_with tag_list.join(", ")
end
end

View file

@ -50,7 +50,7 @@ class TodoFromRichMessage
todo.project_id = project_id unless project_id.nil?
todo.show_from = show_from if show_from.is_a? Time
todo.due = due if due.is_a? Time
todo.tag_with tags, @user unless tags.nil? || tags.empty?
todo.tag_with tags unless tags.nil? || tags.empty?
todo.starred = star
todo
end