fix changes requested
This commit is contained in:
		@@ -766,11 +766,7 @@ func cmdToggle(cmd *Command) {
 | 
			
		||||
		case "unverified":
 | 
			
		||||
			val = &cmd.Config.SendToVerifiedOnly
 | 
			
		||||
		case "showurls":
 | 
			
		||||
<<<<<<< HEAD
 | 
			
		||||
			val = &cmd.Config.Preferences.DisableShowURLs
 | 
			
		||||
=======
 | 
			
		||||
			val = &cmd.Config.Preferences.DisableShowurls
 | 
			
		||||
>>>>>>> 67c0262587404c2b2912e934092dacdba7cc2ed0
 | 
			
		||||
		default:
 | 
			
		||||
			cmd.Reply("Unknown toggle %s. Use /toggle without arguments for a list of togglable things.", thing)
 | 
			
		||||
			return
 | 
			
		||||
 
 | 
			
		||||
@@ -41,16 +41,8 @@ import (
 | 
			
		||||
var matrixToURL = regexp.MustCompile("^(?:https?://)?(?:www\\.)?matrix\\.to/#/([#@!].*)")
 | 
			
		||||
 | 
			
		||||
type htmlParser struct {
 | 
			
		||||
<<<<<<< HEAD
 | 
			
		||||
	prefs   *config.UserPreferences
 | 
			
		||||
	room    *rooms.Room
 | 
			
		||||
	sameURL bool
 | 
			
		||||
=======
 | 
			
		||||
	prefs         *config.UserPreferences
 | 
			
		||||
	room          *rooms.Room
 | 
			
		||||
	mautrixnolink bool
 | 
			
		||||
	sameURL       bool
 | 
			
		||||
>>>>>>> 67c0262587404c2b2912e934092dacdba7cc2ed0
 | 
			
		||||
	prefs *config.UserPreferences
 | 
			
		||||
	room  *rooms.Room
 | 
			
		||||
 | 
			
		||||
	keepLinebreak bool
 | 
			
		||||
}
 | 
			
		||||
@@ -208,7 +200,6 @@ func (parser *htmlParser) linkToEntity(node *html.Node) Entity {
 | 
			
		||||
	if len(entity.Children) == 1 {
 | 
			
		||||
		entity, ok := entity.Children[0].(*TextEntity)
 | 
			
		||||
		if ok && entity.Text == href {
 | 
			
		||||
<<<<<<< HEAD
 | 
			
		||||
			sameURL = true
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
@@ -216,17 +207,6 @@ func (parser *htmlParser) linkToEntity(node *html.Node) Entity {
 | 
			
		||||
	if !parser.prefs.DisableShowURLs && !parser.hasAttribute(node, "data-mautrix-no-link") && !sameURL {
 | 
			
		||||
 | 
			
		||||
		entity.Children = append(entity.Children, NewTextEntity(fmt.Sprintf(" (%s)", href)))
 | 
			
		||||
=======
 | 
			
		||||
			parser.sameURL = true
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if !parser.prefs.DisableShowurls && !parser.mautrixnolink && !parser.sameURL {
 | 
			
		||||
		entity.Children = append(
 | 
			
		||||
			[]Entity{NewTextEntity("(" + href + ") ")},
 | 
			
		||||
			parser.nodeToEntities(node.FirstChild)...,
 | 
			
		||||
		)
 | 
			
		||||
>>>>>>> 67c0262587404c2b2912e934092dacdba7cc2ed0
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	match := matrixToURL.FindStringSubmatch(href)
 | 
			
		||||
@@ -435,24 +415,13 @@ const TabLength = 4
 | 
			
		||||
// Parse parses a HTML-formatted Matrix event into a UIMessage.
 | 
			
		||||
func Parse(prefs *config.UserPreferences, room *rooms.Room, content *event.MessageEventContent, sender id.UserID, senderDisplayname string) Entity {
 | 
			
		||||
	htmlData := content.FormattedBody
 | 
			
		||||
<<<<<<< HEAD
 | 
			
		||||
=======
 | 
			
		||||
	DataMautrixNoLink := false
 | 
			
		||||
>>>>>>> 67c0262587404c2b2912e934092dacdba7cc2ed0
 | 
			
		||||
 | 
			
		||||
	if content.Format != event.FormatHTML {
 | 
			
		||||
		htmlData = strings.Replace(html.EscapeString(content.Body), "\n", "<br/>", -1)
 | 
			
		||||
	}
 | 
			
		||||
	htmlData = strings.Replace(htmlData, "\t", strings.Repeat(" ", TabLength), -1)
 | 
			
		||||
<<<<<<< HEAD
 | 
			
		||||
 | 
			
		||||
	parser := htmlParser{room: room, prefs: prefs}
 | 
			
		||||
=======
 | 
			
		||||
	if strings.Contains(htmlData, "data-mautrix-no-link") {
 | 
			
		||||
		DataMautrixNoLink = true
 | 
			
		||||
	}
 | 
			
		||||
	parser := htmlParser{room: room, prefs: prefs, mautrixnolink: DataMautrixNoLink}
 | 
			
		||||
>>>>>>> 67c0262587404c2b2912e934092dacdba7cc2ed0
 | 
			
		||||
	root := parser.Parse(htmlData)
 | 
			
		||||
	beRoot := root.(*ContainerEntity)
 | 
			
		||||
	beRoot.Block = false
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user