Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make selfoss navigable #869

Merged
merged 35 commits into from
Feb 12, 2017
Merged
Changes from 3 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
e976397
make it possible to request specific extra items in item list
niol Dec 22, 2016
f9db3dc
ensure read items are counted for loading more items (fix #774)
niol Dec 22, 2016
ddefcad
make selfoss navigable (#243)
niol Dec 22, 2016
116932a
fix loosing tag or source filtering on mobile
niol Dec 23, 2016
41eabb8
workaround firefox different handling of hash decoding for unicode tags
niol Dec 29, 2016
d832d80
assume the hash is encoded to handle tags with % sign in hash
niol Dec 29, 2016
5427a2f
use seek pagination instead of offset
niol Jan 2, 2017
c12c424
ensure entry requested in location.hash is shown
niol Jan 2, 2017
f481955
open source nav if source requested in location.hash
niol Jan 2, 2017
a50092e
fix seek pagination on smartphone when last entry was marked read
niol Jan 3, 2017
0ccbb01
fix clicking the entry source to get to source listing
niol Jan 3, 2017
3e25460
ensure .stream-error message events are set even on first load
niol Jan 3, 2017
2360e3f
fix ‘Refresh this source’ button inserted also to subsequent pages (#…
niol Jan 3, 2017
a5f6c93
prevent unwanted scrolling to selected entry on stream more
niol Jan 6, 2017
26dc95a
prevent selected entry from being requested again upon stream more
niol Jan 15, 2017
667b061
ensure hash is processed after changing hash programmatically
niol Jan 15, 2017
96c6020
fix tag with % js failure
niol Feb 6, 2017
4b45e9f
Fix broken sqlite
jtojnar Feb 5, 2017
fbbd653
fix settings not reachable
niol Feb 6, 2017
79b46a6
fix cannot come back from setting (JS failure)
niol Feb 6, 2017
1242a83
fix cannot got from setting to tag or source
niol Feb 6, 2017
4f403f0
fix lost tag or source when coming back from settings
niol Feb 6, 2017
d522eac
show error upon invalid tag, source id, section or subsection
niol Feb 6, 2017
04cf4f5
fix highlight 'all tags' when hitting 'back' after visiting a tag
niol Feb 7, 2017
83ca0e6
fix seek pagination with sqlite
niol Feb 7, 2017
c330f1b
fix update location hash when using keyboard shortcuts
niol Feb 8, 2017
3c42506
fix r shortcut
niol Feb 8, 2017
b877487
fix hash not updated on reload when an entry has been opened before
niol Feb 8, 2017
9733f88
fix item id in url useless and back/forward after shortcuts
niol Feb 8, 2017
27a1cc0
fix double mark on mobile
niol Feb 9, 2017
1ba3eac
prevent mixing seek and offset pagination
niol Feb 10, 2017
74f0cdb
fix extra_ids not being SELECTed if out of seek pagination or LIMIT
niol Feb 10, 2017
8e6b807
add comment explaining the specific query when explictely requesting ids
niol Feb 10, 2017
8bd3265
fix order by desc ordering of items
niol Feb 10, 2017
53283b1
fix selfoss.filter.type not set from the hash
niol Feb 12, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 30 additions & 7 deletions daos/mysql/Items.php
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,10 @@ public function get($options = array()) {
&& isset($options['offset_from_id'])
&& is_numeric($options['offset_from_id']) ) {

// discard offset as it makes no sense to mix offset pagination
// with seek pagination.
$options['offset'] = 0;

$offset_from_datetime_sql = $this->stmt->datetime($options['offset_from_datetime']);
$params[':offset_from_datetime'] = array(
$offset_from_datetime_sql, \PDO::PARAM_STR
Expand Down Expand Up @@ -278,7 +282,6 @@ public function get($options = array()) {

// finalize items filter
$where_sql = implode(' AND ', $where);
if( $where_ids != '' ) $where_sql = "(($where_sql) OR $where_ids)";

// set limit
if(!is_numeric($options['items']) || $options['items']>200)
Expand All @@ -296,12 +299,32 @@ public function get($options = array()) {
$this->hasMore = count($result);

// get items from database
return \F3::get('db')->exec('SELECT
items.id, datetime, items.title AS title, content, unread, starred, source, thumbnail, icon, uid, link, updatetime, author, sources.title as sourcetitle, sources.tags as tags
FROM '.\F3::get('db_prefix').'items AS items, '.\F3::get('db_prefix').'sources AS sources
WHERE items.source=sources.id AND '.$where_sql.'
ORDER BY items.datetime '.$order.'
LIMIT ' . $options['items'] . ' OFFSET '. $options['offset'], $params);
$select = 'SELECT
items.id, datetime, items.title AS title, content, unread, starred, source, thumbnail, icon, uid, link, updatetime, author, sources.title as sourcetitle, sources.tags as tags
FROM '.\F3::get('db_prefix').'items AS items, '.\F3::get('db_prefix').'sources AS sources
WHERE items.source=sources.id AND';
$order = 'ORDER BY items.datetime,items.id '.$order;
Copy link
Member

@jtojnar jtojnar Feb 10, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be 'ORDER BY items.datetime ' . $order . ', items.id ' . $order

Otherwise, it just returns the first page over again, when you use oldest first.


if( $where_ids != '' ) {
// This UNION is required for the extra explicitely requested items
// to be included whether or not they would have been excluded by
// seek, filter, offset rules.
//
// SQLite note: the 'entries' SELECT is encapsulated into a
// SELECT * FROM (...) to fool the SQLite engine into not
// complaining about 'order by clause should come after union not
// before'.
$query = "SELECT * FROM (
SELECT * FROM ($select $where_sql $order LIMIT " . $options['items'] . ' OFFSET '. $options['offset'] . ") AS entries
UNION
$select $where_ids
) AS items
$order";
} else {
$query = "$select $where_sql $order LIMIT " . $options['items'] . ' OFFSET '. $options['offset'];
}

return \F3::get('db')->exec($query, $params);
}


Expand Down