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

Commit

Permalink
Merge pull request #12768 from NejcZdovc/hotfix/#9517-update
Browse files Browse the repository at this point in the history
Fixes upgrade of bookmark/folder width
  • Loading branch information
bsclifton committed Jan 25, 2018
1 parent 64ee8f3 commit bcd2de6
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
9 changes: 7 additions & 2 deletions app/browser/api/textCalc.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,19 @@ const fontSize = globalStyles.spacing.bookmarksItemFontSize
const fontFamily = globalStyles.typography.default.family

const calcText = (item, type) => {
const title = type === siteTags.BOOKMARK
let title = type === siteTags.BOOKMARK
? item.get('title') || item.get('location')
: item.get('title')

if (title && title.length === 0) {
return
}

title = title
.replace(/'/g, '!')
.replace(/\\"/g, '!')
.replace(/\\\\/g, '//')

const param = `
(function() {
let ctx = document.createElement('canvas').getContext('2d')
Expand Down Expand Up @@ -133,7 +138,7 @@ const calcTextList = (list) => {
if (list.size > 0) {
calcTextList(list)
}
})
}, true)
}

module.exports = {
Expand Down
11 changes: 9 additions & 2 deletions app/browser/reducers/bookmarkToolbarReducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */

const Immutable = require('immutable')

// Constants
const appConstants = require('../../../js/constants/appConstants')

Expand All @@ -20,13 +22,18 @@ const bookmarkToolbarReducer = (state, action, immutableAction) => {
{
// update session for 0.21.x version
const bookmarks = bookmarksState.getBookmarks(state)
let list = Immutable.List()
if (bookmarks.first() && !bookmarks.first().has('width')) {
textCalc.calcTextList(bookmarks.toList())
list = bookmarks.toList()
}

const bookmarkFolders = bookmarkFoldersState.getFolders(state)
if (bookmarkFolders.first() && !bookmarkFolders.first().has('width')) {
textCalc.calcTextList(bookmarkFolders.toList())
list = list.concat(bookmarkFolders.toList())
}

if (!list.isEmpty()) {
textCalc.calcTextList(list)
}
}
break
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ describe('bookmarkToolbarReducer unit test', function () {
bookmarkToolbarReducer(stateWithData, {
actionType: appConstants.APP_SET_STATE
})
assert.equal(spyCalc.callCount, 2)
assert.equal(spyCalc.callCount, 1)
})

it('we are on version 0.21', function () {
Expand Down

0 comments on commit bcd2de6

Please sign in to comment.