Commit 1ab0c765 authored by Dão Gottwald's avatar Dão Gottwald
Browse files

Bug 1656508 - Fix blocking of default top sites with %YYYYMMDDHH% in their...

Bug 1656508 - Fix blocking of default top sites with %YYYYMMDDHH% in their URL. r=mikedeboer, a=RyanVM

Differential Revision: https://phabricator.services.mozilla.com/D89729
parent 00115e31
......@@ -75,7 +75,7 @@ export const LinkMenuOptions = {
action: ac.AlsoToMain({
type: at.BLOCK_URL,
data: tiles.map(site => ({
url: site.open_url || site.url,
url: site.original_url || site.open_url || site.url,
// pocket_id is only for pocket stories being in highlights, and then dismissed.
pocket_id: site.pocket_id,
...(site.flight_id ? { flight_id: site.flight_id } : {}),
......
......@@ -5644,7 +5644,7 @@ const LinkMenuOptions = {
action: common_Actions_jsm__WEBPACK_IMPORTED_MODULE_0__["actionCreators"].AlsoToMain({
type: common_Actions_jsm__WEBPACK_IMPORTED_MODULE_0__["actionTypes"].BLOCK_URL,
data: tiles.map(site => ({
url: site.open_url || site.url,
url: site.original_url || site.open_url || site.url,
// pocket_id is only for pocket stories being in highlights, and then dismissed.
pocket_id: site.pocket_id,
...(site.flight_id ? {
......
......@@ -501,22 +501,26 @@ this.TopSitesFeed = class TopSitesFeed {
let yyyymmddhh = yyyymmdd + pad(date.getHours());
let notBlockedDefaultSites = [];
for (let link of DEFAULT_TOP_SITES) {
if (this.shouldFilterSearchTile(link.hostname)) {
continue;
}
// Remove any defaults that have been blocked.
if (NewTabUtils.blockedLinks.isBlocked({ url: link.url })) {
continue;
}
// Process %YYYYMMDDHH% tag in the URL.
if (this._useRemoteSetting) {
link = {
...link,
// Save original URL without %YYYYMMDDHH% replaced so it can be
// blocked properly.
original_url: link.url,
url: link.url.replace("%YYYYMMDDHH%", yyyymmddhh),
};
if (link.url_urlbar) {
link.url_urlbar = link.url_urlbar.replace("%YYYYMMDDHH%", yyyymmddhh);
}
}
// Remove any defaults that have been blocked.
if (NewTabUtils.blockedLinks.isBlocked({ url: link.url })) {
continue;
}
if (this.shouldFilterSearchTile(link.hostname)) {
continue;
}
// If we've previously blocked a search shortcut, remove the default top site
// that matches the hostname
const searchProvider = getSearchProvider(shortURL(link));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment