From c0fc1fee1e80226829fd8f55ad1f4e13d8908107 Mon Sep 17 00:00:00 2001 From: Tyler Chen Date: Wed, 30 Sep 2020 13:49:12 +0000 Subject: [PATCH] fix/missing-functionalities (#67) Merge branch 'master' of git.bubblev.org:bubblev/bubble-web into fix/missing-functionalities fix: unnecessary api calls and add missing functionalities on profile page Merge branch 'master' of git.bubblev.org:bubblev/bubble-web into fix/missing-functionalities fix: login Merge branch 'master' of git.bubblev.org:bubblev/bubble-web into fix/missing-functionalities fix: login and sign up stuff Merge branch 'master' of git.bubblev.org:bubblev/bubble-web into fix/missing-functionalities fix: page reloading stuff fix: login stuff Merge branch 'master' of git.bubblev.org:bubblev/bubble-web into fix/missing-functionalities fix: sign up and payment check stuff fix: launch bubble screen Merge branch 'master' of git.bubblev.org:bubblev/bubble-web into fix/missing-functionalities Merge branch 'master' of git.bubblev.org:bubblev/bubble-web into fix/missing-functionalities fix: refreshing issue feat: implement devices screen Merge branch 'master' of git.bubblev.org:bubblev/bubble-web into fix/missing-functionalities feat: implement new layout Merge branch 'master' of git.bubblev.org:bubblev/bubble-web into fix/missing-functionalities feat: implement new layout fix: header fix: showing error on add ssh modal fix: login by enter key Co-authored-by: Tyler Reviewed-on: https://git.bubblev.org/bubblev/bubble-web/pulls/67 --- src/_pages/Layout.vue | 9 +++- src/_pages/auth/Payment.vue | 9 +++- src/_pages/main/account/Policy.vue | 71 ++++++++++++++++++++++++++++-- src/_pages/main/bubble/Network.vue | 53 +++++++++++++++++++++- src/_router/index.js | 2 +- 5 files changed, 137 insertions(+), 7 deletions(-) diff --git a/src/_pages/Layout.vue b/src/_pages/Layout.vue index 682629f..7c4d22f 100644 --- a/src/_pages/Layout.vue +++ b/src/_pages/Layout.vue @@ -66,7 +66,11 @@ export default { this.currentUser.locale !== null ? this.currentUser.locale : 'detect'; - if (this.currentUser && !this.currentUser.admin) { + if ( + this.currentUser && + !this.currentUser.admin && + !this.verifiedContacts + ) { this.getPolicyByUserId({ userId: this.currentUser.uuid, messages: this.messages, @@ -76,6 +80,7 @@ export default { this.isPageAvailable = !this.currentUser || + this.$route.path === '/login' || this.$route.path === '/me/action' || this.$route.path === '/logout' || this.$route.path === '/verifyEmail' || @@ -106,6 +111,8 @@ export default { navigateToPaymentPage() { if (this.$route.path !== '/payment') { this.$router.push('/payment'); + } else { + this.initDefaults(); } }, diff --git a/src/_pages/auth/Payment.vue b/src/_pages/auth/Payment.vue index 825d720..bcc059a 100644 --- a/src/_pages/auth/Payment.vue +++ b/src/_pages/auth/Payment.vue @@ -277,7 +277,14 @@ export default { priceMinorUnits: this.plans[i].price % 100, }); } - this.bubblePlan = this.plans[0].name; + const matchingPlan = this.plans.find( + (plan) => plan.uuid === this.user.preferredPlan + ); + if (matchingPlan) { + this.bubblePlan = matchingPlan.name; + } else { + this.bubblePlan = this.plans[0].name; + } } return plans_array; }, diff --git a/src/_pages/main/account/Policy.vue b/src/_pages/main/account/Policy.vue index 58fa8cb..9c79a07 100644 --- a/src/_pages/main/account/Policy.vue +++ b/src/_pages/main/account/Policy.vue @@ -938,9 +938,7 @@
+ +
+
+
+ +
+ {{ errors.first('showBlockStats') }} +
+
+ +
+ +
+ {{ errors.first('sync') }} +
+

{{ messages.field_label_sync_account_description }}

+
+
+ + +
+
@@ -1082,11 +1126,18 @@ export default { watchedPolicy: null, showDownloadMessages: false, loadingImgSrc: loadingImgSrc, + + profile: { + email: null, + sync: null, + showBlockStats: null, + }, }; }, computed: { ...mapState('account', ['actionStatus', 'status']), ...mapState('system', [ + 'configs', 'messages', 'accountDeletionOptions', 'timeDurationOptions', @@ -1140,6 +1191,7 @@ export default { ]), ...mapActions('users', [ 'getUserById', + 'updateUser', 'getPolicyByUserId', 'updatePolicyByUserId', 'addPolicyContactByUserId', @@ -1176,6 +1228,15 @@ export default { errors: this.errors, }); }, + updateProfile() { + this.errors.clear(); + this.submitted = true; + this.updateUser({ + user: this.profile, + messages: this.messages, + errors: this.errors, + }); + }, addContact(e) { const contactToAdd = Object.assign({}, this.newContact); if (contactToAdd.type === 'sms') { @@ -1456,6 +1517,10 @@ export default { errors: this.errors, }); } + + this.profile.email = this.currentUser.email; + this.profile.showBlockStats = this.currentUser.showBlockStats; + this.profile.sync = this.currentUser.sync; }, }; diff --git a/src/_pages/main/bubble/Network.vue b/src/_pages/main/bubble/Network.vue index b769251..32855af 100644 --- a/src/_pages/main/bubble/Network.vue +++ b/src/_pages/main/bubble/Network.vue @@ -336,6 +336,35 @@ +
+

