From b7208710f2b5f20fc212e51b8bc4e4199a84a386 Mon Sep 17 00:00:00 2001 From: Cyrille Bollu Date: Mon, 29 Jul 2019 15:03:47 +0200 Subject: [PATCH 01/16] Adds 's.hashtags' to the list of fields to be selected by function StreamRequestBuilder::getStreamSelectSql() Signed-off-by: Cyrille Bollu --- lib/Db/StreamRequestBuilder.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Db/StreamRequestBuilder.php b/lib/Db/StreamRequestBuilder.php index 4a98aca7..05627687 100644 --- a/lib/Db/StreamRequestBuilder.php +++ b/lib/Db/StreamRequestBuilder.php @@ -97,7 +97,7 @@ class StreamRequestBuilder extends CoreRequestBuilder { 's.type', 's.to', 's.to_array', 's.cc', 's.bcc', 's.content', 's.summary', 's.attachments', 's.published', 's.published_time', 's.cache', 's.object_id', 's.attributed_to', 's.in_reply_to', 's.source', 's.local', - 's.instances', 's.creation', 's.hidden_on_timeline', 's.details' + 's.instances', 's.creation', 's.hidden_on_timeline', 's.details', 's.hashtags' ) ->from(self::TABLE_STREAMS, 's'); From 5440d59d982c372dc9c62dd7cf466825a276c348 Mon Sep 17 00:00:00 2001 From: Cyrille Bollu Date: Mon, 29 Jul 2019 15:06:05 +0200 Subject: [PATCH 02/16] Adds myself to the list of authors of this app. Signed-off-by: Cyrille Bollu --- appinfo/info.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/appinfo/info.xml b/appinfo/info.xml index 8f261e7c..44f40255 100644 --- a/appinfo/info.xml +++ b/appinfo/info.xml @@ -24,6 +24,7 @@ Julius Härtl Jonas Sulzer Jan-Christoph Borchardt + Cyrille Bollu Social social https://github.com/nextcloud/social From 9dc9eb42233fc2f8749017f5338fe1f680584d55 Mon Sep 17 00:00:00 2001 From: Cyrille Bollu Date: Mon, 29 Jul 2019 16:04:42 +0200 Subject: [PATCH 03/16] Identifies hashtags of a toot based on what's found in the DB rather than using hashtag-regex, or (worse) linkifyjs. The question is: Why are hashtags found stored in lowercase in the DB? Signed-off-by: Cyrille Bollu --- package.json | 1 - src/components/TimelinePost.vue | 18 ++++++++++-------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/package.json b/package.json index 742b43ea..69f301da 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,6 @@ }, "dependencies": { "vue-masonry-css": "^1.0.3", - "hashtag-regex": "^2.0.0", "linkifyjs": "^2.1.8", "nextcloud-axios": "^0.2.0", "nextcloud-vue": "^0.11.4", diff --git a/src/components/TimelinePost.vue b/src/components/TimelinePost.vue index ed542881..728e201c 100644 --- a/src/components/TimelinePost.vue +++ b/src/components/TimelinePost.vue @@ -60,8 +60,6 @@ import PostAttachment from './PostAttachment' pluginMention(linkify) -const hashtagRegex = require('hashtag-regex') - export default { name: 'TimelinePost', components: { @@ -102,7 +100,7 @@ export default { return Date.parse(this.item.published) }, formatedMessage() { - var message = this.item.content + let message = this.item.content if (typeof message === 'undefined') { return '' } @@ -114,7 +112,9 @@ export default { } } }) - message = this.mangleHashtags(message) + if (this.item.hashtags !== undefined) { + message = this.mangleHashtags(message) + } message = this.$twemoji.parse(message) return message }, @@ -140,10 +140,12 @@ export default { methods: { mangleHashtags(msg) { // Replace hashtag's href parameter with local ones - const regex = hashtagRegex() - msg = msg.replace(regex, function(matched) { - var a = '' + matched + '' - return a + this.item.hashtags.forEach(tag => { + let patt = new RegExp("#" + tag, "gi") + msg = msg.replace( patt, function(matched) { + var a = '' + matched + '' + return a + }) }) return msg }, From 10ac856110ad4331f335bdd9c7e667ca02be00e7 Mon Sep 17 00:00:00 2001 From: Cyrille Bollu Date: Tue, 30 Jul 2019 15:54:30 +0200 Subject: [PATCH 04/16] Adds a very basic config to vue-tribute to also support hashtags. The part of the config that supports hashtags is not yet functional. But at least it doesn't break the part supporting mentions. Signed-off-by: Cyrille Bollu --- src/components/Composer.vue | 102 ++++++++++++++++++++++-------------- 1 file changed, 62 insertions(+), 40 deletions(-) diff --git a/src/components/Composer.vue b/src/components/Composer.vue index ca882a3c..1a852fb3 100644 --- a/src/components/Composer.vue +++ b/src/components/Composer.vue @@ -328,6 +328,9 @@ width: 16px; vertical-align: text-bottom; } + .hashtag { + text-decoration: underline; + }