Skip to content
This repository was archived by the owner on Dec 11, 2019. It is now read-only.

Commit

Permalink
Clear pinned tag when unpinned
Browse files Browse the repository at this point in the history
fix #7253

Auditors: @bbondy

Test Plan:
Will do a follow up automatic test
  • Loading branch information
darkdh authored and bbondy committed Feb 15, 2017
1 parent 645c901 commit b4cb1f5
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion js/state/siteUtil.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@ const isBookmarkFolder = (tags) => {
tags && typeof tags !== 'string' && tags.includes(siteTags.BOOKMARK_FOLDER)
}

const isPinnedTab = (tags) => {
if (!tags) {
return false
}
return tags.includes(siteTags.PINNED)
}

const reorderSite = (sites, order) => {
sites = sites.map((site) => {
const siteOrder = site.get('order')
Expand Down Expand Up @@ -275,8 +282,12 @@ module.exports.removeSite = function (sites, siteDetail, tag, reorder = true) {
const order = sites.getIn([key, 'order'])
sites = reorderSite(sites, order)
}

return sites.delete(key)
} else if (isPinnedTab(tag)) {
let site = sites.get(key)
const tags = site.get('tags').filterNot((tag) => tag === siteTags.PINNED)
site = site.set('tags', tags)
return sites.set(key, site)
} else {
let site = sites.get(key)
site = site.set('lastAccessedTime', undefined)
Expand Down

0 comments on commit b4cb1f5

Please sign in to comment.