]> source.dussan.org Git - redmine.git/commitdiff
Reverted r19669 and r19670 (#32774).
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Sun, 5 Apr 2020 17:29:53 +0000 (17:29 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Sun, 5 Apr 2020 17:29:53 +0000 (17:29 +0000)
git-svn-id: http://svn.redmine.org/redmine/trunk@19675 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/controllers/timelog_controller.rb
test/integration/api_test/time_entries_test.rb

index 6379c4511819904fa1e497f399a1cd59b1ba70b4..d304fe3b207c4eb03d5f71abd84f6f477b3955cb 100644 (file)
@@ -279,9 +279,8 @@ class TimelogController < ApplicationController
   end
 
   def find_optional_issue
-    if params[:issue_id].present? || params[:time_entry].present? && params[:time_entry][:issue_id].present?
-      issue_id = params[:issue_id] ||  params[:time_entry][:issue_id]
-      @issue = Issue.find(issue_id)
+    if params[:issue_id].present?
+      @issue = Issue.find(params[:issue_id])
       @project = @issue.project
       authorize
     else
@@ -289,14 +288,6 @@ class TimelogController < ApplicationController
     end
   end
 
-  def find_optional_project
-    if params[:project_id].present? || params[:time_entry].present? && params[:time_entry][:project_id].present?
-      project_id = params[:project_id] || params[:time_entry][:project_id]
-      find_project(project_id)
-    end
-    authorize_global
-  end
-
   # Returns the TimeEntry scope for index and report actions
   def time_entry_scope(options={})
     @query.results_scope(options)
index dbdf15d8941f7938651c7726f6186979e0929c16..33aa88aa14a7dceafa6df4b057ab950e2c0e162c 100644 (file)
@@ -144,44 +144,6 @@ class Redmine::ApiTest::TimeEntriesTest < Redmine::ApiTest::Base
     assert_select 'errors error', :text => "Hours cannot be blank"
   end
 
-  test "POST /time_entries.xml with :project_id for other user" do
-    Role.find_by_name('Manager').add_permission! :log_time_for_other_users
-
-    assert_difference 'TimeEntry.count' do
-      post(
-        '/time_entries.xml',
-        :params =>
-          {:time_entry =>
-            {:project_id => '1', :spent_on => '2010-12-02', :user_id => '3',
-             :hours => '3.5', :activity_id => '11'}},
-        :headers => credentials('jsmith'))
-      assert_response :created
-    end
-
-    entry = TimeEntry.order('id DESC').first
-    assert_equal 3, entry.user_id
-    assert_equal 2, entry.author_id
-  end
-
-  test "POST /time_entries.xml with :issue_id for other user" do
-    Role.find_by_name('Manager').add_permission! :log_time_for_other_users
-
-    assert_difference 'TimeEntry.count' do
-      post(
-        '/time_entries.xml',
-        :params =>
-          {:time_entry =>
-            {:issue_id => '1', :spent_on => '2010-12-02', :user_id => '3',
-             :hours => '3.5', :activity_id => '11'}},
-        :headers => credentials('jsmith'))
-      assert_response :created
-    end
-
-    entry = TimeEntry.order('id DESC').first
-    assert_equal 3, entry.user_id
-    assert_equal 2, entry.author_id
-  end
-
   test "PUT /time_entries/:id.xml with valid parameters should update time entry" do
     assert_no_difference 'TimeEntry.count' do
       put(