Fix pin and archive global content without container (#5066)

This commit is contained in:
Yuriy Bakhtin 2021-05-11 14:00:07 +03:00 committed by GitHub
parent 0112192149
commit e388db32b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 2 deletions

View File

@ -4,6 +4,7 @@ HumHub Changelog
1.8.3 (Unreleased)
----------------------
- Fix #29: Fix login form view on browser back button after footer link
- Fix #5066: Fix pin and archive global content without container
1.8.2 (April 26, 2021)

View File

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