android, desktop: text sent with forwarded messages can be empty

Đang mở Phù hợp với người mới
#8,291 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
85/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
kotlin
Lĩnh vực
desktop, mobile

Hướng nghiên cứu

Bắt đầu trong ComposeView.kt quanh L842-L847, nơi các mục được chuyển tiếp được gửi sau lệnh gọi API chuyển tiếp, và đọc checkLinkPreview() tại L611-L612 để thấy rằng nó đọc composeState.value trực tiếp. Theo dõi cách cs được ghi lại trước lệnh gọi và so sánh với các nhánh gửi khác; văn bản được chuyển tiếp nên dùng trạng thái đã ghi lại đó. Hoàn tất nghĩa là việc gửi chuyển tiếp không còn phụ thuộc vào trạng thái compose có thể bị đặt lại bởi việc chuyển chat hoặc recomposition, với chú thích tại L845-L846 được xóa nếu nó không còn áp dụng.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

bug desktop

Problem

Android and desktop. Messages are forwarded with text typed in the compose field. In rare cases the text message sent after the forwarded items is empty: the item shows no text and has no Copy option, while text was typed.

The text is sent as a reply to the last forwarded item, after the forward API call returns. The condition is checked on the compose state captured at send, but the sent content is read from the current compose state:

When the compose state is reset during the forward API call, MCText("") is sent. Copy is hidden for items with empty text (ChatItemView.kt#L425-L428).

Typing is blocked while inProgress is set (desktop, android), so the compose state is changed during the call only by these resets:

  1. Chat switch: the compose state is cleared and the draft of the opened chat is loaded (L1407-L1417, since #7308). The message is still sent to the chat where the forward was sent, so that chat receives either empty text or the draft of the opened chat. The draft also stays in the opened chat.
  2. ComposeView re-entering composition clears an in-progress state (L1628-L1632); ComposeView is composed only when no items are selected (ChatView.kt#L302).
  3. Sending disabled in the chat (L1440-L1444).

The window is longer when forwarding files or many items.

iOS checks and reads the current state (ComposeView.swift#L1525-L1526), so an empty message is not sent there.

Steps to reproduce (expected from code, not yet reproduced)

  1. Desktop: chat A, chat B with a saved draft.
  2. In chat A, forward several messages with files, type text, send.
  3. Before the forwarded items appear, open chat B.

Expected: chat A receives the forwarded items and the typed text.
Actual: chat A receives the forwarded items and an empty message, or the draft of chat B.

Proposed fix

Send the content of the compose state captured at send, as the other send branches do, and remove the comment at L845-L846 (typing is blocked while the message is in progress):

-            // the current state, not cs: forwarding is never reached from the chat switch, and keeps what was typed
-            // while it was in flight
-            send(chat, checkLinkPreview(), quoted = message.id, live = false, ttl = ttl, mentions = cs.memberMentions, sign = sign)
+            send(chat, checkLinkPreview(cs), quoted = message.id, live = false, ttl = ttl, mentions = cs.memberMentions, sign = sign)

Alternative: check the current state, as iOS does. It drops the confirmed text without notice, so it is not proposed.

Ngôn ngữ chính
Haskell
Star
19.7k
Fork
1.3k
Merge trung bình
1 ngày 10 giờ
Pull request đã merge (30 ngày)
236

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của simplex-chat/simplex-chat

Tất cả issue của simplex-chat/simplex-chat

Issue tương tự

Thêm issue về Haskell

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.