From ca4d5950d08aec6fe016b56f7125f7328c1e19a1 Mon Sep 17 00:00:00 2001
From: kPherox
Date: Sat, 16 Nov 2019 03:12:16 +0900
Subject: Display user profile fields
---
src/components/user_profile/user_profile.js | 8 +++++
src/components/user_profile/user_profile.vue | 50 ++++++++++++++++++++++++++++
2 files changed, 58 insertions(+)
(limited to 'src/components')
diff --git a/src/components/user_profile/user_profile.js b/src/components/user_profile/user_profile.js
index 00055707..c5ab5f26 100644
--- a/src/components/user_profile/user_profile.js
+++ b/src/components/user_profile/user_profile.js
@@ -123,6 +123,14 @@ const UserProfile = {
onTabSwitch (tab) {
this.tab = tab
this.$router.replace({ query: { tab } })
+ },
+ linkClicked ({ target }) {
+ if (target.tagName === 'SPAN') {
+ target = target.parentNode
+ }
+ if (target.tagName === 'A') {
+ window.open(target.href, '_blank')
+ }
}
},
watch: {
diff --git a/src/components/user_profile/user_profile.vue b/src/components/user_profile/user_profile.vue
index 14082e83..f979eff4 100644
--- a/src/components/user_profile/user_profile.vue
+++ b/src/components/user_profile/user_profile.vue
@@ -11,6 +11,44 @@
:allow-zooming-avatar="true"
rounded="top"
/>
+
+
+
+ -
+ {{ field.name }}
+
+ -
+ {{ field.value }}
+
+
+
Date: Mon, 18 Nov 2019 00:27:14 +0900
Subject: Fix emoji size
---
src/components/user_profile/user_profile.vue | 12 ++++++++++++
1 file changed, 12 insertions(+)
(limited to 'src/components')
diff --git a/src/components/user_profile/user_profile.vue b/src/components/user_profile/user_profile.vue
index f979eff4..d5aa514e 100644
--- a/src/components/user_profile/user_profile.vue
+++ b/src/components/user_profile/user_profile.vue
@@ -152,6 +152,18 @@
flex-basis: 500px;
.user-profile-fields {
+ img {
+ object-fit: contain;
+ vertical-align: middle;
+ max-width: 100%;
+ max-height: 400px;
+
+ &.emoji {
+ width: 32px;
+ height: 32px;
+ }
+ }
+
dl {
margin: 1em 1.5em;
--
cgit v1.2.3-70-g09d2
From 004827a7f17a0bc349baf1257aa5debe3c6f6060 Mon Sep 17 00:00:00 2001
From: kPherox
Date: Mon, 18 Nov 2019 02:16:37 +0900
Subject: Change profile fields design to horizontal
---
src/components/user_profile/user_profile.vue | 20 ++++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)
(limited to 'src/components')
diff --git a/src/components/user_profile/user_profile.vue b/src/components/user_profile/user_profile.vue
index d5aa514e..fdff0385 100644
--- a/src/components/user_profile/user_profile.vue
+++ b/src/components/user_profile/user_profile.vue
@@ -159,15 +159,31 @@
max-height: 400px;
&.emoji {
- width: 32px;
- height: 32px;
+ width: 18px;
+ height: 18px;
}
}
dl {
+ display: flex;
margin: 1em 1.5em;
+ dt {
+ flex: 0 0 auto;
+ font-weight: 500;
+ color: var(--lightText);
+ width: 30%;
+ min-width: 120px;
+ }
+
+ dd {
+ flex: 1 1 auto;
+ color: var(--text);
+ margin-left: 10px;
+ }
+
dt, dd {
+ line-height: 18px;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
--
cgit v1.2.3-70-g09d2
From 87940ead8a9bedd312f10635462933a02e0ffb1c Mon Sep 17 00:00:00 2001
From: kPherox
Date: Wed, 20 Nov 2019 18:59:37 +0900
Subject: Change css selectors to classname from elementname
---
src/components/user_profile/user_profile.vue | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
(limited to 'src/components')
diff --git a/src/components/user_profile/user_profile.vue b/src/components/user_profile/user_profile.vue
index fdff0385..c1337411 100644
--- a/src/components/user_profile/user_profile.vue
+++ b/src/components/user_profile/user_profile.vue
@@ -18,6 +18,7 @@
-
Date: Wed, 20 Nov 2019 19:18:19 +0900
Subject: Add tooltip
---
src/components/user_profile/user_profile.vue | 2 ++
1 file changed, 2 insertions(+)
(limited to 'src/components')
diff --git a/src/components/user_profile/user_profile.vue b/src/components/user_profile/user_profile.vue
index c1337411..20a64409 100644
--- a/src/components/user_profile/user_profile.vue
+++ b/src/components/user_profile/user_profile.vue
@@ -22,11 +22,13 @@
>
-
Date: Wed, 20 Nov 2019 19:22:20 +0900
Subject: Use fields_html only
---
src/components/user_profile/user_profile.vue | 16 ----------------
1 file changed, 16 deletions(-)
(limited to 'src/components')
diff --git a/src/components/user_profile/user_profile.vue b/src/components/user_profile/user_profile.vue
index 20a64409..0268e5da 100644
--- a/src/components/user_profile/user_profile.vue
+++ b/src/components/user_profile/user_profile.vue
@@ -36,22 +36,6 @@
-
-
- -
- {{ field.name }}
-
- -
- {{ field.value }}
-
-
-
Date: Wed, 20 Nov 2019 19:25:11 +0900
Subject: Change field name to right justify
---
src/components/user_profile/user_profile.vue | 1 +
1 file changed, 1 insertion(+)
(limited to 'src/components')
diff --git a/src/components/user_profile/user_profile.vue b/src/components/user_profile/user_profile.vue
index 0268e5da..5bffba3a 100644
--- a/src/components/user_profile/user_profile.vue
+++ b/src/components/user_profile/user_profile.vue
@@ -158,6 +158,7 @@
.user-profile-field-name {
flex: 0 0 auto;
font-weight: 500;
+ text-align: right;
color: var(--lightText);
width: 30%;
min-width: 120px;
--
cgit v1.2.3-70-g09d2
From 064b59812c715d60526727d42c124375a2bc89d5 Mon Sep 17 00:00:00 2001
From: kPherox
Date: Wed, 19 Feb 2020 21:00:39 +0900
Subject: Change to use tags removed fields instead of raw fields
---
src/components/user_profile/user_profile.vue | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
(limited to 'src/components')
diff --git a/src/components/user_profile/user_profile.vue b/src/components/user_profile/user_profile.vue
index 5bffba3a..54f2d4b3 100644
--- a/src/components/user_profile/user_profile.vue
+++ b/src/components/user_profile/user_profile.vue
@@ -22,13 +22,13 @@
>
Date: Wed, 10 Jun 2020 03:24:55 +0900
Subject: Add profile fields form
---
src/boot/after_store.js | 2 +
src/components/settings_modal/tabs/profile_tab.js | 21 ++++++++++
.../settings_modal/tabs/profile_tab.scss | 17 ++++++++
src/components/settings_modal/tabs/profile_tab.vue | 46 ++++++++++++++++++++++
4 files changed, 86 insertions(+)
(limited to 'src/components')
diff --git a/src/boot/after_store.js b/src/boot/after_store.js
index 0db03547..87c92a8a 100644
--- a/src/boot/after_store.js
+++ b/src/boot/after_store.js
@@ -207,6 +207,8 @@ const getNodeInfo = async ({ store }) => {
store.dispatch('setInstanceOption', { name: 'pollLimits', value: metadata.pollLimits })
store.dispatch('setInstanceOption', { name: 'mailerEnabled', value: metadata.mailerEnabled })
+ store.dispatch('setInstanceOption', { name: 'fieldsLimits', value: metadata.fieldsLimits })
+
store.dispatch('setInstanceOption', { name: 'restrictedNicknames', value: metadata.restrictedNicknames })
store.dispatch('setInstanceOption', { name: 'postFormats', value: metadata.postFormats })
diff --git a/src/components/settings_modal/tabs/profile_tab.js b/src/components/settings_modal/tabs/profile_tab.js
index 8658b097..896ff508 100644
--- a/src/components/settings_modal/tabs/profile_tab.js
+++ b/src/components/settings_modal/tabs/profile_tab.js
@@ -1,4 +1,5 @@
import unescape from 'lodash/unescape'
+import merge from 'lodash/merge'
import ImageCropper from 'src/components/image_cropper/image_cropper.vue'
import ScopeSelector from 'src/components/scope_selector/scope_selector.vue'
import fileSizeFormatService from 'src/components/../services/file_size_format/file_size_format.js'
@@ -16,6 +17,7 @@ const ProfileTab = {
newLocked: this.$store.state.users.currentUser.locked,
newNoRichText: this.$store.state.users.currentUser.no_rich_text,
newDefaultScope: this.$store.state.users.currentUser.default_scope,
+ newFields: this.$store.state.users.currentUser.fields.map(field => ({ name: field.name, value: field.value })),
hideFollows: this.$store.state.users.currentUser.hide_follows,
hideFollowers: this.$store.state.users.currentUser.hide_followers,
hideFollowsCount: this.$store.state.users.currentUser.hide_follows_count,
@@ -62,6 +64,12 @@ const ProfileTab = {
...this.$store.state.instance.emoji,
...this.$store.state.instance.customEmoji
] })
+ },
+ fieldsLimits () {
+ return this.$store.state.instance.fieldsLimits
+ },
+ maxFields () {
+ return this.fieldsLimits ? this.fieldsLimits.maxFields : 0
}
},
methods: {
@@ -74,6 +82,7 @@ const ProfileTab = {
// Backend notation.
/* eslint-disable camelcase */
display_name: this.newName,
+ fields_attributes: this.newFields.filter(el => el != null),
default_scope: this.newDefaultScope,
no_rich_text: this.newNoRichText,
hide_follows: this.hideFollows,
@@ -85,6 +94,8 @@ const ProfileTab = {
show_role: this.showRole
/* eslint-enable camelcase */
} }).then((user) => {
+ this.newFields.splice(user.fields.length)
+ merge(this.newFields, user.fields)
this.$store.commit('addNewUsers', [user])
this.$store.commit('setCurrentUser', user)
})
@@ -92,6 +103,16 @@ const ProfileTab = {
changeVis (visibility) {
this.newDefaultScope = visibility
},
+ addField () {
+ if (this.newFields.length < this.maxFields) {
+ this.newFields.push({ name: '', value: '' })
+ return true
+ }
+ return false
+ },
+ deleteField (index, event) {
+ this.$delete(this.newFields, index)
+ },
uploadFile (slot, e) {
const file = e.target.files[0]
if (!file) { return }
diff --git a/src/components/settings_modal/tabs/profile_tab.scss b/src/components/settings_modal/tabs/profile_tab.scss
index 4aab81eb..b3dcf42c 100644
--- a/src/components/settings_modal/tabs/profile_tab.scss
+++ b/src/components/settings_modal/tabs/profile_tab.scss
@@ -79,4 +79,21 @@
.setting-subitem {
margin-left: 1.75em;
}
+
+ .profile-fields {
+ display: flex;
+
+ &>.emoji-input {
+ flex: 1 1 auto;
+ margin: 0 .2em .5em;
+ }
+
+ &>.icon-container {
+ width: 20px;
+
+ &>.icon-cancel {
+ vertical-align: sub;
+ }
+ }
+ }
}
diff --git a/src/components/settings_modal/tabs/profile_tab.vue b/src/components/settings_modal/tabs/profile_tab.vue
index fff4f970..2fa3021e 100644
--- a/src/components/settings_modal/tabs/profile_tab.vue
+++ b/src/components/settings_modal/tabs/profile_tab.vue
@@ -95,6 +95,52 @@
{{ $t('settings.discoverable') }}
+