cmd/relui: disable posting to X

Posting to X has been broken during releases for some time. This
change temporarily disables the feature until a permanent
direction is decided moving forward.

Updates golang/go#81255

Change-Id: I1f8e0ba1cb3e2480840fbddfc15ed4fd0537bda9
Reviewed-on: https://go-review.googlesource.com/c/build/+/825024
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
diff --git a/cmd/relui/main.go b/cmd/relui/main.go
index 264141e..78a71d9 100644
--- a/cmd/relui/main.go
+++ b/cmd/relui/main.go
@@ -169,6 +169,10 @@
 	default:
 		mailFunc = task.ReleaseCoordinatorAsTheMailSender{ApproveAction: relui.ApproveActionDep(dbPool)}.SendMail
 	}
+	var twitterClient task.Poster = disabledTwitterClient{}
+	if false && twitterAPI != (secret.TwitterCredentials{}) { // TODO(go.dev/issue/81255): Restore when posting to X is functioning again.
+		twitterClient = task.NewTwitterClient(twitterAPI)
+	}
 	var mastodonClient task.Poster
 	if mastodonAPI != (secret.MastodonCredentials{}) {
 		var err error
@@ -194,7 +198,7 @@
 			AnnounceMailHeader: annMail,
 		},
 		SocialMediaTasks: task.SocialMediaTasks{
-			TwitterClient:  task.NewTwitterClient(twitterAPI),
+			TwitterClient:  twitterClient,
 			MastodonClient: mastodonClient,
 			BlueskyClient:  blueskyClient,
 		},
@@ -539,3 +543,17 @@
 		return nil
 	})
 }
+
+// disabledTwitterClient is a task.Poster that logs and skips posting while posting to X is disabled.
+// TODO(go.dev/issue/81255): Delete this once posting to X is functioning again.
+type disabledTwitterClient struct{}
+
+func (disabledTwitterClient) Post(text string) (string, error) {
+	log.Println("posting to X is temporarily disabled; see https://go.dev/issue/81255")
+	return "(disabled: https://go.dev/issue/81255)", nil
+}
+
+func (disabledTwitterClient) PostTweet(text string, imagePNG []byte, altText string) (string, error) {
+	log.Println("posting to X is temporarily disabled; see https://go.dev/issue/81255")
+	return "(disabled: https://go.dev/issue/81255)", nil
+}