Sync with Madon library 1.6: Some calls return a Relationship entity
Update PlainPrinter and themes to outline the relationship ID
is actually an account ID.
--- a/cmd/accounts.go Sun May 21 12:31:32 2017 +0200
+++ b/cmd/accounts.go Fri May 26 12:05:50 2017 +0200
@@ -394,11 +394,14 @@
}
obj = statusList
case "follow":
+ var relationship *madon.Relationship
if opt.unset {
- err = gClient.UnfollowAccount(opt.accountID)
+ relationship, err = gClient.UnfollowAccount(opt.accountID)
+ obj = relationship
} else {
if opt.accountID > 0 {
- err = gClient.FollowAccount(opt.accountID)
+ relationship, err = gClient.FollowAccount(opt.accountID)
+ obj = relationship
} else {
var account *madon.Account
account, err = gClient.FollowRemoteAccount(opt.remoteUID)
@@ -417,17 +420,21 @@
err = gClient.FollowRequestAuthorize(opt.accountID, !opt.rejectFR)
}
case "block":
+ var relationship *madon.Relationship
if opt.unset {
- err = gClient.UnblockAccount(opt.accountID)
+ relationship, err = gClient.UnblockAccount(opt.accountID)
} else {
- err = gClient.BlockAccount(opt.accountID)
+ relationship, err = gClient.BlockAccount(opt.accountID)
}
+ obj = relationship
case "mute":
+ var relationship *madon.Relationship
if opt.unset {
- err = gClient.UnmuteAccount(opt.accountID)
+ relationship, err = gClient.UnmuteAccount(opt.accountID)
} else {
- err = gClient.MuteAccount(opt.accountID)
+ relationship, err = gClient.MuteAccount(opt.accountID)
}
+ obj = relationship
case "favourites":
var statusList []madon.Status
statusList, err = gClient.GetFavourites(limOpts)
--- a/printer/plainprinter.go Sun May 21 12:31:32 2017 +0200
+++ b/printer/plainprinter.go Fri May 26 12:05:50 2017 +0200
@@ -225,7 +225,7 @@
}
func (p *PlainPrinter) plainPrintRelationship(r *madon.Relationship, w io.Writer, indent string) error {
- indentedPrint(w, indent, true, false, "ID", "%d", r.ID)
+ indentedPrint(w, indent, true, false, "Account ID", "%d", r.ID)
indentedPrint(w, indent, false, false, "Following", "%v", r.Following)
indentedPrint(w, indent, false, false, "Followed-by", "%v", r.FollowedBy)
indentedPrint(w, indent, false, false, "Blocking", "%v", r.Blocking)
--- a/templates/themes/ansi-dark/relationship.tmpl Sun May 21 12:31:32 2017 +0200
+++ b/templates/themes/ansi-dark/relationship.tmpl Fri May 26 12:05:50 2017 +0200
@@ -1,4 +1,4 @@
-- ID: {{color "red"}}{{printf "%.0f" .id}}{{color "reset"}}
+- Account ID: {{color "red"}}{{printf "%.0f" .id}}{{color "reset"}}
Following: {{.following}}
Followed-by: {{.followed_by}}
Blocking: {{.blocking}}
--- a/templates/themes/ansi/relationship.tmpl Sun May 21 12:31:32 2017 +0200
+++ b/templates/themes/ansi/relationship.tmpl Fri May 26 12:05:50 2017 +0200
@@ -1,4 +1,4 @@
-- ID: {{color "red"}}{{printf "%.0f" .id}}{{color "reset"}}
+- Account ID: {{color "red"}}{{printf "%.0f" .id}}{{color "reset"}}
Following: {{.following}}
Followed-by: {{.followed_by}}
Blocking: {{.blocking}}