From ff049c3f8565054c8d01411f2020ff2826da4604 Mon Sep 17 00:00:00 2001 From: yan Date: Thu, 1 Jun 2017 17:58:55 -0700 Subject: [PATCH] Add hideInToolbar field to api.proto bookmarks needed for https://github.com/brave/browser-laptop/issues/8024 --- lib/api.proto | 7 ++++--- lib/api.proto.js | 19 +++++++++++++++++++ test/client/recordUtil.js | 7 +++++-- 3 files changed, 28 insertions(+), 5 deletions(-) diff --git a/lib/api.proto b/lib/api.proto index f4af054..0e9fe9b 100644 --- a/lib/api.proto +++ b/lib/api.proto @@ -44,9 +44,10 @@ message SyncRecord { Site site = 1; bool isFolder = 2; bytes parentFolderObjectId = 3; - bytes previousObjectId = 4; - bytes nextObjectId = 5; - repeated string fields = 6; + bytes previousObjectId = 4; // unused + bytes nextObjectId = 5; // unused + repeated string fields = 6; // unused + bool hideInToolbar = 7; } message SiteSetting { string hostPattern = 1; diff --git a/lib/api.proto.js b/lib/api.proto.js index 46991da..3114dfc 100644 --- a/lib/api.proto.js +++ b/lib/api.proto.js @@ -1610,6 +1610,12 @@ */ Bookmark.prototype.fields = $util.emptyArray; + /** + * Bookmark hideInToolbar. + * @type {boolean|undefined} + */ + Bookmark.prototype.hideInToolbar = false; + // Lazily resolved type references var $types = { 0: "api.SyncRecord.Site" @@ -1646,6 +1652,8 @@ if (message.fields !== undefined && message.hasOwnProperty("fields")) for (var i = 0; i < message.fields.length; ++i) writer.uint32(/* id 6, wireType 2 =*/50).string(message.fields[i]); + if (message.hideInToolbar !== undefined && message.hasOwnProperty("hideInToolbar")) + writer.uint32(/* id 7, wireType 0 =*/56).bool(message.hideInToolbar); return writer; }; @@ -1692,6 +1700,9 @@ message.fields = []; message.fields.push(reader.string()); break; + case 7: + message.hideInToolbar = reader.bool(); + break; default: reader.skipType(tag & 7); break; @@ -1743,6 +1754,9 @@ if (!$util.isString(message.fields[i])) return "fields: string[] expected"; } + if (message.hideInToolbar !== undefined) + if (typeof message.hideInToolbar !== "boolean") + return "hideInToolbar: boolean expected"; return null; }; @@ -1784,6 +1798,8 @@ for (var i = 0; i < object.fields.length; ++i) message.fields[i] = String(object.fields[i]); } + if (object.hideInToolbar !== undefined && object.hideInToolbar !== null) + message.hideInToolbar = Boolean(object.hideInToolbar); return message; }; @@ -1814,6 +1830,7 @@ object.parentFolderObjectId = options.bytes === String ? "" : []; object.previousObjectId = options.bytes === String ? "" : []; object.nextObjectId = options.bytes === String ? "" : []; + object.hideInToolbar = false; } if (message.site !== undefined && message.site !== null && message.hasOwnProperty("site")) object.site = $types[0].toObject(message.site, options); @@ -1830,6 +1847,8 @@ for (var j = 0; j < message.fields.length; ++j) object.fields[j] = message.fields[j]; } + if (message.hideInToolbar !== undefined && message.hideInToolbar !== null && message.hasOwnProperty("hideInToolbar")) + object.hideInToolbar = message.hideInToolbar; return object; }; diff --git a/test/client/recordUtil.js b/test/client/recordUtil.js index 9990a68..88a7104 100644 --- a/test/client/recordUtil.js +++ b/test/client/recordUtil.js @@ -32,6 +32,7 @@ const siteProps = { const props = { bookmark: { isFolder: false, + hideInToolbar: true, site: siteProps }, historySite: siteProps, @@ -293,7 +294,8 @@ test('recordUtil.resolve', (t) => { creationTime: time, favicon: '' }, - isFolder: false + isFolder: false, + hideInToolbar: false }, objectData: 'bookmark' } @@ -406,7 +408,8 @@ test('recordUtil.syncRecordAsJS()', (t) => { const bookmark = serializer.api.SyncRecord.Bookmark.create({ site, isFolder: false, - parentFolderObjectId: testHelper.newUuid() + parentFolderObjectId: testHelper.newUuid(), + hideInToolbar: true }) conversionEquals({ objectData: 'bookmark', bookmark })