Bug 1489962 - Add snippets targeting, Pocket tagging and bug fixes to Activity Stream r=k88hudson

Differential Revision: https://phabricator.services.mozilla.com/D5914
This commit is contained in:
Ed Lee
2018-09-19 13:53:10 +00:00
parent 751926e5d0
commit f7f0cd229e
464 changed files with 7091 additions and 2119 deletions

View File

@@ -5,9 +5,9 @@ const _OpenInPrivateWindow = site => ({
icon: "new-window-private",
action: ac.OnlyToMain({
type: at.OPEN_PRIVATE_WINDOW,
data: {url: site.url, referrer: site.referrer}
data: {url: site.url, referrer: site.referrer},
}),
userEvent: "OPEN_PRIVATE_WINDOW"
userEvent: "OPEN_PRIVATE_WINDOW",
});
export const GetPlatformString = platform => {
@@ -36,18 +36,18 @@ export const LinkMenuOptions = {
icon: "bookmark-added",
action: ac.AlsoToMain({
type: at.DELETE_BOOKMARK_BY_ID,
data: site.bookmarkGuid
data: site.bookmarkGuid,
}),
userEvent: "BOOKMARK_DELETE"
userEvent: "BOOKMARK_DELETE",
}),
AddBookmark: site => ({
id: "menu_action_bookmark",
icon: "bookmark-hollow",
action: ac.AlsoToMain({
type: at.BOOKMARK_URL,
data: {url: site.url, title: site.title, type: site.type}
data: {url: site.url, title: site.title, type: site.type},
}),
userEvent: "BOOKMARK_ADD"
userEvent: "BOOKMARK_ADD",
}),
OpenInNewWindow: site => ({
id: "menu_action_open_new_window",
@@ -57,24 +57,24 @@ export const LinkMenuOptions = {
data: {
referrer: site.referrer,
typedBonus: site.typedBonus,
url: site.url
}
url: site.url,
},
}),
userEvent: "OPEN_NEW_WINDOW"
userEvent: "OPEN_NEW_WINDOW",
}),
BlockUrl: (site, index, eventSource) => ({
id: "menu_action_dismiss",
icon: "dismiss",
action: ac.AlsoToMain({
type: at.BLOCK_URL,
data: {url: site.open_url || site.url, pocket_id: site.pocket_id}
data: {url: site.open_url || site.url, pocket_id: site.pocket_id},
}),
impression: ac.ImpressionStats({
source: eventSource,
block: 0,
tiles: [{id: site.guid, pos: index}]
tiles: [{id: site.guid, pos: index}],
}),
userEvent: "BLOCK"
userEvent: "BLOCK",
}),
// This is an option for web extentions which will result in remove items from
@@ -86,8 +86,8 @@ export const LinkMenuOptions = {
action: ac.WebExtEvent(at.WEBEXT_DISMISS, {
source: eventSource,
url: site.url,
action_position: index
})
action_position: index,
}),
}),
DeleteUrl: (site, index, eventSource, isEnabled, siteInfo) => ({
id: "menu_action_delete",
@@ -97,57 +97,57 @@ export const LinkMenuOptions = {
data: {
onConfirm: [
ac.AlsoToMain({type: at.DELETE_HISTORY_URL, data: {url: site.url, pocket_id: site.pocket_id, forceBlock: site.bookmarkGuid}}),
ac.UserEvent(Object.assign({event: "DELETE", source: eventSource, action_position: index}, siteInfo))
ac.UserEvent(Object.assign({event: "DELETE", source: eventSource, action_position: index}, siteInfo)),
],
eventSource,
body_string_id: ["confirm_history_delete_p1", "confirm_history_delete_notice_p2"],
confirm_button_string_id: "menu_action_delete",
cancel_button_string_id: "topsites_form_cancel_button",
icon: "modal-delete"
}
icon: "modal-delete",
},
},
userEvent: "DIALOG_OPEN"
userEvent: "DIALOG_OPEN",
}),
ShowFile: (site, index, eventSource, isEnabled, siteInfo, platform) => ({
id: GetPlatformString(platform),
icon: "search",
action: ac.OnlyToMain({
type: at.SHOW_DOWNLOAD_FILE,
data: {url: site.url}
})
data: {url: site.url},
}),
}),
OpenFile: site => ({
id: "menu_action_open_file",
icon: "open-file",
action: ac.OnlyToMain({
type: at.OPEN_DOWNLOAD_FILE,
data: {url: site.url}
})
data: {url: site.url},
}),
}),
CopyDownloadLink: site => ({
id: "menu_action_copy_download_link",
icon: "copy",
action: ac.OnlyToMain({
type: at.COPY_DOWNLOAD_LINK,
data: {url: site.url}
})
data: {url: site.url},
}),
}),
GoToDownloadPage: site => ({
id: "menu_action_go_to_download_page",
icon: "download",
action: ac.OnlyToMain({
type: at.OPEN_LINK,
data: {url: site.referrer}
data: {url: site.referrer},
}),
disabled: !site.referrer
disabled: !site.referrer,
}),
RemoveDownload: site => ({
id: "menu_action_remove_download",
icon: "delete",
action: ac.OnlyToMain({
type: at.REMOVE_DOWNLOAD_FILE,
data: {url: site.url}
})
data: {url: site.url},
}),
}),
PinTopSite: ({url, searchTopSite, label}, index) => ({
id: "menu_action_pin",
@@ -157,65 +157,65 @@ export const LinkMenuOptions = {
data: {
site: {
url,
...(searchTopSite && {searchTopSite, label})
...(searchTopSite && {searchTopSite, label}),
},
index
}
index,
},
}),
userEvent: "PIN"
userEvent: "PIN",
}),
UnpinTopSite: site => ({
id: "menu_action_unpin",
icon: "unpin",
action: ac.AlsoToMain({
type: at.TOP_SITES_UNPIN,
data: {site: {url: site.url}}
data: {site: {url: site.url}},
}),
userEvent: "UNPIN"
userEvent: "UNPIN",
}),
SaveToPocket: (site, index, eventSource) => ({
id: "menu_action_save_to_pocket",
icon: "pocket-save",
action: ac.AlsoToMain({
type: at.SAVE_TO_POCKET,
data: {site: {url: site.url, title: site.title}}
data: {site: {url: site.url, title: site.title}},
}),
impression: ac.ImpressionStats({
source: eventSource,
pocket: 0,
tiles: [{id: site.guid, pos: index}]
tiles: [{id: site.guid, pos: index}],
}),
userEvent: "SAVE_TO_POCKET"
userEvent: "SAVE_TO_POCKET",
}),
DeleteFromPocket: site => ({
id: "menu_action_delete_pocket",
icon: "delete",
action: ac.AlsoToMain({
type: at.DELETE_FROM_POCKET,
data: {pocket_id: site.pocket_id}
data: {pocket_id: site.pocket_id},
}),
userEvent: "DELETE_FROM_POCKET"
userEvent: "DELETE_FROM_POCKET",
}),
ArchiveFromPocket: site => ({
id: "menu_action_archive_pocket",
icon: "check",
action: ac.AlsoToMain({
type: at.ARCHIVE_FROM_POCKET,
data: {pocket_id: site.pocket_id}
data: {pocket_id: site.pocket_id},
}),
userEvent: "ARCHIVE_FROM_POCKET"
userEvent: "ARCHIVE_FROM_POCKET",
}),
EditTopSite: (site, index) => ({
id: "edit_topsites_button_text",
icon: "edit",
action: {
type: at.TOP_SITES_EDIT,
data: {index}
}
data: {index},
},
}),
CheckBookmark: site => (site.bookmarkGuid ? LinkMenuOptions.RemoveBookmark(site) : LinkMenuOptions.AddBookmark(site)),
CheckPinTopSite: (site, index) => (site.isPinned ? LinkMenuOptions.UnpinTopSite(site) : LinkMenuOptions.PinTopSite(site, index)),
CheckSavedToPocket: (site, index) => (site.pocket_id ? LinkMenuOptions.DeleteFromPocket(site) : LinkMenuOptions.SaveToPocket(site, index)),
CheckBookmarkOrArchive: site => (site.pocket_id ? LinkMenuOptions.ArchiveFromPocket(site) : LinkMenuOptions.CheckBookmark(site)),
OpenInPrivateWindow: (site, index, eventSource, isEnabled) => (isEnabled ? _OpenInPrivateWindow(site) : LinkMenuOptions.EmptyItem())
OpenInPrivateWindow: (site, index, eventSource, isEnabled) => (isEnabled ? _OpenInPrivateWindow(site) : LinkMenuOptions.EmptyItem()),
};