diff options
| author | HJ <30-hj@users.noreply.git.pleroma.social> | 2022-12-22 13:14:30 +0000 |
|---|---|---|
| committer | HJ <30-hj@users.noreply.git.pleroma.social> | 2022-12-22 13:14:30 +0000 |
| commit | e009510c52d62a19136e01d9f0753448ad703016 (patch) | |
| tree | b3dbe611155aeb7d3ff554e900635575792527b4 /src/components/user_note/user_note.js | |
| parent | 515dcfd3395ce4c6bd228e6bfc20120de78976c1 (diff) | |
| parent | 2e2512019230f299c2c9eae18afec3c8218d2697 (diff) | |
Merge branch 'from/develop/tusooa/user-note' into 'develop'
User note
See merge request pleroma/pleroma-fe!1612
Diffstat (limited to 'src/components/user_note/user_note.js')
| -rw-r--r-- | src/components/user_note/user_note.js | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/src/components/user_note/user_note.js b/src/components/user_note/user_note.js new file mode 100644 index 00000000..830b2e59 --- /dev/null +++ b/src/components/user_note/user_note.js @@ -0,0 +1,45 @@ +const UserNote = { + props: { + user: Object, + relationship: Object, + editable: Boolean + }, + data () { + return { + localNote: '', + editing: false, + frozen: false + } + }, + computed: { + shouldShow () { + return this.relationship.note || this.editing + } + }, + methods: { + startEditing () { + this.localNote = this.relationship.note + this.editing = true + }, + cancelEditing () { + this.editing = false + }, + finalizeEditing () { + this.frozen = true + + this.$store.dispatch('editUserNote', { + id: this.user.id, + comment: this.localNote + }) + .then(() => { + this.frozen = false + this.editing = false + }) + .catch(() => { + this.frozen = false + }) + } + } +} + +export default UserNote |
