From 252b2729a6c9a3f568da5e485dec123d48eeb95a Mon Sep 17 00:00:00 2001 From: ansuz Date: Fri, 27 Sep 2019 13:20:53 +0200 Subject: [PATCH] supply plan information with support ticket submissions --- www/support/inner.js | 6 +++++- www/support/ui.js | 11 ++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/www/support/inner.js b/www/support/inner.js index ded97b272..701d01817 100644 --- a/www/support/inner.js +++ b/www/support/inner.js @@ -236,6 +236,10 @@ define([ APP.$rightside = $('
', {id: 'cp-sidebarlayout-rightside'}).appendTo(APP.$container); var sFrameChan = common.getSframeChannel(); sFrameChan.onReady(waitFor()); + common.getPinUsage(null, waitFor(function (err, data) { + if (err) { return void console.error(err); } + APP.pinUsage = data; + })); }).nThen(function (/*waitFor*/) { createToolbar(); metadataMgr = common.getMetadataMgr(); @@ -244,7 +248,7 @@ define([ APP.origin = privateData.origin; APP.readOnly = privateData.readOnly; - APP.support = Support.create(common, false); + APP.support = Support.create(common, false, APP.pinUsage); // Content var $rightside = APP.$rightside; diff --git a/www/support/ui.js b/www/support/ui.js index 6b0ffdcbe..ca707c413 100644 --- a/www/support/ui.js +++ b/www/support/ui.js @@ -25,6 +25,14 @@ define([ edPublic: privateData.edPublic, notifications: user.notifications, }; + + if (typeof(ctx.pinUsage) === 'object') { + // pass pin.usage, pin.limit, and pin.plan if supplied + Object.keys(ctx.pinUsage).forEach(function (k) { + data.sender[k] = ctx.pinUsage[k]; + }); + } + data.id = id; data.time = +new Date(); @@ -202,11 +210,12 @@ define([ ]); }; - var create = function (common, isAdmin) { + var create = function (common, isAdmin, pinUsage) { var ui = {}; var ctx = { common: common, isAdmin: isAdmin + pinUsage: pinUsage || false, }; ui.sendForm = function (id, form, dest) {