From 7cf52a1c1a22e69a3e9a82fa447f7271206a893e Mon Sep 17 00:00:00 2001 From: Weblate Date: Fri, 3 Sep 2021 21:29:15 +0200 Subject: [PATCH 1/6] Translated using Weblate (English) Currently translated at 100.0% (1423 of 1423 strings) Translation: CryptPad/App Translate-URL: http://weblate.cryptpad.fr/projects/cryptpad/app/en/ Translated using Weblate (English) Currently translated at 100.0% (1422 of 1422 strings) Translation: CryptPad/App Translate-URL: http://weblate.cryptpad.fr/projects/cryptpad/app/en/ Translated using Weblate (English) Currently translated at 100.0% (1421 of 1421 strings) Translation: CryptPad/App Translate-URL: http://weblate.cryptpad.fr/projects/cryptpad/app/en/ Translated using Weblate (English) Currently translated at 100.0% (1420 of 1420 strings) Translation: CryptPad/App Translate-URL: http://weblate.cryptpad.fr/projects/cryptpad/app/en/ Translated using Weblate (English) Currently translated at 100.0% (1419 of 1419 strings) Translation: CryptPad/App Translate-URL: http://weblate.cryptpad.fr/projects/cryptpad/app/en/ Translated using Weblate (English) Currently translated at 100.0% (1418 of 1418 strings) Translation: CryptPad/App Translate-URL: http://weblate.cryptpad.fr/projects/cryptpad/app/en/ Translated using Weblate (English) Currently translated at 100.0% (1417 of 1417 strings) Translation: CryptPad/App Translate-URL: http://weblate.cryptpad.fr/projects/cryptpad/app/en/ Translated using Weblate (English) Currently translated at 100.0% (1416 of 1416 strings) Translation: CryptPad/App Translate-URL: http://weblate.cryptpad.fr/projects/cryptpad/app/en/ Translated using Weblate (English) Currently translated at 100.0% (1415 of 1415 strings) Translation: CryptPad/App Translate-URL: http://weblate.cryptpad.fr/projects/cryptpad/app/en/ Translated using Weblate (English) Currently translated at 100.0% (1414 of 1414 strings) Translation: CryptPad/App Translate-URL: http://weblate.cryptpad.fr/projects/cryptpad/app/en/ Translated using Weblate (English) Currently translated at 100.0% (1413 of 1413 strings) Translation: CryptPad/App Translate-URL: http://weblate.cryptpad.fr/projects/cryptpad/app/en/ Translated using Weblate (English) Currently translated at 100.0% (1412 of 1412 strings) Translation: CryptPad/App Translate-URL: http://weblate.cryptpad.fr/projects/cryptpad/app/en/ Translated using Weblate (English) Currently translated at 100.0% (1411 of 1411 strings) Translation: CryptPad/App Translate-URL: http://weblate.cryptpad.fr/projects/cryptpad/app/en/ Translated using Weblate (English) Currently translated at 100.0% (1410 of 1410 strings) Translation: CryptPad/App Translate-URL: http://weblate.cryptpad.fr/projects/cryptpad/app/en/ Translated using Weblate (English) Currently translated at 100.0% (1409 of 1409 strings) Translation: CryptPad/App Translate-URL: http://weblate.cryptpad.fr/projects/cryptpad/app/en/ Translated using Weblate (English) Currently translated at 100.0% (1408 of 1408 strings) Translation: CryptPad/App Translate-URL: http://weblate.cryptpad.fr/projects/cryptpad/app/en/ Translated using Weblate (English) Currently translated at 100.0% (1407 of 1407 strings) Translation: CryptPad/App Translate-URL: http://weblate.cryptpad.fr/projects/cryptpad/app/en/ Translated using Weblate (English) Currently translated at 100.0% (1406 of 1406 strings) Translation: CryptPad/App Translate-URL: http://weblate.cryptpad.fr/projects/cryptpad/app/en/ Translated using Weblate (English) Currently translated at 100.0% (1406 of 1406 strings) Translation: CryptPad/App Translate-URL: http://weblate.cryptpad.fr/projects/cryptpad/app/en/ Translated using Weblate (English) Currently translated at 100.0% (1405 of 1405 strings) Translation: CryptPad/App Translate-URL: http://weblate.cryptpad.fr/projects/cryptpad/app/en/ Translated using Weblate (English) Currently translated at 100.0% (1405 of 1405 strings) Translation: CryptPad/App Translate-URL: http://weblate.cryptpad.fr/projects/cryptpad/app/en/ Translated using Weblate (English) Currently translated at 100.0% (1404 of 1404 strings) Translation: CryptPad/App Translate-URL: http://weblate.cryptpad.fr/projects/cryptpad/app/en/ Translated using Weblate (English) Currently translated at 100.0% (1404 of 1404 strings) Translation: CryptPad/App Translate-URL: http://weblate.cryptpad.fr/projects/cryptpad/app/en/ Translated using Weblate (English) Currently translated at 100.0% (1403 of 1403 strings) Translation: CryptPad/App Translate-URL: http://weblate.cryptpad.fr/projects/cryptpad/app/en/ Translated using Weblate (English) Currently translated at 100.0% (1402 of 1402 strings) Translation: CryptPad/App Translate-URL: http://weblate.cryptpad.fr/projects/cryptpad/app/en/ Translated using Weblate (English) Currently translated at 100.0% (1401 of 1401 strings) Translation: CryptPad/App Translate-URL: http://weblate.cryptpad.fr/projects/cryptpad/app/en/ Translated using Weblate (English) Currently translated at 100.0% (1400 of 1400 strings) Translation: CryptPad/App Translate-URL: http://weblate.cryptpad.fr/projects/cryptpad/app/en/ Translated using Weblate (English) Currently translated at 100.0% (1399 of 1399 strings) Translation: CryptPad/App Translate-URL: http://weblate.cryptpad.fr/projects/cryptpad/app/en/ Translated using Weblate (English) Currently translated at 100.0% (1398 of 1398 strings) Translation: CryptPad/App Translate-URL: http://weblate.cryptpad.fr/projects/cryptpad/app/en/ Translated using Weblate (English) Currently translated at 100.0% (1397 of 1397 strings) Translation: CryptPad/App Translate-URL: http://weblate.cryptpad.fr/projects/cryptpad/app/en/ Translated using Weblate (English) Currently translated at 100.0% (1396 of 1396 strings) Translation: CryptPad/App Translate-URL: http://weblate.cryptpad.fr/projects/cryptpad/app/en/ Translated using Weblate (English) Currently translated at 100.0% (1395 of 1395 strings) Translation: CryptPad/App Translate-URL: http://weblate.cryptpad.fr/projects/cryptpad/app/en/ Translated using Weblate (English) Currently translated at 100.0% (1394 of 1394 strings) Translation: CryptPad/App Translate-URL: http://weblate.cryptpad.fr/projects/cryptpad/app/en/ Translated using Weblate (English) Currently translated at 100.0% (1393 of 1393 strings) Translation: CryptPad/App Translate-URL: http://weblate.cryptpad.fr/projects/cryptpad/app/en/ Translated using Weblate (English) Currently translated at 100.0% (1392 of 1392 strings) Translation: CryptPad/App Translate-URL: http://weblate.cryptpad.fr/projects/cryptpad/app/en/ Translated using Weblate (English) Currently translated at 100.0% (1391 of 1391 strings) Translation: CryptPad/App Translate-URL: http://weblate.cryptpad.fr/projects/cryptpad/app/en/ Translated using Weblate (English) Currently translated at 100.0% (1390 of 1390 strings) Translation: CryptPad/App Translate-URL: http://weblate.cryptpad.fr/projects/cryptpad/app/en/ Translated using Weblate (English) Currently translated at 100.0% (1389 of 1389 strings) Translation: CryptPad/App Translate-URL: http://weblate.cryptpad.fr/projects/cryptpad/app/en/ Translated using Weblate (English) Currently translated at 100.0% (1388 of 1388 strings) Translation: CryptPad/App Translate-URL: http://weblate.cryptpad.fr/projects/cryptpad/app/en/ Translated using Weblate (English) Currently translated at 100.0% (1387 of 1387 strings) Translation: CryptPad/App Translate-URL: http://weblate.cryptpad.fr/projects/cryptpad/app/en/ Translated using Weblate (English) Currently translated at 100.0% (1386 of 1386 strings) Translation: CryptPad/App Translate-URL: http://weblate.cryptpad.fr/projects/cryptpad/app/en/ Translated using Weblate (English) Currently translated at 100.0% (1385 of 1385 strings) Translation: CryptPad/App Translate-URL: http://weblate.cryptpad.fr/projects/cryptpad/app/en/ Translated using Weblate (English) Currently translated at 100.0% (1384 of 1384 strings) Translation: CryptPad/App Translate-URL: http://weblate.cryptpad.fr/projects/cryptpad/app/en/ --- www/common/translations/messages.json | 55 +++++++++++++++++++++++---- 1 file changed, 47 insertions(+), 8 deletions(-) diff --git a/www/common/translations/messages.json b/www/common/translations/messages.json index 1cb85b4f1..67894897f 100644 --- a/www/common/translations/messages.json +++ b/www/common/translations/messages.json @@ -92,7 +92,7 @@ "shareSuccess": "Copied link to clipboard", "userListButton": "User list", "chatButton": "Chat", - "userAccountButton": "Your account", + "userAccountButton": "User menu", "newButton": "New", "newButtonTitle": "Create a new pad", "uploadButton": "Upload files", @@ -579,7 +579,7 @@ "creation_expireDays": "Day(s)", "creation_expireMonths": "Month(s)", "creation_password": "Password\n", - "creation_noTemplate": "No template", + "creation_noTemplate": "Blank document", "creation_newTemplate": "New template", "creation_create": "Create", "creation_owners": "Owners", @@ -606,8 +606,8 @@ "share_linkView": "View", "share_linkEmbed": "Embed mode (hide toolbar and user list)", "share_linkPresent": "Present", - "share_linkOpen": "Preview", - "share_linkCopy": "Copy", + "share_linkOpen": "Open link", + "share_linkCopy": "Copy link", "share_contactCategory": "Contacts", "share_embedCategory": "Embed", "share_mediatagCopy": "Copy mediatag to clipboard", @@ -1284,7 +1284,7 @@ "form_updateWarning": "Update anyway", "form_cantFindAnswers": "Unable to retrieve your existing answers for this form.", "form_answered": "You have already answered this form", - "form_results": "Responses", + "form_results": "Responses ({0})", "form_results_empty": "There are no responses", "form_editor": "Editor", "form_form": "Form", @@ -1301,7 +1301,7 @@ "form_invalidWarning": "There are errors in some answers:", "form_invalidQuestion": "Question {0}", "form_makePublic": "Publish responses", - "form_makePublicWarning": "Are you sure you want to make responses to this form public? This cannot be undone.", + "form_makePublicWarning": "Are you sure you want to make responses to this form public? Past and future responses will be visible by participants. This cannot be undone.", "form_isPublic": "Responses are public", "form_isPrivate": "Responses are private", "form_open": "Open", @@ -1310,7 +1310,7 @@ "form_isOpen": "This form is open", "form_isClosed": "This form was closed on {0}", "form_willClose": "This form will close on {0}", - "form_anonymous": "Anonymous answers", + "form_anonymous": "Guest access (not logged in)", "form_anonymous_on": "Allowed", "form_anonymous_off": "Blocked", "form_defaultOption": "Option {0}", @@ -1384,5 +1384,44 @@ "ui_expand": "Expand", "form_totalResponses": "Total responses: {0}", "support_premiumPriority": "Premium users help support improvements to CryptPad's usability and benefit from prioritized responses to their support tickets.", - "support_premiumLink": "View subscription options" + "support_premiumLink": "View subscription options", + "toolbar_collapse": "Collapse toolbar", + "toolbar_expand": "Expand toolbar", + "profile_defaultAlt": "Default profile picture", + "upload_modal_alt": "Alt text", + "upload_addOptionalAlt": "Add descriptive text (optional)", + "form_template_poll": "Quick Poll", + "form_preview_button": "Preview", + "form_alreadyAnswered": "You responded to this form on {0}", + "form_editAnswer": "Edit my responses", + "form_viewAnswer": "View my responses", + "form_viewAllAnswers": "View all responses ({0})", + "form_anonAnswer": "Responses to this form are anonymized", + "form_authAnswer": "This form cannot be submitted anonymously", + "form_requiredWarning": "The following questions require an answer:", + "form_required_answer": "Answer: ", + "form_required_on": "Required", + "form_required_off": "Optional", + "form_preview": "Preview form", + "form_changeTypeConfirm": "Select the new question type.", + "form_corruptAnswers": "This form already has responses. Changing this question type may invalidate previous response data.", + "form_geturl": "Copy link", + "toolbar_preview": "Preview", + "form_updateMsg": "Update submit message", + "form_addMsg": "Add submit message", + "form_responseMsg": "This message will be displayed after participants submit the form.", + "form_makeAnon": "Anonymize responses", + "form_editable": "Editing after submission", + "form_type_section": "Conditional section", + "form_condition_q": "Choose a question", + "form_condition_v": "Choose a value", + "form_condition_is": "is", + "form_condition_isnot": "is not", + "form_condition_has": "has", + "form_condition_hasnot": "has not", + "form_conditional": "Only show this section when:", + "form_conditional_add": "Add OR condition", + "form_conditional_addAnd": "Add AND condition\n", + "userlist_visitProfile": "Visit profile", + "form_colors": "Color theme" } From a5c55f1f494461d92092897cb03ed8d59640bb77 Mon Sep 17 00:00:00 2001 From: Weblate Date: Fri, 3 Sep 2021 21:29:15 +0200 Subject: [PATCH 2/6] Translated using Weblate (Japanese) Currently translated at 98.9% (1390 of 1405 strings) Translation: CryptPad/App Translate-URL: http://weblate.cryptpad.fr/projects/cryptpad/app/ja/ Translated using Weblate (Japanese) Currently translated at 99.8% (1384 of 1386 strings) Translation: CryptPad/App Translate-URL: http://weblate.cryptpad.fr/projects/cryptpad/app/ja/ Translated using Weblate (Japanese) Currently translated at 99.8% (1383 of 1385 strings) Translation: CryptPad/App Translate-URL: http://weblate.cryptpad.fr/projects/cryptpad/app/ja/ --- www/common/translations/messages.ja.json | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/www/common/translations/messages.ja.json b/www/common/translations/messages.ja.json index 656239dec..25323cfa3 100644 --- a/www/common/translations/messages.ja.json +++ b/www/common/translations/messages.ja.json @@ -525,7 +525,7 @@ "crowdfunding_popup_no": "あとで", "sharedFolders_create_name": "フォルダ名", "creation_newTemplate": "新しいテンプレート", - "creation_noTemplate": "テンプレートがありません", + "creation_noTemplate": "空のドキュメント", "creation_expire": "期限切れのパッド", "mdToolbar_list": "箇条書き", "uploadFolder_modal_filesPassword": "ファイルのパスワード", @@ -746,7 +746,7 @@ "saveTemplatePrompt": "テンプレートのタイトルを入力してください", "newButtonTitle": "新しいパッドを作成", "newButton": "新規", - "userAccountButton": "アカウント", + "userAccountButton": "メニュー", "userListButton": "ユーザーリスト", "movedToTrash": "パッドをゴミ箱に移動しました。
ドライブにアクセス", "forgetPrompt": "OKをクリックするとパッドをゴミ箱へと移動します。よろしいですか?", @@ -905,7 +905,7 @@ "form_showSummary": "概要を表示", "form_showIndividual": "個々の回答を表示", "form_results_empty": "回答がありません", - "form_results": "回答", + "form_results": "回答({0})", "form_answered": "このフォームは回答済みです", "form_cantFindAnswers": "このフォームの既存の回答を取得できません。", "form_duplicates": "重複する項目が削除されました", @@ -1384,5 +1384,14 @@ "ui_expand": "広げる", "ui_collapse": "折りたたむ", "support_premiumPriority": "プレミアムユーザーになると、CryptPadの使い勝手を改良する手助けができるほか、サポートチケットに対する優先サポートを受けることができます。", - "support_premiumLink": "定額利用のオプションを表示" + "support_premiumLink": "定額利用のオプションを表示", + "toolbar_collapse": "ツールバーをたたむ", + "toolbar_expand": "ツールバーを広げる", + "form_preview": "フォームをプレビュー", + "form_geturl": "リンクをコピー", + "form_viewAnswer": "回答を表示", + "form_editAnswer": "回答を編集", + "form_preview_button": "プレビュー", + "upload_addOptionalAlt": "説明文を追加(任意)", + "upload_modal_alt": "代替テキスト" } From 013969569787fe800a567905766c13b3c5c05ece Mon Sep 17 00:00:00 2001 From: yflory Date: Mon, 6 Sep 2021 12:41:10 +0200 Subject: [PATCH 3/6] Prepare forms for future update --- www/form/inner.js | 47 ++++++++++++++++++++++++++++------------------- 1 file changed, 28 insertions(+), 19 deletions(-) diff --git a/www/form/inner.js b/www/form/inner.js index 089db8b57..75fe1db3c 100644 --- a/www/form/inner.js +++ b/www/form/inner.js @@ -82,6 +82,14 @@ define([ var MAX_OPTIONS = 15; var MAX_ITEMS = 10; + var extractValues = function (values) { + if (!Array.isArray(values)) { return []; } + return values.map(function (obj) { + if (typeof(obj) === "string") { return obj; } + return obj.v; + }); + }; + var saveAndCancelOptions = function (getRes, cb) { // Cancel changes var cancelBlock = h('button.btn.btn-secondary', Messages.cancel); @@ -313,7 +321,8 @@ define([ }); return el; }; - var inputs = v.values.map(function (val) { return getOption(val, false); }); + // TODO uid + var inputs = extractValues(v.values).map(function (val) { return getOption(val, false); }); inputs.push(add); var container = h('div.cp-form-edit-block', inputs); @@ -346,7 +355,7 @@ define([ if (v.type) { var calendarInput = h('input'); calendarView = h('div', calendarInput); - var calendarDefault = v.type === "day" ? v.values.map(function (time) { + var calendarDefault = v.type === "day" ? extractValues(v.values).map(function (time) { if (!time) { return; } var d = new Date(time); if (!isNaN(d)) { return d; } @@ -597,13 +606,13 @@ define([ var makePollTable = function (answers, opts, resultsPageObj) { // Sort date values if (opts.type !== "text") { - opts.values.sort(function (a, b) { + extractValues(opts.values).sort(function (a, b) { // TODO uid return +new Date(a) - +new Date(b); }); } // Create first line with options var allDays = getWeekDays(true); - var els = opts.values.map(function (data) { + var els = extractValues(opts.values).map(function (data) { // TODO uid var _date; if (opts.type === "day") { _date = new Date(data); @@ -634,7 +643,7 @@ define([ if (opts.type === "time") { var days = [h('div.cp-poll-cell')]; var _days = {}; - opts.values.forEach(function (d) { + extractValues(opts.values).forEach(function (d) { var date = new Date(d); var day = date.toLocaleDateString(); _days[day] = { @@ -665,7 +674,7 @@ define([ var avatar = h('span.cp-avatar'); APP.common.displayAvatar($(avatar), Util.find(answerObj, ['user', 'avatar']), name); var values = answer.values || {}; - var els = opts.values.map(function (data) { + var els = extractValues(opts.values).map(function (data) { var res = values[data] || 0; var v = (Number(res) === 1) ? h('i.fa.fa-check.cp-yes') : undefined; var cell = h('div.cp-poll-cell.cp-form-poll-answer', { @@ -703,7 +712,7 @@ define([ var myTotals = {}; var updateMyTotals = function () { if (!myLine) { return; } - opts.values.forEach(function (data) { + extractValues(opts.values).forEach(function (data) { myLine.some(function (el) { if ($(el).data('option') !== data) { return; } var res = Number($(el).attr('data-value')) || 0; @@ -726,7 +735,7 @@ define([ }); }; - var totalEls = opts.values.map(function (data) { + var totalEls = extractValues(opts.values).map(function (data) { var y = 0; // Yes var m = 0; // Maybe answers.forEach(function (answerObj) { @@ -1122,7 +1131,7 @@ define([ if (!opts) { opts = TYPES.radio.defaultOpts; } if (!Array.isArray(opts.values)) { return; } var name = Util.uid(); - var els = opts.values.map(function (data, i) { + var els = extractValues(opts.values).map(function (data, i) { var radio = UI.createRadio(name, 'cp-form-'+name+'-'+i, data, false, { mark: { tabindex:1 } }); $(radio).find('input').data('val', data); @@ -1201,7 +1210,7 @@ define([ var lines = opts.items.map(function (itemData) { var name = itemData.uid; var item = itemData.v; - var els = opts.values.map(function (data, i) { + var els = extractValues(opts.values).map(function (data, i) { var radio = UI.createRadio(name, 'cp-form-'+name+'-'+i, '', false, { mark: { tabindex:1 } }); $(radio).find('input').data('uid', name); @@ -1211,7 +1220,7 @@ define([ els.unshift(h('div.cp-form-multiradio-item', item)); return h('div.radio-group', {'data-uid':name}, els); }); - var header = opts.values.map(function (v) { return h('span', v); }); + var header = extractValues(opts.values).map(function (v) { return h('span', v); }); header.unshift(h('span')); lines.unshift(h('div.cp-form-multiradio-header', header)); @@ -1353,7 +1362,7 @@ define([ if (!opts) { opts = TYPES.checkbox.defaultOpts; } if (!Array.isArray(opts.values)) { return; } var name = Util.uid(); - var els = opts.values.map(function (data, i) { + var els = extractValues(opts.values).map(function (data, i) { var cbox = UI.createCheckbox('cp-form-'+name+'-'+i, data, false, { mark: { tabindex:1 } }); $(cbox).find('input').data('val', data); @@ -1444,7 +1453,7 @@ define([ var lines = opts.items.map(function (itemData) { var name = itemData.uid; var item = itemData.v; - var els = opts.values.map(function (data, i) { + var els = extractValues(opts.values).map(function (data, i) { var cbox = UI.createCheckbox('cp-form-'+name+'-'+i, '', false, { mark: { tabindex:1 } }); $(cbox).find('input').data('uid', name); @@ -1467,7 +1476,7 @@ define([ }); }); - var header = opts.values.map(function (v) { return h('span', v); }); + var header = extractValues(opts.values).map(function (v) { return h('span', v); }); header.unshift(h('span')); lines.unshift(h('div.cp-form-multiradio-header', header)); @@ -1616,7 +1625,7 @@ define([ */ Util.shuffleArray(opts.values); } - var els = opts.values.map(function (data) { + var els = extractValues(opts.values).map(function (data) { var uid = Util.uid(); map[uid] = data; invMap[data] = uid; @@ -1670,7 +1679,7 @@ define([ }, reset: function () { Util.shuffleArray(opts.values); - var toSort = (opts.values).map(function (val) { + var toSort = extractValues(opts.values).map(function (val) { return invMap[val]; }); sortable.sort(toSort); @@ -1728,7 +1737,7 @@ define([ var lines = makePollTable(answers, opts, false); // Add form - var addLine = opts.values.map(function (data) { + var addLine = extractValues(opts.values).map(function (data) { var cell = h('div.cp-poll-cell.cp-form-poll-choice', [ h('i.fa.fa-times.cp-no'), h('i.fa.fa-check.cp-yes'), @@ -1829,7 +1838,7 @@ define([ var opts = form.opts || TYPES.poll.defaultOpts; var q = form.q || Messages.form_default; if (answer === false) { - var cols = opts.values.map(function (key) { + var cols = extractValues(opts.values).map(function (key) { return q + ' | ' + key; }); cols.unshift(q); @@ -1845,7 +1854,7 @@ define([ if (i !== 0) { str += ';'; } str += k.replace(';', '').replace(':', '') + ':' + answer.values[k]; }); - var res = opts.values.map(function (key) { + var res = extractValues(opts.values).map(function (key) { return answer.values[key] || ''; }); res.unshift(str); From f28987bce5aaf2bddec9ec3d682482fac8234562 Mon Sep 17 00:00:00 2001 From: yflory Date: Mon, 6 Sep 2021 13:34:34 +0200 Subject: [PATCH 4/6] Prepare for forms migration --- www/form/inner.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/www/form/inner.js b/www/form/inner.js index 75fe1db3c..6e70260c7 100644 --- a/www/form/inner.js +++ b/www/form/inner.js @@ -85,7 +85,7 @@ define([ var extractValues = function (values) { if (!Array.isArray(values)) { return []; } return values.map(function (obj) { - if (typeof(obj) === "string") { return obj; } + if (!Util.isObject(obj)) { return obj; } return obj.v; }); }; From 86ff13a4efbf10b9f995b2771610d114c5a72985 Mon Sep 17 00:00:00 2001 From: ansuz Date: Fri, 20 Aug 2021 17:47:54 +0530 Subject: [PATCH 5/6] factor debugging data generation from support ticket transmission and fix two incorrectly set width/height properties which overwrote 'appVersion' --- www/support/ui.js | 38 +++++++++++++++++++++++++++----------- 1 file changed, 27 insertions(+), 11 deletions(-) diff --git a/www/support/ui.js b/www/support/ui.js index fac6ef438..2f97ec412 100644 --- a/www/support/ui.js +++ b/www/support/ui.js @@ -10,14 +10,12 @@ define([ '/customize/messages.js', ], function ($, ApiConfig, h, UI, Hash, Util, Clipboard, UIElements, Messages) { - var send = function (ctx, id, type, data, dest) { + var getDebuggingData = function (ctx, data) { var common = ctx.common; - var supportKey = ApiConfig.supportMailbox; - var supportChannel = Hash.getChannelIdFromKey(supportKey); var metadataMgr = common.getMetadataMgr(); - var user = metadataMgr.getUserData(); var privateData = metadataMgr.getPrivateData(); - + var user = metadataMgr.getUserData(); + var teams = privateData.teams || {}; data = data || {}; data.sender = { @@ -34,16 +32,12 @@ define([ data.sender.quota = ctx.pinUsage; } - data.id = id; - data.time = +new Date(); - - var teams = privateData.teams || {}; if (!ctx.isAdmin) { data.sender.userAgent = Util.find(window, ['navigator', 'userAgent']); data.sender.vendor = Util.find(window, ['navigator', 'vendor']); data.sender.appVersion = Util.find(window, ['navigator', 'appVersion']); - data.sender.appVersion = Util.find(window, ['screen', 'width']); - data.sender.appVersion = Util.find(window, ['screen', 'height']); + data.sender.screenWidth = Util.find(window, ['screen', 'width']); + data.sender.screenHeight = Util.find(window, ['screen', 'height']); data.sender.blockLocation = privateData.blockLocation || ''; data.sender.teams = Object.keys(teams).map(function (key) { var team = teams[key]; @@ -57,7 +51,25 @@ define([ } return ret; }).filter(Boolean); + } + return data; + }; + + var send = function (ctx, id, type, data, dest) { + var common = ctx.common; + var supportKey = ApiConfig.supportMailbox; + var supportChannel = Hash.getChannelIdFromKey(supportKey); + var metadataMgr = common.getMetadataMgr(); + var user = metadataMgr.getUserData(); + var privateData = metadataMgr.getPrivateData(); + + data = getDebuggingData(ctx, data); + + data.id = id; + data.time = +new Date(); + + if (!ctx.isAdmin) { // "dest" is the recipient that is not the admin support mailbox. // In the support page, make sure dest is always ourselves. dest.channel = privateData.support; @@ -474,6 +486,10 @@ define([ ui.makeCloseMessage = function (content, hash) { return makeCloseMessage(ctx, content, hash); }; + ui.getDebuggingData = function (data) { + return getDebuggingData(ctx, data); + }; + return ui; }; From aad654e18410f689f86d034d8e74be1d20c0d1e6 Mon Sep 17 00:00:00 2001 From: yflory Date: Fri, 20 Aug 2021 11:29:16 +0200 Subject: [PATCH 6/6] Fix calendar .ics import (#784) --- www/calendar/export.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/www/calendar/export.js b/www/calendar/export.js index 64775762b..5967e2027 100644 --- a/www/calendar/export.js +++ b/www/calendar/export.js @@ -123,6 +123,7 @@ define([ var jcalData = ICAL.parse(content); vcalendar = new ICAL.Component(jcalData); } catch (e) { + console.error(e); return void cb(e); } @@ -147,6 +148,18 @@ define([ var isAllDay = false; var start = ev.getFirstPropertyValue('dtstart'); var end = ev.getFirstPropertyValue('dtend'); + var duration = ev.getFirstPropertyValue('duration'); + if (!end && !duration) { + if (start.isDate) { + end = start.clone(); + end.adjust(1); // Add one day + } else { + end = start.clone(); + } + } else if (!end) { + end = start.clone(); + end.addDuration(duration); + } if (start.isDate && end.isDate) { isAllDay = true; start = String(start); @@ -175,7 +188,7 @@ define([ hidden.push(al.toString()); } var trigger = al.getFirstPropertyValue('trigger'); - var minutes = -trigger.toSeconds() / 60; + var minutes = trigger ? (-trigger.toSeconds() / 60) : 0; if (reminders.indexOf(minutes) === -1) { reminders.push(minutes); } });