From 1101305ffb72bacd68698bfbe6e961953a9043de Mon Sep 17 00:00:00 2001
From: Tusooa Zhu <tusooa@kazv.moe>
Date: Sat, 20 Aug 2022 13:02:27 -0400
Subject: Add ui for note editing

---
 src/components/user_card/user_card.vue | 6 ++++++
 1 file changed, 6 insertions(+)

(limited to 'src/components/user_card/user_card.vue')

diff --git a/src/components/user_card/user_card.vue b/src/components/user_card/user_card.vue
index 897d89f9..83dfed4e 100644
--- a/src/components/user_card/user_card.vue
+++ b/src/components/user_card/user_card.vue
@@ -268,6 +268,12 @@
         >
           <RemoteFollow :user="user" />
         </div>
+        <UserNote
+          v-if="loggedIn && isOtherUser"
+          :user="user"
+          :relationship="relationship"
+          :editing="isEditingNote"
+        />
       </div>
     </div>
     <div
-- 
cgit v1.2.3-70-g09d2


From 9ab3f27f72c74a61763534eb53b92a3172bb5f5d Mon Sep 17 00:00:00 2001
From: Tusooa Zhu <tusooa@kazv.moe>
Date: Sat, 20 Aug 2022 13:20:59 -0400
Subject: Test if server supports note

---
 src/components/user_card/user_card.js  | 3 +++
 src/components/user_card/user_card.vue | 2 +-
 2 files changed, 4 insertions(+), 1 deletion(-)

(limited to 'src/components/user_card/user_card.vue')

diff --git a/src/components/user_card/user_card.js b/src/components/user_card/user_card.js
index 56e978bf..65140d4e 100644
--- a/src/components/user_card/user_card.js
+++ b/src/components/user_card/user_card.js
@@ -130,6 +130,9 @@ export default {
       const privileges = this.loggedIn.privileges
       return this.loggedIn.role === 'admin' || privileges.includes('users_manage_activation_state') || privileges.includes('users_delete') || privileges.includes('users_manage_tags')
     },
+    supportsNote () {
+      return 'note' in this.relationship
+    },
     ...mapGetters(['mergedConfig'])
   },
   components: {
diff --git a/src/components/user_card/user_card.vue b/src/components/user_card/user_card.vue
index 83dfed4e..88434c59 100644
--- a/src/components/user_card/user_card.vue
+++ b/src/components/user_card/user_card.vue
@@ -269,7 +269,7 @@
           <RemoteFollow :user="user" />
         </div>
         <UserNote
-          v-if="loggedIn && isOtherUser"
+          v-if="loggedIn && isOtherUser && supportsNote"
           :user="user"
           :relationship="relationship"
           :editing="isEditingNote"
-- 
cgit v1.2.3-70-g09d2


From 2e2512019230f299c2c9eae18afec3c8218d2697 Mon Sep 17 00:00:00 2001
From: Tusooa Zhu <tusooa@kazv.moe>
Date: Wed, 7 Sep 2022 18:46:18 -0400
Subject: Make notes editable only on user profile

---
 src/components/user_card/user_card.js        | 6 +++++-
 src/components/user_card/user_card.vue       | 4 ++--
 src/components/user_note/user_note.js        | 3 ++-
 src/components/user_note/user_note.vue       | 3 +--
 src/components/user_profile/user_profile.vue | 1 +
 5 files changed, 11 insertions(+), 6 deletions(-)

(limited to 'src/components/user_card/user_card.vue')

diff --git a/src/components/user_card/user_card.js b/src/components/user_card/user_card.js
index 65140d4e..67879307 100644
--- a/src/components/user_card/user_card.js
+++ b/src/components/user_card/user_card.js
@@ -40,7 +40,8 @@ export default {
     'rounded',
     'bordered',
     'avatarAction', // default - open profile, 'zoom' - zoom, function - call function
-    'onClose'
+    'onClose',
+    'hasNoteEditor'
   ],
   data () {
     return {
@@ -130,6 +131,9 @@ export default {
       const privileges = this.loggedIn.privileges
       return this.loggedIn.role === 'admin' || privileges.includes('users_manage_activation_state') || privileges.includes('users_delete') || privileges.includes('users_manage_tags')
     },
+    hasNote () {
+      return this.relationship.note
+    },
     supportsNote () {
       return 'note' in this.relationship
     },
diff --git a/src/components/user_card/user_card.vue b/src/components/user_card/user_card.vue
index 88434c59..349c7cb1 100644
--- a/src/components/user_card/user_card.vue
+++ b/src/components/user_card/user_card.vue
@@ -269,10 +269,10 @@
           <RemoteFollow :user="user" />
         </div>
         <UserNote
-          v-if="loggedIn && isOtherUser && supportsNote"
+          v-if="loggedIn && isOtherUser && (hasNote || (hasNoteEditor && supportsNote))"
           :user="user"
           :relationship="relationship"
-          :editing="isEditingNote"
+          :editable="hasNoteEditor"
         />
       </div>
     </div>
diff --git a/src/components/user_note/user_note.js b/src/components/user_note/user_note.js
index dc5b8e71..830b2e59 100644
--- a/src/components/user_note/user_note.js
+++ b/src/components/user_note/user_note.js
@@ -1,7 +1,8 @@
 const UserNote = {
   props: {
     user: Object,
-    relationship: Object
+    relationship: Object,
+    editable: Boolean
   },
   data () {
     return {
diff --git a/src/components/user_note/user_note.vue b/src/components/user_note/user_note.vue
index 328e2350..4286e017 100644
--- a/src/components/user_note/user_note.vue
+++ b/src/components/user_note/user_note.vue
@@ -6,7 +6,7 @@
       <span>{{ $t('user_card.note') }}</span>
       <div class="buttons">
         <button
-          v-show="!editing"
+          v-show="!editing && editable"
           class="button-default btn"
           @click="startEditing"
         >
@@ -77,7 +77,6 @@
   }
 
   .note-text {
-    line-height: 2;
     align-self: stretch;
   }
 
diff --git a/src/components/user_profile/user_profile.vue b/src/components/user_profile/user_profile.vue
index d0da2b5b..d5e8d230 100644
--- a/src/components/user_profile/user_profile.vue
+++ b/src/components/user_profile/user_profile.vue
@@ -10,6 +10,7 @@
         :selected="timeline.viewing"
         avatar-action="zoom"
         rounded="top"
+        :has-note-editor="true"
       />
       <div
         v-if="user.fields_html && user.fields_html.length > 0"
-- 
cgit v1.2.3-70-g09d2

