From fc9acf8fb660b04641a6c30114dfa5f245de6e8c Mon Sep 17 00:00:00 2001 From: Moonman Date: Mon, 20 May 2019 00:03:50 -0400 Subject: [PATCH 1/3] add tags to data and to status component --- src/components/status/status.js | 7 +++++++ src/components/status/status.vue | 2 +- .../entity_normalizer/entity_normalizer.service.js | 2 ++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/components/status/status.js b/src/components/status/status.js index 5b3d98c3..04958eea 100644 --- a/src/components/status/status.js +++ b/src/components/status/status.js @@ -289,6 +289,13 @@ const Status = { AvatarList }, methods: { + generateTagAttributes(tags) { + let res = {}; + for (let tag of tags) { + res['data-tag-'+tag.name] = tag.name; + } + return res; + }, visibilityIcon (visibility) { switch (visibility) { case 'private': diff --git a/src/components/status/status.vue b/src/components/status/status.vue index 997c1b31..24b2520f 100644 --- a/src/components/status/status.vue +++ b/src/components/status/status.vue @@ -32,7 +32,7 @@ -
+
diff --git a/src/services/entity_normalizer/entity_normalizer.service.js b/src/services/entity_normalizer/entity_normalizer.service.js index 8e413584..46ca7602 100644 --- a/src/services/entity_normalizer/entity_normalizer.service.js +++ b/src/services/entity_normalizer/entity_normalizer.service.js @@ -192,6 +192,8 @@ export const parseStatus = (data) => { output.statusnet_html = addEmojis(data.content, data.emojis) + output.tags = data.tags + if (data.pleroma) { const { pleroma } = data output.text = pleroma.content ? data.pleroma.content['text/plain'] : data.content From f6600a35a5d3845ed6e7dc6cbbcd9494c7f9134f Mon Sep 17 00:00:00 2001 From: Moonman Date: Mon, 20 May 2019 00:15:58 -0400 Subject: [PATCH 2/3] formatting --- src/components/status/status.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/components/status/status.js b/src/components/status/status.js index 04958eea..e2d2bb8b 100644 --- a/src/components/status/status.js +++ b/src/components/status/status.js @@ -289,12 +289,12 @@ const Status = { AvatarList }, methods: { - generateTagAttributes(tags) { - let res = {}; - for (let tag of tags) { - res['data-tag-'+tag.name] = tag.name; - } - return res; + generateTagAttributes (tags) { + let res = {} + for (let tag of tags) { + res['data-tag-' + tag.name] = tag.name + } + return res }, visibilityIcon (visibility) { switch (visibility) { From 0f824ff311bd3b1b8a0126ad9d7a2885440d3762 Mon Sep 17 00:00:00 2001 From: Moonman Date: Mon, 20 May 2019 15:23:36 -0400 Subject: [PATCH 3/3] switch from method to computed property --- src/components/status/status.js | 10 +++------- src/components/status/status.vue | 2 +- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/components/status/status.js b/src/components/status/status.js index e2d2bb8b..ea4c2b9d 100644 --- a/src/components/status/status.js +++ b/src/components/status/status.js @@ -274,6 +274,9 @@ const Status = { }, ownStatus () { return this.status.user.id === this.$store.state.users.currentUser.id + }, + tags () { + return this.status.tags.filter(tagObj => tagObj.hasOwnProperty('name')).map(tagObj => tagObj.name).join(' ') } }, components: { @@ -289,13 +292,6 @@ const Status = { AvatarList }, methods: { - generateTagAttributes (tags) { - let res = {} - for (let tag of tags) { - res['data-tag-' + tag.name] = tag.name - } - return res - }, visibilityIcon (visibility) { switch (visibility) { case 'private': diff --git a/src/components/status/status.vue b/src/components/status/status.vue index 24b2520f..9a062592 100644 --- a/src/components/status/status.vue +++ b/src/components/status/status.vue @@ -32,7 +32,7 @@
-
+