fixed bug that prevents sending messages if reply was triggered in a different chat

This commit is contained in:
2026-08-14 09:47:56 +02:00
parent d27312afdf
commit 09d4ecda78
4 changed files with 41 additions and 2 deletions
+7 -1
View File
@@ -4,16 +4,22 @@ import 'app_exception.dart';
class TalkException extends AppException {
final TalkError source;
TalkException(this.source)
TalkException(this.source, {String? technicalDetails})
: super(
userMessage: _mapMessage(source),
technicalDetails:
technicalDetails ??
'Talk ${source.status} (${source.code}): ${source.message}',
allowRetry: source.code >= 500,
);
static String _mapMessage(TalkError e) {
switch (e.code) {
case 400:
return 'Talk hat diese Anfrage abgelehnt. Bitte lade den Chat neu und '
'versuche es erneut.';
case 413:
return 'Diese Nachricht ist zu lang.';
case 401:
return 'Bitte melde dich erneut an, um auf Talk zuzugreifen.';
case 403:
+12
View File
@@ -6,8 +6,10 @@ import '../../api_params.dart';
import '../../api_response.dart';
import '../../errors/network_exception.dart';
import '../../errors/parse_exception.dart';
import '../../errors/talk_exception.dart';
import '../../http_errors.dart';
import '../nextcloud_ocs.dart';
import 'talk_error.dart';
abstract class TalkApi<T extends ApiResponse?> {
String path;
@@ -49,6 +51,16 @@ abstract class TalkApi<T extends ApiResponse?> {
// logs surface the cause instead of just the bare status code.
final detail = httpErrorDetail('Talk $endpoint', data.body, status);
log(detail);
// Talk's own codes need their own wording: a 400/412/413 here is a
// rejected request, not a struggling server, and "try again later"
// would send the user in circles. 401/403/404 keep the shared mapping
// so the auth handling stays in one place.
if (status == 400 || status == 412 || status == 413 || status == 429) {
throw TalkException(
TalkError('failure', status, ''),
technicalDetails: detail,
);
}
throwForStatus(status, detail);
}