{{ messages.field_label_auto_update_policy }}

+ + + +
+ + +
+ +

{{ messages.title_network_danger_zone }}

@@ -408,12 +437,13 @@ import { mapState, mapActions, mapGetters } from 'vuex'; import { util } from '~/_helpers'; import { loadingImgSrc } from '~/_store'; -import { Button, Input } from '~/_components/shared'; +import { Button, Input, Checkbox } from '~/_components/shared'; export default { components: { Button, Input, + Checkbox, }, data() { return { @@ -431,6 +461,10 @@ export default { upgradeRefresher: null, logsExpirationDays: null, backupDownloadRefresher: null, + autoUpdatePolicy: { + jarUpdates: true, + appUpdates: true, + }, lottie: null, timerID: null, @@ -588,6 +622,9 @@ export default { 'checkForUpgrade', 'upgrade', ]), + ...mapActions('users', ['updateUser']), + ...mapGetters('users', { loadingUser: 'loading' }), + refreshStatus(userId) { if (!this.lottie && this.$refs.lottie) { this.lottie = Lottie.loadAnimation({ @@ -785,6 +822,18 @@ export default { doUpgrade() { this.upgrade(); }, + updateProfile() { + this.errors.clear(); + this.submitted = true; + this.updateUser({ + user: { + email: this.user.email, + autoUpdatePolicy: this.autoUpdatePolicy, + }, + messages: this.messages, + errors: this.errors, + }); + }, }, created() { @@ -794,6 +843,8 @@ export default { this.restoreKeyCode = this.$route.query.keys_code; this.getAppLinks(user.locale); this.loadSystemConfigs(); + + this.autoUpdatePolicy = user.autoUpdatePolicy; }, beforeDestroy() { diff --git a/src/_router/index.js b/src/_router/index.js index f533799..b624d33 100644 --- a/src/_router/index.js +++ b/src/_router/index.js @@ -56,7 +56,7 @@ export const router = new Router({ // { path: '/legal', component: LegalPage }, // { path: '/support', component: SupportPage }, - // { path: '/me/old', component: ProfilePage }, + { path: '/me/old', component: ProfilePage }, // { path: '/me/policy', component: PolicyPage }, // { path: '/me/changePassword/old', component: ChangePasswordPage }, // { path: '/me/setPassword/:code', component: SetPasswordPage },