forked from wallabag/wallabag
Fix hazardous bug with Postgres
Instead of retrieving a random annotation, sort them to be sure they are all the same no matter the database used
This commit is contained in:
@ -101,6 +101,7 @@ class AnnotationRepository extends EntityRepository
|
|||||||
return $this->createQueryBuilder('a')
|
return $this->createQueryBuilder('a')
|
||||||
->leftJoin('a.user', 'u')
|
->leftJoin('a.user', 'u')
|
||||||
->where('u.username = :username')->setParameter('username', $username)
|
->where('u.username = :username')->setParameter('username', $username)
|
||||||
|
->orderBy('a.id', 'DESC')
|
||||||
->setMaxResults(1)
|
->setMaxResults(1)
|
||||||
->getQuery()
|
->getQuery()
|
||||||
->getSingleResult();
|
->getSingleResult();
|
||||||
|
|||||||
@ -81,7 +81,7 @@ class AnnotationControllerTest extends WallabagAnnotationTestCase
|
|||||||
$this->assertEquals('Big boss', $content['user']);
|
$this->assertEquals('Big boss', $content['user']);
|
||||||
$this->assertEquals('v1.0', $content['annotator_schema_version']);
|
$this->assertEquals('v1.0', $content['annotator_schema_version']);
|
||||||
$this->assertEquals('a modified annotation', $content['text']);
|
$this->assertEquals('a modified annotation', $content['text']);
|
||||||
$this->assertEquals('content', $content['quote']);
|
$this->assertEquals('my quote', $content['quote']);
|
||||||
|
|
||||||
$annotationUpdated = $this->client->getContainer()
|
$annotationUpdated = $this->client->getContainer()
|
||||||
->get('doctrine.orm.entity_manager')
|
->get('doctrine.orm.entity_manager')
|
||||||
|
|||||||
Reference in New Issue
Block a user