Don't affect qute://history with history.exclude

This commit is contained in:
Florian Bruhin 2018-09-02 10:19:03 +02:00
parent d62f502e81
commit 4f56355fbe
3 changed files with 5 additions and 9 deletions

View File

@ -252,9 +252,7 @@ def history_data(start_time, offset=None):
return [{"url": e.url, return [{"url": e.url,
"title": html.escape(e.title) or html.escape(e.url), "title": html.escape(e.title) or html.escape(e.url),
"time": e.atime} "time": e.atime}
for e in entries for e in entries]
if not any(pattern.matches(QUrl(e.url))
for pattern in config.val.history.exclude)]
@add_handler('history') @add_handler('history')

View File

@ -1065,8 +1065,8 @@ history.exclude:
desc: >- desc: >-
A list of patterns which should not be shown in the history. A list of patterns which should not be shown in the history.
This only affects the completion and qute://history page. Matching URLs are This only affects the completion. Matching URLs are still saved in the
still saved in the history, but hidden. history (and visible on the qute://history page), but hidden.
Changing this setting will cause the completion history to be regenerated Changing this setting will cause the completion history to be regenerated
on the next start, which will take a short while. on the next start, which will take a short while.

View File

@ -135,15 +135,13 @@ class TestHistoryHandler:
assert item['time'] > end_time assert item['time'] > end_time
def test_exclude(self, fake_web_history, now, config_stub): def test_exclude(self, fake_web_history, now, config_stub):
"""Make sure the history.exclude setting does not apply."""
config_stub.set_obj('history.exclude', ['www.x.com']) config_stub.set_obj('history.exclude', ['www.x.com'])
url = QUrl('http://www.example.org/')
fake_web_history.add_from_tab(url, url, 'title')
url = QUrl("qute://history/data?start_time={}".format(now)) url = QUrl("qute://history/data?start_time={}".format(now))
_mimetype, data = qutescheme.qute_history(url) _mimetype, data = qutescheme.qute_history(url)
items = json.loads(data) items = json.loads(data)
assert len(items) == 1 assert items
assert items[0]['url'] == 'http://www.example.org/'
def test_qute_history_benchmark(self, fake_web_history, benchmark, now): def test_qute_history_benchmark(self, fake_web_history, benchmark, now):
r = range(100000) r = range(100000)