1
0
mirror of https://github.com/chylex/Nextcloud-News.git synced 2025-04-26 05:15:46 +02:00

Always show the unread articles.

The unread articles folder will always be visible, regardless
of the "Show all" setting. If that setting is on, then an
additional "All articles" folder will be show as before, but
it doesn't substitute the "Uread articles" one.

A new URL /apps/news/#/items/unread is also created that jumps
to the unread articles.

Signed-off-by: Cesar Enrique Garcia Dabo <cquike@arcor.de>
This commit is contained in:
Cesar Enrique Garcia Dabo 2020-04-11 02:21:56 +02:00 committed by Benjamin Brahmer
parent a69ec8edd8
commit 5b4f3d29e4
5 changed files with 52 additions and 11 deletions

View File

@ -16,7 +16,8 @@ app.config(function ($routeProvider, $provide, $httpProvider, $locationProvider)
STARRED: 2,
SUBSCRIPTIONS: 3,
SHARED: 4,
EXPLORE: 5
EXPLORE: 5,
UNREAD: 6
};
// default hashPrefix changed in angular 1.6 to '!'
@ -190,6 +191,12 @@ app.config(function ($routeProvider, $provide, $httpProvider, $locationProvider)
resolve: getItemResolve(feedType.STARRED),
type: feedType.STARRED
})
.when('/items/unread', {
controller: 'ContentController as Content',
templateUrl: 'content.html',
resolve: getItemResolve(feedType.UNREAD),
type: feedType.UNREAD
})
.when('/items/feeds/:id', {
controller: 'ContentController as Content',
templateUrl: 'content.html',

View File

@ -17,7 +17,7 @@ app.run(function ($rootScope, $location, $http, $q, $interval, $route, Loading,
// listen to keys in returned queries to automatically distribute the
// incoming values to models
Publisher.subscribe(ItemResource).toChannels(['items', 'newestItemId',
'starred']);
'starred', 'unread']);
Publisher.subscribe(FolderResource).toChannels(['folders']);
Publisher.subscribe(FeedResource).toChannels(['feeds']);
Publisher.subscribe(SettingsResource).toChannels(['settings']);
@ -49,12 +49,16 @@ app.run(function ($rootScope, $location, $http, $q, $interval, $route, Loading,
url = '/explore';
break;
case FEED_TYPE.UNREAD:
url = '/items/unread';
break;
default:
url = '/items';
}
// only redirect if url is empty or faulty
if (!/^\/items(\/(starred|explore|feeds\/\d+|folders\/\d+))?\/?$/
if (!/^\/items(\/(starred|unread|explore|feeds\/\d+|folders\/\d+))?\/?$/
.test(path)) {
$location.path(url);
}
@ -126,4 +130,4 @@ app.run(function ($rootScope, $location, $http, $q, $interval, $route, Loading,
$location.path('/items');
});
});
});

View File

@ -21,4 +21,5 @@ class FeedType
const SUBSCRIPTIONS = 3;
const SHARED = 4;
const EXPLORE = 5;
const UNREAD = 6;
}

View File

@ -64,7 +64,7 @@ class ItemMapper extends NewsMapper
if (isset($type) && $type === FeedType::STARRED) {
$sql = 'AND `items`.`starred` = ';
$sql .= $this->db->quote(true, IQueryBuilder::PARAM_BOOL) . ' ';
} elseif (!$showAll) {
} elseif (!$showAll || $type === FeedType::UNREAD) {
$sql .= 'AND `items`.`unread` = ';
$sql .= $this->db->quote(true, IQueryBuilder::PARAM_BOOL) . ' ';
}

View File

@ -4,14 +4,10 @@
}"
class="subscriptions-feed with-counter with-menu">
<a class="icon-rss" ng-href="#/items/" ng-if="!Navigation.isShowAll()">
<a class="icon-rss" ng-href="#/items/unread" >
<?php p($l->t('Unread articles'))?>
</a>
<a class="icon-rss" ng-href="#/items/" ng-if="Navigation.isShowAll()">
<?php p($l->t('All articles'))?>
</a>
<div class="app-navigation-entry-utils" ng-show="Navigation.isUnread()">
<ul>
<li class="app-navigation-entry-utils-counter"
@ -38,4 +34,37 @@
</ul>
</div>
</li>
</li>
<li ng-class="{
active: Navigation.isSubscriptionsActive(),
unread: Navigation.isUnread()
}"
class="all-subscriptions-feed with-counter with-menu">
<a class="icon-rss" ng-href="#/items/" ng-if="Navigation.isShowAll()">
<?php p($l->t('All articles'))?>
</a>
<div class="app-navigation-entry-utils" ng-if="Navigation.isShowAll()">
<ul>
<li class="app-navigation-entry-utils-menu-button">
<button
ng-click="optionsId = (optionsId == 'all' ? -1 : 'all')">
</button>
</li>
</ul>
</div>
<div class="app-navigation-entry-menu" ng-if="navigation.isShowAll()">
<ul>
<li class="mark-read">
<button ng-click="Navigation.markRead()">
<span class="icon-checkmark"></span>
<span><?php p($l->t('Mark read')); ?></span>
</button>
</li>
</ul>
</div>
</li>