Commit Graph
4132 Commits
Author SHA1 Message Date
Dang Dat 255bd4eacd Implement fetchJson for workplace web 2026-09-03 17:26:41 +07:00
Dat H. Pham 7631a045e4 Translate vi, ru, fr, mn 2026-08-28 17:53:17 +07:00
Dat Dang c36ccffc96 TF-4728 Sentry logging drive attachment failure (#4776) 2026-08-28 17:03:51 +07:00
Dang Dat 398b550f33 HOTFIX Drive document nullable mimetype 2026-08-28 12:25:44 +07:00
Dang Dat f66156cce7 TF-4728 Identify which transfer failed in the callback-guard log
Problem: the guard around caller callbacks logs only the label and the
exception, so a Sentry event cannot be tied back to a specific drive
transfer within a batch.
Decision: index placeholders by task id in transfer() and pass the
matching placeholder into _notify, which attaches task id, file size and
mime type as log extras. File name is left out on purpose — extras reach
Sentry and the three remaining fields already correlate the event with
the chip and the upload request.

Addresses: 3860970649
https://github.com/linagora/tmail-flutter/pull/4767#discussion_r3860970649
2026-08-26 17:26:59 +07:00
Dang Dat 562a484727 TF-4728 Split the drive pick outcome branching out of the entry point
Problem: CodeScene flags handleDrivePickResult twice — cyclomatic
complexity 9 (threshold 9) and a complex conditional with 2 branches
(threshold 2). Both come from the same cause: the entry point decides
which toast to show as well as what to attach.

Decision: keep the entry point to the pick flow (split, insert, transfer)
and move each toast decision to its own named method. The dropped-docs
conditional is split as `droppedCount == 0 || !attachedAny` inside
_showDroppedDocsFailure, with the two-list check passed in as one
argument, so no single expression chains two operators. Behaviour is
unchanged — all 29 handler tests pass untouched.

Addresses: 3860581376, 3860587468
https://github.com/linagora/tmail-flutter/pull/4767#discussion_r3860581376
https://github.com/linagora/tmail-flutter/pull/4767#discussion_r3860587468
2026-08-26 17:26:59 +07:00
Dang Dat 34a8c164b1 TF-4728 Log every attachment upload failure, not only unshowable ones
Problem: the failure is logged only when there is no context to toast into, so
the common path leaves no record of which upload failed.
Decision: log first, then toast — the log line is the only durable trace once the
chip is removed.

Addresses: 3859378962
https://github.com/linagora/tmail-flutter/pull/4767#discussion_r3859378962
2026-08-26 17:26:59 +07:00
Dang Dat b9e2802724 TF-4728 Keep in-flight uploads across an attachment refresh
Problem: saving a draft while a drive transfer is waiting rebuilds the attachment
list from the server response, which has no entry for a chip that has no blob yet.
The chip and its cancel token are dropped while the request keeps running, so a
late success has nothing to resolve and the attachment disappears.
Decision: carry not-yet-completed states through the refresh instead of filtering
the server response, so the rule holds for any pending upload, not just drive.

Addresses: 3859504637
https://github.com/linagora/tmail-flutter/pull/4767#discussion_r3859504637
2026-08-26 17:26:59 +07:00
Dang Dat 7c9627982b TF-4728 Do not resolve a drive transfer that was cancelled mid-flight
Problem: cancellation is only checked before the upload call, so a response that
lands after the user removed the chip still fires onSuccess and toasts success.
Decision: re-check the cancel token right after the await and drop the result.
Cancellation resolves neither counter, matching the queued-task guard above it.

Addresses: 3859630902
https://github.com/linagora/tmail-flutter/pull/4767#discussion_r3859630902
2026-08-26 17:26:59 +07:00
Dang Dat ba9f591625 TF-4728 Contain caller callback throws inside the drive transfer runner
Problem: onPlaceholdersReady, onSuccess and onFailure are invoked unguarded, so a
throw from the composer's UploadController callbacks aborts Future.wait, strands
waiting chips and loses the batch outcome.
Decision: the runner owns the batch lifecycle, so it guards every caller callback
itself rather than trusting each call site. A throw from onPlaceholdersReady ends
the batch as not-started (the handler already toasts that), a throw from a
per-task callback is logged and contained to that task so siblings still resolve.

Addresses: 3859150764, 3859150765, 3859150766, 3859151445
https://github.com/linagora/tmail-flutter/pull/4767#discussion_r3859150764
https://github.com/linagora/tmail-flutter/pull/4767#discussion_r3859150765
https://github.com/linagora/tmail-flutter/pull/4767#discussion_r3859150766
https://github.com/linagora/tmail-flutter/pull/4767#discussion_r3859151445
2026-08-26 17:26:59 +07:00
Dang DatandCursor 66e18c5d43 TF-4728 Drive picker jmap implementation
review-comment: 3826784554

https://github.com/linagora/tmail-flutter/pull/4767#discussion_r3826784554

review-comment: 3826964437

https://github.com/linagora/tmail-flutter/pull/4767#discussion_r3826964437

review-comment: 3827029379

https://github.com/linagora/tmail-flutter/pull/4767#discussion_r3827029379

review-comment: 3827067099

https://github.com/linagora/tmail-flutter/pull/4767#discussion_r3827067099

review-comment: 3827112203

https://github.com/linagora/tmail-flutter/pull/4767#discussion_r3827112203

review-comment: 3827153966

https://github.com/linagora/tmail-flutter/pull/4767#discussion_r3827153966

review-comment: 3828671202

https://github.com/linagora/tmail-flutter/pull/4767#discussion_r3828671202

review-comment: 3828857602

https://github.com/linagora/tmail-flutter/pull/4767#discussion_r3828857602

review-comment: 5391955302

https://github.com/linagora/tmail-flutter/pull/4767#issuecomment-5391955302

review-comment: 3841473359, 3841484408

https://github.com/linagora/tmail-flutter/pull/4767#discussion_r3841473359

https://github.com/linagora/tmail-flutter/pull/4767#discussion_r3841484408

review-comment: 3841580769

https://github.com/linagora/tmail-flutter/pull/4767#discussion_r3841580769

review-comment: 3841909306

https://github.com/linagora/tmail-flutter/pull/4767#discussion_r3841909306

fixup! TF-4728 Drive picker jmap implementation

Fixes toast suppression regression surfaced by the test added in
81b6e05faf63aecf81ae4e97980f9e48bb67e916
https://github.com/linagora/tmail-flutter/commit/81b6e05faf63aecf81ae4e97980f9e48bb67e916

Claude-Session: https://claude.ai/code/session_01H7h265h6rRmMivviyMbNVh

review-comment: 3842242663

https://github.com/linagora/tmail-flutter/pull/4767#discussion_r3842242663

review-comment: 3842324987

https://github.com/linagora/tmail-flutter/pull/4767#discussion_r3842324987

review-comment: 3842341155

https://github.com/linagora/tmail-flutter/pull/4767#discussion_r3842341155

review-comment: 3842447793

https://github.com/linagora/tmail-flutter/pull/4767#discussion_r3842447793

review-comment: 3842492984

https://github.com/linagora/tmail-flutter/pull/4767#discussion_r3842492984

(test) some edge cases for concurrency runner

(test) mixed pick should toast when transfer cannot start

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-26 17:26:59 +07:00
dab246 5d5b6b0126 TF-4472 Fix draft save failure dialog 2026-08-26 15:26:07 +07:00
dab246 5541df9d3e TF-4678 Fix duplicate mailbox sidebar IDs 2026-08-26 10:12:55 +07:00
dab246 b21010e094 TF-4678: fix mobile mailbox sidebar spacing and feedback 2026-08-26 10:12:55 +07:00
dab246 a4d5ee51fd TF-4678: fix mailbox sidebar and icon behavior 2026-08-26 10:12:55 +07:00
dab246 6656ed79a8 TF-4678 refactor(mailbox): remove sidebar tree horizontal scrolling 2026-08-26 10:12:55 +07:00
dab246 5d26ea8308 TF-4678 feat(mailbox): support deep sidebar tree navigation 2026-08-26 10:12:55 +07:00
dab246 feaf6e0f4d TF-4678 refactor(mailbox): reuse expand mode state 2026-08-26 10:12:55 +07:00
dab246 98525e323d TF-4678 feat(mailbox): integrate linagora sidebar menu 2026-08-26 10:12:55 +07:00
e300fea934 TF-4728 Drive picker data layer (#4764)
* TF-4728 Drive picker data layer

* fixup! TF-4728 Drive picker data layer

* fixup! TF-4728 Drive picker data layer

review-comment: 3818227574

https://github.com/linagora/tmail-flutter/pull/4764#discussion_r3818227574

* fixup! TF-4728 Drive picker data layer

review-comment: 3818227592

https://github.com/linagora/tmail-flutter/pull/4764#discussion_r3818227592

* fixup! TF-4728 Drive picker data layer

review-comment: 3818227604

https://github.com/linagora/tmail-flutter/pull/4764#discussion_r3818227604

* fixup! TF-4728 Drive picker data layer

review-comment: 3818227608

https://github.com/linagora/tmail-flutter/pull/4764#discussion_r3818227608

* fixup! TF-4728 Drive picker data layer

review-comment: 3820850595

https://github.com/linagora/tmail-flutter/pull/4764#discussion_r3820850595

* fixup! TF-4728 Drive picker data layer

review-comment: r3826862549

https://github.com/linagora/tmail-flutter/pull/4764#discussion_r3826862549

* fixup! TF-4728 Drive picker data layer

review-comment: r3826914510

https://github.com/linagora/tmail-flutter/pull/4764#discussion_r3826914510

* fixup! TF-4728 Drive picker data layer

review-comment: r3826922420

https://github.com/linagora/tmail-flutter/pull/4764#discussion_r3826922420

* fixup! TF-4728 Drive picker data layer

review-comment: r3827010446, r3826926449, r3826947008

https://github.com/linagora/tmail-flutter/pull/4764#discussion_r3827010446

https://github.com/linagora/tmail-flutter/pull/4764#discussion_r3826926449

https://github.com/linagora/tmail-flutter/pull/4764#discussion_r3826947008

* fixup! TF-4728 Drive picker data layer

review-comment: r3827015957

https://github.com/linagora/tmail-flutter/pull/4764#discussion_r3827015957

* fixup! TF-4728 Drive picker data layer

review-comment: 5365193125

https://github.com/linagora/tmail-flutter/pull/4764#issuecomment-5365193125

* test: pin upload-from-url URI gate, hive persist, and empty-body POST

Co-authored-by: Cursor <cursoragent@cursor.com>

* fixup! TF-4728 Drive picker data layer

review-comment: 3829217029

https://github.com/linagora/tmail-flutter/pull/4764#discussion_r3829217029

* fixup! TF-4728 Drive picker data layer

review-comment: 3829254358

https://github.com/linagora/tmail-flutter/pull/4764#discussion_r3829254358

* fixup! TF-4728 Drive picker data layer

review-comment: 3829298409

https://github.com/linagora/tmail-flutter/pull/4764#discussion_r3829298409

* fixup! TF-4728 Drive picker data layer

review-comment: 3840752770, 3840801835

https://github.com/linagora/tmail-flutter/pull/4764#discussion_r3840752770

https://github.com/linagora/tmail-flutter/pull/4764#discussion_r3840801835

* fixup! TF-4728 Drive picker data layer

review-comment: 3841010607

https://github.com/linagora/tmail-flutter/pull/4764#discussion_r3841010607

* fixup! TF-4728 Drive picker data layer

review-comment: 3841010610

https://github.com/linagora/tmail-flutter/pull/4764#discussion_r3841010610

* fixup! TF-4728 Drive picker data layer

review-comment: 3841010614

https://github.com/linagora/tmail-flutter/pull/4764#discussion_r3841010614

* fixup! test: pin upload-from-url URI gate, hive persist, and empty-body POST

review-comment: 3841010619

https://github.com/linagora/tmail-flutter/pull/4764#discussion_r3841010619

* fixup! test: pin upload-from-url URI gate, hive persist, and empty-body POST

review-comment: 3841010623

https://github.com/linagora/tmail-flutter/pull/4764#discussion_r3841010623

---------

Co-authored-by: Dat H. Pham <dphamhoang@linagora.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-25 10:15:13 +07:00
dab246 0fad00feaa refactor(search): centralize visible email state sync 2026-08-21 14:47:03 +07:00
dab246 a9fa13e77f test(search): add e2e test for responsive action state sync 2026-08-21 14:47:03 +07:00
dab246 5d3f62dbd1 fix(search): sync mobile action state 2026-08-21 14:47:03 +07:00
Dang Dat 7ae77da417 TF-4728 Drive picker size limit 2026-08-19 19:41:11 +07:00
Dat H. Pham c70a4e943f fix(composer): correct recipient expand button web/native branching
The expand-button condition mis-expanded the web check, so the compact
chevron could render alongside the inline prefix buttons on the web path.
Rewrite it as the exact complement of the inline-buttons gate
(isMobileResponsive || !_isWeb), keeping the two recipient-add
affordances mutually exclusive while still showing the chevron on native
tablet.

Add widget tests for the native-mobile, web-wide, native-tablet and
narrow-web (web-responsive) branches.

(cherry picked from commit b503de2278)
2026-08-19 15:22:34 +07:00
Dat H. Pham b546ab0347 Add chevron button for tablet composer
(cherry picked from commit 8c0d9db031)
2026-08-19 15:22:34 +07:00
Dat H. Pham 703217f425 Fix gray_screen composer when binding with wrong composerId
(cherry picked from commit ad21ed3da5)
2026-08-19 15:22:34 +07:00
dab246 19a2d21c95 TF-4758 Default DriveAttachmentConfig.isEnabled to true and drop DriveAttachmentPreferenceOption.isExperimental 2026-08-17 15:09:45 +07:00
Huy Quang Nguyen b4b73554ed TF-4744: Inherit typography from design system TwakeInter (#4749) 2026-08-14 14:33:17 +07:00
Dat DangandDat H. Pham 20cf265069 TF-4726 Composable validator (#4729)
* TF-4726 Composable validator

* fixup! TF-4726 Composable validator

* fixup! TF-4726 Composable validator

* fixup! TF-4726 Composable validator

* fixup! TF-4726 Composable validator

* fixup! TF-4726 Composable validator

* fixup! TF-4726 Composable validator

* fixup! fixup! TF-4726 Composable validator

---------

Co-authored-by: Dat H. Pham <dphamhoang@linagora.com>
2026-08-12 16:43:49 +07:00
Dat H. Pham bfde3527ab refactor(auth): decouple web refresh error handling from the mobile handler
The web handler routed its two keep-the-session paths through the mobile one,
which had since grown a leading force-logout branch. That branch could not fire
on web — it re-tests the same classifier call the web handler had already
evaluated to false — but the safety rested on a call-ordering invariant inside
the web handler rather than on anything structural. Adding an earlier delegation
would have quietly made it live and started logging web users out on failures
already ruled transient.

Extract the tail both handlers shared into _propagateKeepingSession and have web
call it directly, so the logout branch leaves web's call graph entirely.

Cover the behaviour too: an OAuthAuthorizationError — the mobile error shape —
arriving on web must keep the session. Verified by mutation: re-coupling both
delegation sites and pointing the guard at the mobile classifier fails exactly
these two tests.

Pure move, no behaviour change. Also splits a doc comment that had been merged
into the paragraph above it.
2026-08-12 11:20:53 +07:00
Dat H. Pham fa12f71986 fix(auth): stop double-reporting a rejected mobile token refresh to Sentry
A confirmed mobile rejection was rethrown out of the refresh helper, caught by
the outer handler in onError(), logged there as a generic event, and only then
routed to the platform handler that logged the real structured one. One failure,
two events, the less useful of them arriving first.

Route a rejection the platform handler already classifies straight to it, so the
outer catch never sees it.

Failures that stay unclassified are still rethrown on purpose: the generic event
is then their only trace, and dropping it would make them invisible. Both halves
are covered — one event for a rejection, the generic event retained for the rest.
2026-08-12 11:20:53 +07:00
Dat H. Pham aad7df7b34 fix(auth): force logout when mobile refresh is rejected by the token endpoint
On mobile the refresh runs through flutter_appauth (native), so a rejected
refresh token never reaches Dio and the statusCode == 400 branch is unreachable.
The rejection arrives as an OAuthAuthorizationError carrying the RFC 6749 code
from the response body, and nothing handled it: the dead session was kept, and
because the refresh-attempt marker lives on the request, every new request
retried the same doomed refresh. The mailbox spun forever instead of sending
the user back to login.

Force the logout when — and only when — the classifier confirms a bad-grant
code. Transient codes (server_error, temporarily_unavailable) and failures that
never reached the OAuth server keep the session, so a flaky mobile connection
still does not sign the user out.

Also pin the native-error to domain-error boundary the fix depends on. Every
test so far constructed OAuthAuthorizationError directly, leaving both the
conversion in handleException and the wiring that reaches it unproven — a
plugin upgrade that stopped populating platformErrorDetails.error would have
resurrected the bug with the suite still green. The client test is verified by
mutation: dropping the catch that calls handleException fails it.

The mobile invalid_grant case in the stale-401 group changes verdict here: it
asserted the session survived, which was the bug.
2026-08-12 11:20:53 +07:00
Dat H. Pham 3dabbbe940 refactor(auth): split refresh-token error classification per platform
Web and mobile refresh through different plugins, so the same token-endpoint
rejection surfaces as a different Dart type on each platform. Classification
lived in a single web-shaped class, which left no place to describe the native
error shape without letting web's types influence a mobile verdict.

Extract the platform-independent rules — the RFC 6749 bad-grant code set,
AccessTokenInvalidException, Dio 400/401, the Sentry extras skeleton — into an
abstract RefreshTokenErrorClassifier, and leave each subclass to recognise only
the shape its own plugin throws.

The interceptor now resolves its classifier from the platform. That resolution
is lazy rather than done in the constructor: the interceptor is built before the
platform is known under test, so reading PlatformInfo too early would pin the
wrong one.

Behaviour is unchanged; the web classifier keeps its existing verdicts.
2026-08-12 11:20:53 +07:00
dab246 6a3ba5f6ef Extract RouteUtils.dashboardBrowserRouteTitle, fix reconcile idle no-op, expose searchLayoutCoordinator @visibleForTesting, use selectedMailboxForDisplay in quick search 2026-08-10 16:22:45 +07:00
dab246 e5f5e16c4e Fix search result/state leaks: resize & system-back restore, search URL labelId 2026-08-10 16:22:45 +07:00
dab246 870169098a Remove unused imports in ThreadController and thread_controller_test 2026-08-10 16:22:45 +07:00
dab246 9ec3883c4a Record desktop ownership in _handoffToDesktop so takeDesktopSearchPresentation succeeds after mobile-to-desktop handoff 2026-08-10 16:22:45 +07:00
dab246 7bf800ba19 Use selectedMailboxForDisplay in buildLabelsList to hide label highlight during search 2026-08-10 16:22:45 +07:00
dab246 6e81ddf1d5 Add SearchLayoutCoordinator to hand off the search list across web breakpoints 2026-08-10 16:22:45 +07:00
Dat Vu f50b765378 TF-4647 SSOT Part 6— Wire dashboard filter into search SSOT & remove position (#4714) 2026-08-10 16:22:45 +07:00
Dat Vu e1033744a1 TF-4646 SSOT Part 5.2 — PR 3 — Retire the last web-search Obx/memory state to Riverpod (#4707) 2026-08-10 16:22:45 +07:00
Dat Vu 42053d2200 TF-4646 SSOT Part 5.1 — PR 2 — Route web results through the central executor + search SSOT (#4706) 2026-08-10 16:22:45 +07:00
dab246 f13fbc2033 TF-4646 Use SearchConstants.inputDebounceDuration in SearchInputFormWidget
Replace hardcoded 300ms literal so suggestion debounce and input→SSOT commit share one constant.
2026-08-10 16:22:45 +07:00
dab246 9bbd8c18db TF-4646 Add SearchViewStateNotifier as search view-state SSOT 2026-08-10 16:22:45 +07:00
dab246 0f58e40fd2 TF-4646 Add search view-state value objects (activation, constants, view state) 2026-08-10 16:22:45 +07:00
Dat Vu a4802c2c3d TF-4645 SSOT Part 4.2 - Add more unit test for SSOT Part 4 — Migrate mobile search to the central executor (#4703) 2026-08-10 16:22:45 +07:00
dab246 37416d713e TF-4645 Route search urgent exceptions via InteractorConsumer, drop pendingUrgentException
SearchEmailNotifier consumes interactors through the shared seam (auto routing across all intents); SearchEmailController gates its retry toast with isUrgentException; SearchEmailResult drops the pendingUrgentException field and reverts to pure display state.
2026-08-10 16:22:45 +07:00
dab246 a358b4b2d6 TF-4645 Add InteractorConsumer seam and isUrgentException predicate
consumeInteractor centralizes interactor result folding with automatic urgent-exception routing (ADR-0103) for Riverpod notifiers bypassing consumeState. isUrgentException mirrors that routing's resolution so consumers can suppress fallback UI without re-routing.
2026-08-10 16:22:45 +07:00
dab246 96050e1f83 TF-4645 Dedup load-more, unify urgent routing, skip unchanged result rebuild
- _runLoadMore drops emails already in the list (_dropAlreadyLoaded) so a same-timestamp page boundary never duplicates rows.
- Rename SearchEmailResult.loadMoreException to pendingUrgentException and have _runRefresh surface it like _runLoadMore, so the notifier no longer routes urgent exceptions itself; SearchEmailController._routePendingUrgentException handles load-more and refresh through the same path as a full-search error.
- _applySearchResult rebuilds the presentation list only when result.emails changes identity, skipping the map/combine/sync on load-more spinner toggles.
2026-08-10 16:22:45 +07:00