mirror of
https://github.com/humhub/humhub.git
synced 2025-01-17 14:18:27 +01:00
Merge branch 'develop' of github.com:humhub/humhub into develop
This commit is contained in:
commit
139ddf54e4
@ -9,7 +9,6 @@ use humhub\modules\content\widgets\stream\WallStreamEntryWidget;
|
||||
use humhub\modules\ui\menu\MenuEntry;
|
||||
use humhub\modules\ui\menu\widgets\Menu;
|
||||
use yii\helpers\ArrayHelper;
|
||||
use yii\helpers\Html;
|
||||
|
||||
/**
|
||||
* This widget is responsible for rendering the context menu for wallentries.
|
||||
@ -44,14 +43,18 @@ class WallEntryControls extends Menu
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function init()
|
||||
{
|
||||
$this->initRenderOptions();
|
||||
parent::init();
|
||||
}
|
||||
|
||||
public function initRenderOptions()
|
||||
{
|
||||
if(!$this->renderOptions && $this->wallEntryWidget instanceof WallStreamEntryWidget) {
|
||||
$this->renderOptions = $this->wallEntryWidget->renderOptions;
|
||||
} else if(!$this->renderOptions) {
|
||||
$this->renderOptions = new WallStreamEntryOptions();
|
||||
}
|
||||
|
||||
parent::init();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -66,13 +69,10 @@ class WallEntryControls extends Menu
|
||||
return $this->renderOptions->getViewContext();
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function run()
|
||||
public function initControls()
|
||||
{
|
||||
if($this->renderOptions->isControlsMenuDisabled()) {
|
||||
return '';
|
||||
if ($this->renderOptions->isControlsMenuDisabled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$entries = $this->wallEntryWidget instanceof WallEntry
|
||||
@ -86,6 +86,18 @@ class WallEntryControls extends Menu
|
||||
|
||||
$this->addEntry($this->getWallEntryLink($menuItem));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
if ($this->renderOptions->isControlsMenuDisabled()) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$this->initControls();
|
||||
|
||||
return parent::run();
|
||||
}
|
||||
|
@ -12,6 +12,7 @@
|
||||
'label' => '<i class="fa fa-bell-slash-o"></i> ' . Yii::t('ContentModule.base', 'Turn off notifications'),
|
||||
'ajaxOptions' => [
|
||||
'type' => 'POST',
|
||||
'data' => ['_method' => 'POST'], // Need to set this for case when it is inside <form> (e.g. cfiles - browse table)
|
||||
'success' => "function(res){ if (res.success) { $('#" . $offLinkId . "').hide(); $('#" . $onLinkId . "').show(); } }",
|
||||
'url' => Url::to(['/content/content/notification-switch', 'id' => $content->id, 'switch' => 0]),
|
||||
],
|
||||
@ -28,6 +29,7 @@
|
||||
'label' => '<i class="fa fa-bell-o"></i> ' . Yii::t('ContentModule.base', 'Turn on notifications'),
|
||||
'ajaxOptions' => [
|
||||
'type' => 'POST',
|
||||
'data' => ['_method' => 'POST'], // Need to set this for case when it is inside <form> (e.g. cfiles - browse table)
|
||||
'success' => "function(res){ if (res.success) { $('#" . $onLinkId . "').hide(); $('#" . $offLinkId . "').show(); } }",
|
||||
'url' => Url::to(['/content/content/notification-switch', 'id' => $content->id, 'switch' => 1]),
|
||||
],
|
||||
|
@ -88,9 +88,11 @@ humhub.module('stream.StreamEntry', function (module, require, $) {
|
||||
* Reloads this stream entry
|
||||
*/
|
||||
StreamEntry.prototype.reload = function () {
|
||||
return this.stream().reloadEntry(this).catch(function (err) {
|
||||
module.log.error(err, true);
|
||||
});
|
||||
if (typeof this.stream() !== 'undefined') {
|
||||
return this.stream().reloadEntry(this).catch(function (err) {
|
||||
module.log.error(err, true);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
@ -359,7 +361,7 @@ humhub.module('stream.StreamEntry', function (module, require, $) {
|
||||
client.post(evt.url).then(function (response) {
|
||||
if (response.success) {
|
||||
// Either just remove entry or reload it in case the stream includes archived entries
|
||||
if (that.stream().filter.isActive('entry_archived')) {
|
||||
if (typeof that.stream().filter === 'undefined' || that.stream().filter.isActive('entry_archived')) {
|
||||
that.reload().then(function () {
|
||||
streamModule.log.success('success.archive', true);
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user