Skip to content

Commit

Permalink
fix(site_notifications): use list out of bounds helper
Browse files Browse the repository at this point in the history
When deleting site notifications from the last page you could loose the
option to return to the list.
  • Loading branch information
jeabakker committed Oct 11, 2021
1 parent 32cdec6 commit b39c55b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,25 @@

$page_owner = elgg_get_page_owner_entity();

$list = elgg_list_entities([
$options = [
'type' => 'object',
'subtype' => 'site_notification',
'owner_guid' => $page_owner->guid,
'full_view' => false,
'metadata_name_value_pairs' => [
'read' => false,
],
'pagination' => true,
'pagination_behaviour' => 'ajax-replace',
]);
];

$list = elgg_list_entities($options);
if (empty($list)) {
$content = elgg_view('page/components/no_results', [
'no_results' => elgg_echo('site_notifications:empty'),
]);
$options['no_results'] = elgg_echo('site_notifications:empty');
$options['count'] = elgg_count_entities($options);

$content = elgg_view('page/components/no_results', $options);
$content .= elgg_view('page/components/list/out_of_bounds', $options);
} else {
$content = elgg_view_form('site_notifications/process', [], [
'list' => $list
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,25 @@

$page_owner = elgg_get_page_owner_entity();

$list = elgg_list_entities([
$options = [
'type' => 'object',
'subtype' => 'site_notification',
'owner_guid' => $page_owner->guid,
'full_view' => false,
'metadata_name_value_pairs' => [
'read' => true,
],
'pagination' => true,
'pagination_behaviour' => 'ajax-replace',
]);
];

$list = elgg_list_entities($options);
if (empty($list)) {
$content = elgg_view('page/components/no_results', [
'no_results' => elgg_echo('site_notifications:empty'),
]);
$options['no_results'] = elgg_echo('site_notifications:empty');
$options['count'] = elgg_count_entities($options);

$content = elgg_view('page/components/no_results', $options);
$content .= elgg_view('page/components/list/out_of_bounds', $options);
} else {
$content = elgg_view_form('site_notifications/process', [], [
'list' => $list,
Expand Down

0 comments on commit b39c55b

Please sign in to comment.