Fixed history for posts uploaded anonymously

Until now posts uploaded anonymously were not so anonymous - the author
was clearly visible in post history (and tag history if the upload has
led to creation of any new tags). Both of these are fixed now.
This commit is contained in:
Marcin Kurczewski 2014-12-14 09:30:22 +01:00
parent 8a33b9581d
commit 839e97b1e2

View file

@ -109,10 +109,13 @@ class PostService
{ {
$formData->validate($this->validator); $formData->validate($this->validator);
if ($formData->anonymous)
$this->authService->loginAnonymous();
$post = new Post(); $post = new Post();
$post->setUploadTime($this->timeService->getCurrentTime()); $post->setUploadTime($this->timeService->getCurrentTime());
$post->setLastEditTime($this->timeService->getCurrentTime()); $post->setLastEditTime($this->timeService->getCurrentTime());
$post->setUser($formData->anonymous ? null : $this->authService->getLoggedInUser()); $post->setUser($this->authService->getLoggedInUser());
$post->setOriginalFileName($formData->contentFileName); $post->setOriginalFileName($formData->contentFileName);
$post->setName($this->getUniqueRandomPostName()); $post->setName($this->getUniqueRandomPostName());