From: Alexander Ebert Date: Sat, 29 Apr 2017 23:15:09 +0000 (+0200) Subject: Fallback to all recent activities if there are no results X-Git-Tag: 3.1.0_Alpha_1~481 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=fde578c447960e1670ffc06e3ce91e3fdd610902;p=GitHub%2FWoltLab%2FWCF.git Fallback to all recent activities if there are no results See #2258 --- diff --git a/com.woltlab.wcf/templates/boxRecentActivity.tpl b/com.woltlab.wcf/templates/boxRecentActivity.tpl index db1bc08e38..eae61fc798 100644 --- a/com.woltlab.wcf/templates/boxRecentActivity.tpl +++ b/com.woltlab.wcf/templates/boxRecentActivity.tpl @@ -18,6 +18,10 @@
  • {lang}wcf.user.recentActivity.scope.all{/lang}
  • {lang}wcf.user.recentActivity.scope.followedUsers{/lang}
  • + + {if $filteredByFollowedUsersOverride} +

    {lang}wcf.user.recentActivity.scope.followedUsers.noResults{/lang}

    + {/if} {/if} diff --git a/wcfsetup/install/files/lib/system/box/RecentActivityListBoxController.class.php b/wcfsetup/install/files/lib/system/box/RecentActivityListBoxController.class.php index 8ce405e17e..7e109deb16 100644 --- a/wcfsetup/install/files/lib/system/box/RecentActivityListBoxController.class.php +++ b/wcfsetup/install/files/lib/system/box/RecentActivityListBoxController.class.php @@ -38,6 +38,12 @@ class RecentActivityListBoxController extends AbstractDatabaseObjectListBoxContr */ public $filteredByFollowedUsers = false; + /** + * is true if filtering by followed users yielded no results + * @var boolean + */ + public $filteredByFollowedUsersOverride = false; + /** * @inheritDoc */ @@ -99,7 +105,8 @@ class RecentActivityListBoxController extends AbstractDatabaseObjectListBoxContr 'canFilterByFollowedUsers' => $this->canFilterByFollowedUsers, 'eventList' => $this->objectList, 'lastEventTime' => $this->objectList->getLastEventTime(), - 'filteredByFollowedUsers' => $this->filteredByFollowedUsers + 'filteredByFollowedUsers' => $this->filteredByFollowedUsers, + 'filteredByFollowedUsersOverride' => $this->filteredByFollowedUsersOverride ], true); } else { @@ -117,14 +124,35 @@ class RecentActivityListBoxController extends AbstractDatabaseObjectListBoxContr return true; } + /** + * @inheritDoc + */ + public function hasContent() { + $hasContent = parent::hasContent(); + + if (!$hasContent) { + if (($this->getBox()->position == 'contentTop' || $this->getBox()->position == 'contentBottom') && $this->filteredByFollowedUsers) { + $this->filteredByFollowedUsersOverride = true; + + $this->loadContent(); + + return count($this->objectList) > 0; + } + } + + return $hasContent; + } + /** * @inheritDoc */ protected function readObjects() { // apply filter if (($this->getBox()->position == 'contentTop' || $this->getBox()->position == 'contentBottom') && $this->filteredByFollowedUsers) { - /** @noinspection PhpUndefinedMethodInspection */ - $this->objectList->getConditionBuilder()->add('user_activity_event.userID IN (?)', [WCF::getUserProfileHandler()->getFollowingUsers()]); + if (!$this->filteredByFollowedUsersOverride) { + /** @noinspection PhpUndefinedMethodInspection */ + $this->objectList->getConditionBuilder()->add('user_activity_event.userID IN (?)', [WCF::getUserProfileHandler()->getFollowingUsers()]); + } } // load more items than necessary to avoid empty list if some items are invisible for current user diff --git a/wcfsetup/install/files/style/layout/containerList.scss b/wcfsetup/install/files/style/layout/containerList.scss index 152e5cab4c..91b74877c5 100644 --- a/wcfsetup/install/files/style/layout/containerList.scss +++ b/wcfsetup/install/files/style/layout/containerList.scss @@ -63,6 +63,10 @@ margin-left: 5px; } } + + > .recentActivityFollowedNoResults { + text-align: left; + } } @include screen-md-down { diff --git a/wcfsetup/install/lang/de.xml b/wcfsetup/install/lang/de.xml index 45b7f21765..d6e14ea3bc 100644 --- a/wcfsetup/install/lang/de.xml +++ b/wcfsetup/install/lang/de.xml @@ -3423,6 +3423,7 @@ Die E-Mail-Adresse des neuen Benutzers lautet: {@$user->email} + diff --git a/wcfsetup/install/lang/en.xml b/wcfsetup/install/lang/en.xml index deee925028..7378d63a7c 100644 --- a/wcfsetup/install/lang/en.xml +++ b/wcfsetup/install/lang/en.xml @@ -3410,6 +3410,7 @@ Open the link below to access the user profile: +