mirror of
https://github.com/nextcloud/server.git
synced 2026-02-20 00:12:30 -05:00
Remake Twitter handle saving with Vue
Signed-off-by: Christopher Ng <chrng8@gmail.com>
This commit is contained in:
parent
c5c70daa66
commit
09f6eb5e58
7 changed files with 60 additions and 49 deletions
|
|
@ -130,7 +130,8 @@
|
|||
if (
|
||||
field === 'avatar' ||
|
||||
field === 'email' ||
|
||||
field === 'displayname'
|
||||
field === 'displayname' ||
|
||||
field === 'twitter'
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -154,9 +154,6 @@ class PersonalInfo implements ISettings {
|
|||
'website' => $account->getProperty(IAccountManager::PROPERTY_WEBSITE)->getValue(),
|
||||
'websiteScope' => $account->getProperty(IAccountManager::PROPERTY_WEBSITE)->getScope(),
|
||||
'websiteVerification' => $account->getProperty(IAccountManager::PROPERTY_WEBSITE)->getVerified(),
|
||||
'twitter' => $account->getProperty(IAccountManager::PROPERTY_TWITTER)->getValue(),
|
||||
'twitterScope' => $account->getProperty(IAccountManager::PROPERTY_TWITTER)->getScope(),
|
||||
'twitterVerification' => $account->getProperty(IAccountManager::PROPERTY_TWITTER)->getVerified(),
|
||||
'groups' => $this->getGroups($user),
|
||||
'isFairUseOfFreePushService' => $this->isFairUseOfFreePushService(),
|
||||
'profileEnabledGlobally' => $this->profileManager->isProfileEnabled(),
|
||||
|
|
@ -165,6 +162,7 @@ class PersonalInfo implements ISettings {
|
|||
$personalInfoParameters = [
|
||||
'userId' => $uid,
|
||||
'displayName' => $this->getProperty($account, IAccountManager::PROPERTY_DISPLAYNAME),
|
||||
'twitter' => $this->getProperty($account, IAccountManager::PROPERTY_TWITTER),
|
||||
'emailMap' => $this->getEmailMap($account),
|
||||
'languageMap' => $this->getLanguageMap($user),
|
||||
'profileEnabledGlobally' => $this->profileManager->isProfileEnabled(),
|
||||
|
|
|
|||
50
apps/settings/src/components/PersonalInfo/TwitterSection.vue
Normal file
50
apps/settings/src/components/PersonalInfo/TwitterSection.vue
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
<!--
|
||||
- @copyright 2022 Christopher Ng <chrng8@gmail.com>
|
||||
-
|
||||
- @author Christopher Ng <chrng8@gmail.com>
|
||||
-
|
||||
- @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/>.
|
||||
-
|
||||
-->
|
||||
|
||||
<template>
|
||||
<AccountPropertySection v-bind.sync="twitter"
|
||||
:placeholder="t('settings', 'Your Twitter handle')" />
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { loadState } from '@nextcloud/initial-state'
|
||||
|
||||
import AccountPropertySection from './shared/AccountPropertySection.vue'
|
||||
|
||||
import { NAME_READABLE_ENUM } from '../../constants/AccountPropertyConstants.js'
|
||||
|
||||
const { twitter } = loadState('settings', 'personalInfoParameters', {})
|
||||
|
||||
export default {
|
||||
name: 'TwitterSection',
|
||||
|
||||
components: {
|
||||
AccountPropertySection,
|
||||
},
|
||||
|
||||
data() {
|
||||
return {
|
||||
twitter: { ...twitter, readable: NAME_READABLE_ENUM[twitter.name] },
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
|
@ -28,6 +28,7 @@ import '@nextcloud/dialogs/styles/toast.scss'
|
|||
|
||||
import DisplayNameSection from './components/PersonalInfo/DisplayNameSection.vue'
|
||||
import EmailSection from './components/PersonalInfo/EmailSection/EmailSection.vue'
|
||||
import TwitterSection from './components/PersonalInfo/TwitterSection.vue'
|
||||
import LanguageSection from './components/PersonalInfo/LanguageSection/LanguageSection.vue'
|
||||
import ProfileSection from './components/PersonalInfo/ProfileSection/ProfileSection.vue'
|
||||
import OrganisationSection from './components/PersonalInfo/OrganisationSection.vue'
|
||||
|
|
@ -48,10 +49,12 @@ Vue.mixin({
|
|||
|
||||
const DisplayNameView = Vue.extend(DisplayNameSection)
|
||||
const EmailView = Vue.extend(EmailSection)
|
||||
const TwitterView = Vue.extend(TwitterSection)
|
||||
const LanguageView = Vue.extend(LanguageSection)
|
||||
|
||||
new DisplayNameView().$mount('#vue-displayname-section')
|
||||
new EmailView().$mount('#vue-email-section')
|
||||
new TwitterView().$mount('#vue-twitter-section')
|
||||
new LanguageView().$mount('#vue-language-section')
|
||||
|
||||
if (profileEnabledGlobally) {
|
||||
|
|
|
|||
|
|
@ -196,48 +196,7 @@ script('settings', [
|
|||
</form>
|
||||
</div>
|
||||
<div class="personal-settings-setting-box">
|
||||
<form id="twitterform" class="section">
|
||||
<h3>
|
||||
<label for="twitter"><?php p($l->t('Twitter')); ?></label>
|
||||
<a href="#" class="federation-menu" aria-label="<?php p($l->t('Change privacy level of Twitter profile')); ?>">
|
||||
<span class="icon-federation-menu icon-password">
|
||||
<span class="icon-triangle-s"></span>
|
||||
</span>
|
||||
</a>
|
||||
</h3>
|
||||
<?php if ($_['lookupServerUploadEnabled']) { ?>
|
||||
<div class="verify <?php if ($_['twitter'] === '' || $_['twitterScope'] !== 'public') {
|
||||
p('hidden');
|
||||
} ?>">
|
||||
<img id="verify-twitter" title="<?php p($_['twitterMessage']); ?>" data-status="<?php p($_['twitterVerification']) ?>" src="
|
||||
<?php
|
||||
switch ($_['twitterVerification']) {
|
||||
case \OC\Accounts\AccountManager::VERIFICATION_IN_PROGRESS:
|
||||
p(image_path('core', 'actions/verifying.svg'));
|
||||
break;
|
||||
case \OC\Accounts\AccountManager::VERIFIED:
|
||||
p(image_path('core', 'actions/verified.svg'));
|
||||
break;
|
||||
default:
|
||||
p(image_path('core', 'actions/verify.svg'));
|
||||
}
|
||||
?>" <?php if ($_['twitterVerification'] === \OC\Accounts\AccountManager::VERIFICATION_IN_PROGRESS || $_['twitterVerification'] === \OC\Accounts\AccountManager::NOT_VERIFIED) {
|
||||
print_unescaped(' class="verify-action"');
|
||||
} ?>>
|
||||
<div class="verification-dialog popovermenu bubble menu">
|
||||
<div class="verification-dialog-content">
|
||||
<p class="explainVerification"></p>
|
||||
<p class="verificationCode"></p>
|
||||
<p><?php p($l->t('It can take up to 24 hours before the account is displayed as verified.')); ?></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<input type="text" name="twitter" id="twitter" value="<?php p($_['twitter']); ?>" placeholder="<?php p($l->t('Twitter handle @…')); ?>" autocomplete="on" autocapitalize="none" autocorrect="off" />
|
||||
<span class="icon-checkmark hidden"></span>
|
||||
<span class="icon-error hidden"></span>
|
||||
<input type="hidden" id="twitterscope" value="<?php p($_['twitterScope']) ?>">
|
||||
</form>
|
||||
<div id="vue-twitter-section"></div>
|
||||
</div>
|
||||
<?php if ($_['profileEnabledGlobally']) : ?>
|
||||
<div class="personal-settings-setting-box">
|
||||
|
|
|
|||
4
dist/settings-vue-settings-personal-info.js
vendored
4
dist/settings-vue-settings-personal-info.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue