Display new Account fields in plaintext and templates
authorMikael Berthe <mikael@lilotux.net>
Fri, 07 Sep 2018 19:18:30 +0200
changeset 234 f5cd55622194
parent 233 a141105804f7
child 235 747f108d5821
Display new Account fields in plaintext and templates Display information for bot (automated accounts), source (default settings) and fields (profile metadata).
printer/plainprinter.go
templates/themes/ansi-dark/account.tmpl
templates/themes/ansi/account.tmpl
--- a/printer/plainprinter.go	Thu Sep 06 01:10:15 2018 +0200
+++ b/printer/plainprinter.go	Fri Sep 07 19:18:30 2018 +0200
@@ -186,6 +186,9 @@
 	if a.Locked {
 		indentedPrint(w, indent, false, false, "Locked", "%v", a.Locked)
 	}
+	if a.Bot {
+		indentedPrint(w, indent, false, false, "Bot", "%v", a.Bot)
+	}
 	indentedPrint(w, indent, false, true, "User note", "%s", html2string(a.Note)) // XXX too long?
 	if a.Moved != nil {
 		m := a.Moved
@@ -193,6 +196,24 @@
 		indentedPrint(w, indent+p.Indent, false, false, "New user ID", "%s", m.Acct)
 		indentedPrint(w, indent+p.Indent, false, false, "New display name", "%s", m.DisplayName)
 	}
+	if a.Source != nil {
+		s := a.Source
+		if s.Privacy != nil {
+			indentedPrint(w, indent, false, true, "Default Privacy", "%s", *s.Privacy)
+		}
+		if s.Language != nil {
+			indentedPrint(w, indent, false, true, "Default Language", "%s", *s.Language)
+		}
+		if s.Sensitive != nil {
+			indentedPrint(w, indent, false, true, "Sensitive by default", "%v", *s.Sensitive)
+		}
+	}
+	if a.Fields != nil {
+		for _, f := range *a.Fields {
+			indentedPrint(w, indent, false, false, ". Metadata field",
+				"[%s] » %s", f.Name, html2string(f.Value))
+		}
+	}
 	return nil
 }
 
--- a/templates/themes/ansi-dark/account.tmpl	Thu Sep 06 01:10:15 2018 +0200
+++ b/templates/themes/ansi-dark/account.tmpl	Fri Sep 07 19:18:30 2018 +0200
@@ -10,7 +10,16 @@
   Note: {{color "yellow"}}{{. | fromhtml | wrap "   " 79 | trim}}{{color "reset"}}{{end}}{{end}}
 {{- if eq .locked true}}
   Locked: true{{end}}
+{{- if eq .bot true}}
+  Bot: true{{end}}
 {{- with .moved}}
   MOVED to account ID: {{color "red"}}{{.id}}{{color "reset"}}  {{color "magenta"}}@{{.username}}{{color "reset"}}
     UID: {{color "red"}}{{.acct}}{{color "reset"}}
     Display name: {{color "white,,bold"}}{{.display_name}}{{color "reset"}}{{end}}
+{{- with .source}}
+  Default Privacy: {{.privacy}}
+  Sensitive by default: {{.sensitive}}
+{{- if .language}}
+  Default Language: {{.language}}{{end}}{{end}}
+{{- range .fields}}
+  . {{color ",,bold"}}Profile metadata: {{color "cyan"}}{{.name}}{{color "reset"}} » {{.value | fromhtml | wrap "    " 79 | trim }}{{end}}
--- a/templates/themes/ansi/account.tmpl	Thu Sep 06 01:10:15 2018 +0200
+++ b/templates/themes/ansi/account.tmpl	Fri Sep 07 19:18:30 2018 +0200
@@ -10,7 +10,16 @@
   Note: {{color "yellow"}}{{. | fromhtml | wrap "   " 79 | trim}}{{color "reset"}}{{end}}{{end}}
 {{- if eq .locked true}}
   Locked: true{{end}}
+{{- if eq .bot true}}
+  Bot: true{{end}}
 {{- with .moved}}
   MOVED to account ID: {{color "red"}}{{.id}}{{color "reset"}}  {{color "magenta"}}@{{.username}}{{color "reset"}}
     UID: {{color "red"}}{{.acct}}{{color "reset"}}
     Display name: {{color "black,,bold"}}{{.display_name}}{{color "reset"}}{{end}}
+{{- with .source}}
+  Default Privacy: {{.privacy}}
+  Sensitive by default: {{.sensitive}}
+{{- if .language}}
+  Default Language: {{.language}}{{end}}{{end}}
+{{- range .fields}}
+  . {{color ",,bold"}}Profile metadata: {{color "cyan"}}{{.name}}{{color "reset"}} » {{.value | fromhtml | wrap "    " 79 | trim }}{{end}}