diff --git a/VERSIONS_HOTLINE/154502 b/VERSIONS_HOTLINE/154502 new file mode 100644 index 0000000000000000000000000000000000000000..1d6e58fb4f5e3dd49e77f239c2227ec050fea5b2 --- /dev/null +++ b/VERSIONS_HOTLINE/154502 @@ -0,0 +1 @@ + - correctif #154502 : Magasin de thèmes : La modification des avis par leurs auteurs depuis la page notice est de nouveau disponible. \ No newline at end of file diff --git a/library/templates/Intonation/Library/View/Wrapper/Review.php b/library/templates/Intonation/Library/View/Wrapper/Review.php index 57089f3792c740d7d9cd3046e3517644edea588c..ecf0a0293dd931394a57a3df5c7dd2c586262741 100644 --- a/library/templates/Intonation/Library/View/Wrapper/Review.php +++ b/library/templates/Intonation/Library/View/Wrapper/Review.php @@ -165,6 +165,11 @@ class Intonation_Library_View_Wrapper_Review extends Intonation_Library_View_Wra ->setText($this->_('Voir le document')) ->setTitle($this->_('Voir le document %s', $record->getTitrePrincipal(' ')))]; + return $this->_belongsToCurrentUserActions($actions); + } + + + protected function _belongsToCurrentUserActions(array $actions) : array { if (!$this->_model->belongsToCurrentUser()) return $actions; diff --git a/library/templates/Intonation/Library/View/Wrapper/ReviewInRecord.php b/library/templates/Intonation/Library/View/Wrapper/ReviewInRecord.php index fec08985d52c1504134c710ca645d50ea4cd4dc8..8d222648a4cfa4f7317bce8a1b5c1537844a560f 100644 --- a/library/templates/Intonation/Library/View/Wrapper/ReviewInRecord.php +++ b/library/templates/Intonation/Library/View/Wrapper/ReviewInRecord.php @@ -29,7 +29,7 @@ class Intonation_Library_View_Wrapper_ReviewInRecord extends Intonation_Library_ public function getSecondaryTitle() { - return $this->_getMetaDataAuthor(); + return ''; } @@ -62,7 +62,12 @@ class Intonation_Library_View_Wrapper_ReviewInRecord extends Intonation_Library_ } + public function getDescriptionTitle() { + return ''; + } + + public function getActions() { - return []; + return $this->_belongsToCurrentUserActions([]); } } \ No newline at end of file diff --git a/library/templates/Intonation/View/RenderReviewForm.php b/library/templates/Intonation/View/RenderReviewForm.php index 691edf58fcdd77de179ef78f2d35e1c50f63ba13..7418a550b8081e0977d180664190bd857f4bffde 100644 --- a/library/templates/Intonation/View/RenderReviewForm.php +++ b/library/templates/Intonation/View/RenderReviewForm.php @@ -38,8 +38,6 @@ class Intonation_View_RenderReviewForm extends ZendAfi_View_Helper_BaseHelper { $form->setAction($this->view->url($params, null, true)); - $form->getElement('entete')->setValue(''); - $form = $ajax ? $this->_ajaxMode($form) : $this->_standardMode($form); diff --git a/tests/scenarios/Templates/TemplatesReviewsTest.php b/tests/scenarios/Templates/TemplatesReviewsTest.php index d501969af0ae5d2d242ffbbdea0662437300a22b..cddb01452f7545747d0e4c66fd0f70f1d9df52d8 100644 --- a/tests/scenarios/Templates/TemplatesReviewsTest.php +++ b/tests/scenarios/Templates/TemplatesReviewsTest.php @@ -299,7 +299,7 @@ class TemplatesReviewsBlogReadMoreActionTest extends TemplatesReviewsBlogReadMor } - protected function _prepareRecord() { + protected function _prepareRecord() { $this->fixture('Class_Notice', ['id' => 2, 'clef_oeuvre' => 'PSYKO', @@ -568,7 +568,13 @@ class TemplatesReviewsEditActionTest extends TemplatesIntonationTestCase { /** @test */ public function leRoiNoteShouldBe4() { - $this->assertXPathContentContains('//div', '4'); + $this->assertXPath('//form//input[@type="radio"][@id="note-4"][@checked]'); + } + + + /** @test */ + public function enteteShouldBeLeRoi() { + $this->assertXPath('//form//input[@name="entete"][@value="Le Roi"]'); } } @@ -689,7 +695,7 @@ class TemplatesReviewsAsAdminTest extends Admin_AbstractControllerTestCase { $this->fixture('Class_Notice', ['id' => 8, - 'clef_oeuvre' => 'PROMENADEPETITBONHOMME']); + 'clef_oeuvre' => 'PROMENADEPETITBONHOMME']); $this->fixture('Class_AvisNotice', ['id' => 4, @@ -781,7 +787,7 @@ class TemplatesReviewsActionWithBabelthequeBabelioTest class TemplateReviewsWithBrTest extends AbstractControllerTestCase { - public function setUp() { + public function setUp() { parent::setUp(); $this->_buildTemplateProfil(['id' => 90, 'template' => 'MUSCLE']); @@ -794,7 +800,7 @@ class TemplateReviewsWithBrTest extends AbstractControllerTestCase { $this->fixture(Class_Notice::class, ['id' => 8, - 'clef_oeuvre' => 'PROMENADEPETITBONHOMME']); + 'clef_oeuvre' => 'PROMENADEPETITBONHOMME']); for ($i = 0 ; $i < 10 ; $i++) $this->fixture(Class_AvisNotice::class, @@ -977,4 +983,86 @@ class TemplatesReviewsDonnerDesAvisTest extends TemplatesIntonationTestCase { public function formActionForFakirShouldBeAjaxReviewRecordId89() { $this->assertXPath('//main//div[@class="masonry-content"]//form[@action="/abonne/ajax-review/record_id/89/record_key/"]'); } +} + + + + +class TemplatesReviewsInRecordTest extends AbstractControllerTestCase { + + protected $_storm_default_to_volatile = true; + + + public function setUp() { + parent::setUp(); + + $this->_buildTemplateProfil(['id' => 1233]); + + $this->fixture(Class_Notice::class, + ['id' => 123, + 'clef_oeuvre' => 'PROMENADEPETITBONHOMME']); + + $logged_franck = + $this->fixture(Class_Users::class, + ['id' => 123422, + 'login' => 'Franck', + 'password' => 'desavis', + 'role_level' => ZendAfi_Acl_AdminControllerRoles::INVITE]); + + ZendAfi_Auth::getInstance() + ->logUser($logged_franck); + + $robert = + $this->fixture(Class_Users::class, + ['id' => 890, + 'login' => 'Robert', + 'password' => 'desavis', + 'role_level' => ZendAfi_Acl_AdminControllerRoles::INVITE]); + + $this->fixture(Class_AvisNotice::class, + ['id' => 4, + 'id_notice' => 123, + 'clef_oeuvre' => 'PROMENADEPETITBONHOMME', + 'note' => 4, + 'entete' => 'Un avis sur cette notice sans titre', + 'avis' => 'Excellent contenu vide. À lire de toute urgence.', + ]) + ->setUser($robert) + ->setRoleLevel($robert) + ->save(); + + $this->fixture(Class_AvisNotice::class, + ['id' => 34, + 'id_notice' => 123, + 'clef_oeuvre' => 'PROMENADEPETITBONHOMME', + 'note' => 3, + 'entete' => 'Un autre avis sur ce document sans titre', + 'avis' => 'Suivez le conseille de Rober. On ne se lasse pas de le lire.', + ]) + ->setUser($logged_franck) + ->setRoleLevel($logged_franck) + ->save(); + + $this->dispatch('record/reviews/id/123'); + } + + + /** @test */ + public function reviewRobertShouldNotBeRepeated() { + $this->assertXPathCount('//div//*[contains(text(), "Par Robert")]', 1); + } + + + /** @test */ + public function currentLoggedUserShouldSeeEditReviewAction() { + $this->assertXPathContentContains('//div//a[@href="/abonne/edit-review/id/34"]', + 'Modifier'); + } + + + /** @test */ + public function currentLoggedUserShouldSeeDeleteReviewAction() { + $this->assertXPathContentContains('//div//a[@href="/abonne/delete-review/id/34"]', + 'Supprimer'); + } } \ No newline at end of file