Fixed #149
This commit is contained in:
parent
87d622468f
commit
536a1f907b
@ -21,12 +21,7 @@ class BatchUpload extends Rails\ActiveRecord\Base
|
|||||||
|
|
||||||
# Ugly: set the current user ID to the one set in the batch, so history entries
|
# Ugly: set the current user ID to the one set in the batch, so history entries
|
||||||
# will be created as that user.
|
# will be created as that user.
|
||||||
// $old_thread_user = Thread::current["danbooru-user"];
|
User::set_current_user(User::find($this->user_id));
|
||||||
// $old_thread_user_id = Thread::current["danbooru-user_id"];
|
|
||||||
// $old_ip_addr = Thread::current["danbooru-ip_addr"];
|
|
||||||
// Thread::current["danbooru-user"] = User::find_by_id(self.user_id)
|
|
||||||
// Thread::current["danbooru-user_id"] = $this->user_id
|
|
||||||
// Thread::current["danbooru-ip_addr"] = $this->ip
|
|
||||||
|
|
||||||
$this->active = true;
|
$this->active = true;
|
||||||
$this->save();
|
$this->save();
|
||||||
@ -46,14 +41,12 @@ class BatchUpload extends Rails\ActiveRecord\Base
|
|||||||
$this->data->success = true;
|
$this->data->success = true;
|
||||||
$this->data->post_id = $post->id;
|
$this->data->post_id = $post->id;
|
||||||
} elseif ($post->errors()->on('md5')) {
|
} elseif ($post->errors()->on('md5')) {
|
||||||
// $p = $post->errors();
|
|
||||||
$p = Post::where(['md5' => $post->md5])->first();
|
$p = Post::where(['md5' => $post->md5])->first();
|
||||||
|
|
||||||
$this->data->success = false;
|
$this->data->success = false;
|
||||||
$this->data->error = "Post already exists";
|
$this->data->error = "Post already exists";
|
||||||
$this->data->post_id = $p->id;
|
$this->data->post_id = $p->id;
|
||||||
} else {
|
} else {
|
||||||
// p $post.errors
|
|
||||||
$this->data->success = false;
|
$this->data->success = false;
|
||||||
$this->data->error = $post->errors()->fullMessages(", ");
|
$this->data->error = $post->errors()->fullMessages(", ");
|
||||||
}
|
}
|
||||||
@ -69,9 +62,6 @@ class BatchUpload extends Rails\ActiveRecord\Base
|
|||||||
$this->save();
|
$this->save();
|
||||||
|
|
||||||
$this->finished = true;
|
$this->finished = true;
|
||||||
// Thread::current["danbooru-user"] = old_thread_user
|
|
||||||
// Thread::current["danbooru-user_id"] = old_thread_user_id
|
|
||||||
// Thread::current["danbooru-ip_addr"] = old_ip_addr
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function associations()
|
protected function associations()
|
||||||
|
Reference in New Issue
Block a user