Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/mail.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Kesselberg <mail@danielkesselberg.de>2022-09-20 13:50:39 +0300
committerDaniel Kesselberg <mail@danielkesselberg.de>2022-09-20 19:05:17 +0300
commit2b5a8f2cdabc9bfca318c84b26032c35accb7e91 (patch)
treed29abd4cfdeca007472e247be88c666d53dde92f
parentf23ea1e5fb2df91bc0cf3ab0fb8e96d0f6420f3a (diff)
GH-7143: Show warning for large signatures
A large signature can affect the editor performance. Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
-rw-r--r--src/components/SignatureSettings.vue9
-rw-r--r--src/tests/unit/components/SignatureSettings.vue.spec.js48
2 files changed, 57 insertions, 0 deletions
diff --git a/src/components/SignatureSettings.vue b/src/components/SignatureSettings.vue
index c945db864..c414ff7f9 100644
--- a/src/components/SignatureSettings.vue
+++ b/src/components/SignatureSettings.vue
@@ -45,6 +45,9 @@
:html="true"
:placeholder="t('mail', 'Signature …')"
:bus="bus" />
+ <p v-if="isLargeSignature" class="warning-large-signature">
+ {{ t('mail', 'Your signature is larger than 2 MB. This may affect the performance of your editor.')}}
+ </p>
<ButtonVue
type="primary"
:disabled="loading"
@@ -115,6 +118,9 @@ export default {
return identities
},
+ isLargeSignature() {
+ return (new Blob([this.signature])).size > 2 * 1024 * 1024
+ }
},
watch: {
async signatureAboveQuote(val, oldVal) {
@@ -223,4 +229,7 @@ export default {
display: inline-block !important;
margin-top: 4px !important;
}
+.warning-large-signature {
+ color: darkorange;
+}
</style>
diff --git a/src/tests/unit/components/SignatureSettings.vue.spec.js b/src/tests/unit/components/SignatureSettings.vue.spec.js
new file mode 100644
index 000000000..f8e8ce8d8
--- /dev/null
+++ b/src/tests/unit/components/SignatureSettings.vue.spec.js
@@ -0,0 +1,48 @@
+/*
+ * @copyright 2022 Daniel Kesselberg <mail@danielkesselberg.de>
+ *
+ * @author 2022 Daniel Kesselberg <mail@danielkesselberg.de>
+ *
+ * @license AGPL-3.0-or-later
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+import {createLocalVue, shallowMount} from '@vue/test-utils'
+import Vuex from 'vuex'
+import Nextcloud from '../../../mixins/Nextcloud'
+import SignatureSettings from '../../../components/SignatureSettings'
+
+const localVue = createLocalVue()
+
+localVue.use(Vuex)
+localVue.mixin(Nextcloud)
+
+describe('SignatureSettings', () => {
+
+ it('Show warning for large signatures', () => {
+ const wrapper = shallowMount(SignatureSettings, {
+ localVue,
+ propsData: {
+ account: {
+ aliases: [],
+ signature: String('<p>Lorem ipsum</p>').repeat(120000),
+ },
+ },
+ })
+
+ expect(wrapper.vm.isLargeSignature).toBeTruthy()
+ })
+
+})