Fix #4715: Call to Content::canArchive() throws error on global content

This commit is contained in:
buddh4 2020-12-17 14:56:19 +01:00
parent 18edbc0e26
commit e359659529
3 changed files with 15 additions and 3 deletions

View File

@ -6,7 +6,9 @@ HumHub Changelog
- Fix #4668: table-responsive tables do not overflow due to default word break style
- Fix #4679: Richtext extension scan does not include full title if title contains a `)`
- Fix #4714: Use HTTPS protocol for default OEmbed endpoint URLs
- Fix #4649: SSuccess message although password save error
- Fix #4649: Success message rendered although password validation failed
- Fix #4717: Repsonsive layout alignment issue on small screens
- Fix #4715: Call to `Content::canArchive()` throws error on global content
1.7.1 (November 27, 2020)

View File

@ -409,6 +409,16 @@ class Content extends ActiveRecord implements Movable, ContentOwner
*/
public function canArchive()
{
// Currently global content can not be archived
if(!$this->contentcontainer_id) {
return false;
}
// No need to archive content on an archived container, content is marked as archived already
if($this->content->content->getContainer()->isArchived()) {
return false;
}
return $this->getContainer()->permissionManager->can(new ManageContent());
}

View File

@ -32,8 +32,8 @@ class ArchiveLink extends \yii\base\Widget
*/
public function run()
{
if (!$this->content->content->canArchive() || $this->content->content->getContainer()->isArchived()) {
return;
if (!$this->content->content->canArchive()) {
return '';
}
return $this->render('archiveLink', [