From c1bd36dc6f5700eb13c4b86fcd353a07a7c2fc08 Mon Sep 17 00:00:00 2001
From: Henry Jameson <me@hjkos.com>
Date: Sat, 12 Jun 2021 16:15:22 +0300
Subject: change how "first" line is determined. Allow one mention in the
 beginning for hellthread style

---
 src/components/rich_content/rich_content.jsx | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

(limited to 'src/components/rich_content/rich_content.jsx')

diff --git a/src/components/rich_content/rich_content.jsx b/src/components/rich_content/rich_content.jsx
index 78af0d9e..a489689b 100644
--- a/src/components/rich_content/rich_content.jsx
+++ b/src/components/rich_content/rich_content.jsx
@@ -126,7 +126,7 @@ export default Vue.component('RichContent', {
         switch (Tag) {
           case 'span': // replace images with StillImage
             if (attrs['class'] && attrs['class'].includes('lastMentions')) {
-              if (firstMentions.length > 0) {
+              if (firstMentions.length > 1) {
                 break
               } else {
                 return ''
@@ -231,6 +231,7 @@ const getLinkData = (attrs, children, index) => {
 export const preProcessPerLine = (html, greentext) => {
   const lastMentions = []
 
+  let nonEmptyIndex = 0
   const newHtml = convertHtmlToLines(html).reverse().map((item, index, array) => {
     // Going over each line in reverse to detect last mentions,
     // keeping non-text stuff as-is
@@ -295,7 +296,7 @@ export const preProcessPerLine = (html, greentext) => {
     const result = [...tree].map(process)
 
     // Only check last (first since list is reversed) line
-    if (hasMentions && !hasLooseText && index === 0) {
+    if (hasMentions && !hasLooseText && nonEmptyIndex++ === 0) {
       let mentionIndex = 0
       const process = (item) => {
         if (Array.isArray(item)) {
-- 
cgit v1.2.3-70-g09d2

