Bug 1386737 - Fix broken top sites with pinned links lacking title for Activity Stream. r=ursula, a=lizzard
authorEd Lee <edilee@mozilla.com>
Wed, 02 Aug 2017 10:21:39 -0700
changeset 423403 842b7649ba334031b597610225d94cfbee174dab
parent 423402 5b9a1d5b16eeaeffd81df0b60f75b712a138ab9f
child 423404 b9603acedd3247e9a2fe6253c9b49d83d66ff113
push id1517
push userjlorenzo@mozilla.com
push dateThu, 14 Sep 2017 16:50:54 +0000
treeherdermozilla-release@3b41fd564418 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersursula, lizzard
bugs1386737
milestone56.0
Bug 1386737 - Fix broken top sites with pinned links lacking title for Activity Stream. r=ursula, a=lizzard MozReview-Commit-ID: LnPcqyPelTI
browser/extensions/activity-stream/data/locales.json
browser/extensions/activity-stream/lib/TopSitesFeed.jsm
browser/extensions/activity-stream/test/unit/lib/TopSitesFeed.test.js
--- a/browser/extensions/activity-stream/data/locales.json
+++ b/browser/extensions/activity-stream/data/locales.json
@@ -2677,16 +2677,17 @@
     "menu_action_copy_address": "Salin Alamat",
     "menu_action_email_link": "Emailkan Tautan…",
     "menu_action_open_new_window": "Buka di Jendela Baru",
     "menu_action_open_private_window": "Buka di Jendela Penjelajahan Pribadi Baru",
     "menu_action_dismiss": "Tutup",
     "menu_action_delete": "Hapus dari Riwayat",
     "menu_action_pin": "Semat",
     "menu_action_unpin": "Lepas",
+    "confirm_history_delete_p1": "Yakin ingin menghapus setiap bagian dari laman ini dari riwayat Anda?",
     "confirm_history_delete_notice_p2": "Tindakan ini tidak bisa diurungkan.",
     "menu_action_save_to_pocket": "Simpan ke Pocket",
     "search_for_something_with": "Cari {search_term} lewat:",
     "search_button": "Cari",
     "search_header": "Pencarian {search_engine_name}",
     "search_web_placeholder": "Cari di Web",
     "search_settings": "Ubah Pengaturan Pencarian",
     "section_info_option": "Info",
@@ -2700,16 +2701,20 @@
     "settings_pane_button_label": "Ubahsuai laman Tab Baru Anda",
     "settings_pane_header": "Preferensi Tab Baru",
     "settings_pane_body": "Pilih apa yang Anda lihat ketika Anda membuka tab baru.",
     "settings_pane_search_header": "Pencarian",
     "settings_pane_search_body": "Cari Web dari tab baru Anda.",
     "settings_pane_topsites_header": "Situs Teratas",
     "settings_pane_topsites_body": "Mengakses situs web yang paling sering Anda kunjungi.",
     "settings_pane_topsites_options_showmore": "Tampilkan dua baris",
+    "settings_pane_bookmarks_header": "Markah Terbaru",
+    "settings_pane_bookmarks_body": "Markah Anda dibuat di lokasi yang praktis.",
+    "settings_pane_visit_again_header": "Kunjungi Lagi",
+    "settings_pane_visit_again_body": "Firefox akan menunjukkan bagian dari riwayat penjelajahan yang mungkin ingin Anda ingat atau kunjungi lagi.",
     "settings_pane_pocketstories_header": "Cerita Utama",
     "settings_pane_pocketstories_body": "Pocket, bagian dari keluarga Mozilla, akan membantu hubungkan Anda dengan konten berkualitas tinggi yang tak dapat Anda temukan di tempat lain.",
     "settings_pane_done_button": "Selesai",
     "edit_topsites_button_text": "Sunting",
     "edit_topsites_button_label": "Ubahsuai bagian Situs Teratas Anda",
     "edit_topsites_showmore_button": "Tampilkan lainnya",
     "edit_topsites_showless_button": "Tampilkan lebih sedikit",
     "edit_topsites_done_button": "Selesai",
@@ -2725,17 +2730,21 @@
     "topsites_form_add_button": "Tambah",
     "topsites_form_save_button": "Simpan",
     "topsites_form_cancel_button": "Batalkan",
     "topsites_form_url_validation": "URL valid diperlukan",
     "pocket_read_more": "Topik Populer:",
     "pocket_read_even_more": "Lihat Cerita Lainnya",
     "pocket_feedback_header": "Yang terbaik dari Web, dikurasi lebih dari 25 juta orang.",
     "pocket_feedback_body": "Pocket, bagian dari keluarga Mozilla, akan membantu hubungkan Anda dengan konten berkualitas tinggi yang tak dapat Anda temukan di tempat lain.",
