From 8b570f2e8f2dc96afbba1c5add402ab7292395a9 Mon Sep 17 00:00:00 2001
From: 23rd <23rd@vivaldi.net>
Date: Thu, 10 Nov 2022 12:30:10 +0300
Subject: [PATCH] Fixed duplicated transcribe buttons for video messages.

Fixed #25327.
---
 Telegram/SourceFiles/history/view/media/history_view_gif.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Telegram/SourceFiles/history/view/media/history_view_gif.cpp b/Telegram/SourceFiles/history/view/media/history_view_gif.cpp
index 438e1e26a..800b514d7 100644
--- a/Telegram/SourceFiles/history/view/media/history_view_gif.cpp
+++ b/Telegram/SourceFiles/history/view/media/history_view_gif.cpp
@@ -678,7 +678,7 @@ void Gif::draw(Painter &p, const PaintContext &context) const {
 					: InfoDisplayType::Image));
 		}
 		if (const auto size = bubble ? std::nullopt : _parent->rightActionSize()
-			; size || _transcribe) {
+			; size || (_transcribe && !rightAligned)) {
 			const auto rightActionWidth = size
 				? size->width()
 				: _transcribe->size().width();
@@ -702,7 +702,7 @@ void Gif::draw(Painter &p, const PaintContext &context) const {
 				paintTranscribe(p, fastShareLeft, fastShareTop, true, context);
 			}
 		}
-		if (_parent->hasOutLayout() && _transcribe) {
+		if (rightAligned && _transcribe) {
 			paintTranscribe(p, usex, fullBottom, false, context);
 		}
 	}