-    "pocket_send_feedback": "Kirim Umpanbalik"
+    "pocket_send_feedback": "Kirim Umpanbalik",
+    "topstories_empty_state": "Maaf Anda tercegat. Periksa lagi nanti untuk lebih banyak cerita terbaik dari {provider}. Tidak mau menunggu? Pilih topik populer untuk menemukan lebih banyak cerita hebat dari seluruh web.",
+    "manual_migration_explanation": "Cobalah Firefox dengan situs dan markah kesukaan Anda dari peramban yang lain.",
+    "manual_migration_cancel_button": "Tidak, Terima kasih",
+    "manual_migration_import_button": "Impor Sekarang"
   },
   "is": {},
   "it": {
     "newtab_page_title": "Nuova scheda",
     "default_label_loading": "Caricamento…",
     "header_top_sites": "Siti principali",
     "header_stories": "Storie principali",
     "header_visit_again": "Visita di nuovo",
@@ -5467,16 +5476,17 @@
   "uz": {},
   "vi": {
     "newtab_page_title": "Tab mới",
     "default_label_loading": "Đang tải…",
     "header_top_sites": "Trang web hàng đầu",
     "header_stories": "Câu chuyện hàng đầu",
     "header_visit_again": "Truy cập lại",
     "header_bookmarks": "Các bookmark gần đây",
+    "header_recommended_by": "Được đề nghị bởi {provider}",
     "header_bookmarks_placeholder": "Bạn chưa có bookmark nào.",
     "header_stories_from": "từ",
     "type_label_visited": "Đã truy cập",
     "type_label_bookmarked": "Đã được đánh dấu",
     "type_label_synced": "Đồng bộ từ thiết bị khác",
     "type_label_recommended": "Xu hướng",
     "type_label_open": "Mở",
     "type_label_topic": "Chủ đề",
@@ -5490,20 +5500,43 @@
     "menu_action_delete": "Xóa từ lịch xử",
     "menu_action_pin": "Ghim",
     "menu_action_unpin": "Bỏ ghim",
     "confirm_history_delete_notice_p2": "Hành động này không thể hoàn tác.",
     "menu_action_save_to_pocket": "Lưu vào Pocket",
     "search_for_something_with": "Tìm {search_term} với:",
     "search_button": "Tìm kiếm",
     "search_header": "Công cụ tìm kiếm {search_engine_name}",
+    "search_web_placeholder": "Tìm trên mạng",
+    "search_settings": "Thay đổi thiết lập tìm kiếm",
+    "section_info_option": "Thông tin",
+    "welcome_title": "Chào mừng đến với tab mới",
     "time_label_less_than_minute": "<1phút",
     "time_label_minute": "{number}phút",
     "time_label_hour": "{number}giờ",
-    "settings_pane_search_header": "Tìm kiếm"
+    "time_label_day": "{number}ngày",
+    "settings_pane_header": "Tùy chỉnh cho tab mới",
+    "settings_pane_body": "Chọn cái bạn muốn tải khi một tab mới được mở ra.",
+    "settings_pane_search_header": "Tìm kiếm",
+    "settings_pane_done_button": "Xong",
+    "edit_topsites_button_text": "Chỉnh sửa",
+    "edit_topsites_showmore_button": "Xem thêm",
+    "edit_topsites_showless_button": "Hiển thị ngắn gọn lại",
+    "edit_topsites_done_button": "Xong",
+    "edit_topsites_pin_button": "Ghim trang này",
+    "edit_topsites_unpin_button": "Bỏ ghim trang này",
+    "edit_topsites_edit_button": "Chỉnh sửa trang web này",
+    "edit_topsites_dismiss_button": "Bỏ qua trang này",
+    "edit_topsites_add_button": "Thêm",
+    "topsites_form_add_button": "Thêm",
+    "topsites_form_save_button": "Lưu lại",
+    "topsites_form_cancel_button": "Hủy bỏ",
+    "pocket_read_more": "Các chủ đề phổ biến:",
+    "pocket_send_feedback": "Gửi phản hồi",
+    "manual_migration_cancel_button": "Không, cảm ơn"
   },
   "wo": {},
   "xh": {},
   "zh-CN": {
     "newtab_page_title": "新标签页",
     "default_label_loading": "正在载入…",
     "header_top_sites": "常用网站",
     "header_stories": "热门报道",
--- a/browser/extensions/activity-stream/lib/TopSitesFeed.jsm
+++ b/browser/extensions/activity-stream/lib/TopSitesFeed.jsm
@@ -50,17 +50,20 @@ this.TopSitesFeed = class TopSitesFeed {
     let screenshot = await Screenshots.getScreenshotForURL(url);
     const action = {type: at.SCREENSHOT_UPDATED, data: {url, screenshot}};
     this.store.dispatch(ac.BroadcastToContent(action));
   }
   async getLinksWithDefaults(action) {
     let frecent = await NewTabUtils.activityStreamLinks.getTopSites();
     const defaultUrls = DEFAULT_TOP_SITES.map(site => site.url);
     let pinned = NewTabUtils.pinnedLinks.links;
-    pinned = pinned.map(site => site && Object.assign({}, site, {isDefault: defaultUrls.indexOf(site.url) !== -1}));
+    pinned = pinned.map(site => site && Object.assign({}, site, {
+      isDefault: defaultUrls.indexOf(site.url) !== -1,
+      hostname: shortURL(site)
+    }));
 
     if (!frecent) {
       frecent = [];
     } else {
       frecent = frecent.filter(link => link && link.type !== "affiliate");
     }
 
     // Group together websites that require deduping.
--- a/browser/extensions/activity-stream/test/unit/lib/TopSitesFeed.test.js
+++ b/browser/extensions/activity-stream/test/unit/lib/TopSitesFeed.test.js
@@ -173,16 +173,26 @@ describe("Top Sites Feed", () => {
           {url: "https://developer.mozilla.org/en-US/docs/Learn"}
         ];
 
         const sites = await feed.getLinksWithDefaults();
 
         // Frecent results are removed and only pinned are kept.
         assert.lengthOf(sites, 2);
       });
+      it("should return sites that have a title", async () => {
+        // Simulate a pinned link with no pinTitle.
+        fakeNewTabUtils.pinnedLinks.links = [{url: "https://github.com/mozilla/activity-stream"}];
+
+        const sites = await feed.getLinksWithDefaults();
+
+        for (const site of sites) {
+          assert.isDefined(site.pinTitle || site.hostname);
+        }
+      });
       it("should check against null entries", async () => {
         fakeNewTabUtils.pinnedLinks.links = [null];
 
         await feed.getLinksWithDefaults();
       });
     });
   });
   describe("#refresh", () => {