File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1109,6 +1109,13 @@ bool FolderMan::isSwitchToVfsNeeded(const FolderDefinition &folderDefinition) co
11091109 return result;
11101110}
11111111
1112+ #ifdef BUILD_FILE_PROVIDER_MODULE
1113+ bool FolderMan::canPollFileProviderEtag (const AccountState &accountState)
1114+ {
1115+ return accountState.isConnected ();
1116+ }
1117+ #endif
1118+
11121119void FolderMan::slotEtagPollTimerTimeout ()
11131120{
11141121 qCInfo (lcFolderMan) << " Etag poll timer timeout" ;
@@ -1139,6 +1146,11 @@ void FolderMan::slotEtagPollTimerTimeout()
11391146 for (const auto &accountState : accounts) {
11401147 const auto account = accountState->account ();
11411148
1149+ if (!canPollFileProviderEtag (*accountState)) {
1150+ qCDebug (lcFolderMan) << " Account" << account->displayName () << " is not connected, skipping File Provider ETag check." ;
1151+ continue ;
1152+ }
1153+
11421154 // Skip accounts that don't have a File Provider domain
11431155 if (!Mac::FileProvider::instance ()->domainManager ()->domainForAccount (account.data ())) {
11441156 qCDebug (lcFolderMan) << " Account" << account->displayName () << " has no file provider domain, skipping." ;
Original file line number Diff line number Diff line change @@ -357,6 +357,11 @@ private slots:
357357 void runEtagJobsIfPossible (const QList<Folder *> &folderMap);
358358 void runEtagJobIfPossible (Folder *folder);
359359
360+ #ifdef BUILD_FILE_PROVIDER_MODULE
361+ /* * @brief Returns whether the account state permits File Provider ETag polling. */
362+ [[nodiscard]] static bool canPollFileProviderEtag (const AccountState &accountState);
363+ #endif
364+
360365 bool pushNotificationsFilesReady (const OCC ::AccountPtr &account);
361366
362367 [[nodiscard]] bool isSwitchToVfsNeeded (const FolderDefinition &folderDefinition) const ;
Original file line number Diff line number Diff line change @@ -609,6 +609,30 @@ private slots:
609609 }
610610
611611#ifdef BUILD_FILE_PROVIDER_MODULE
612+ void testFileProviderEtagPollingRequiresConnectedAccount ()
613+ {
614+ const auto accountState = std::make_unique<FakeAccountState>(Account::create ());
615+ QVERIFY (FolderMan::canPollFileProviderEtag (*accountState));
616+
617+ const auto disconnectedStates = {
618+ AccountState::SignedOut,
619+ AccountState::Disconnected,
620+ AccountState::ServiceUnavailable,
621+ AccountState::RedirectDetected,
622+ AccountState::MaintenanceMode,
623+ AccountState::NetworkError,
624+ AccountState::ConfigurationError,
625+ AccountState::AskingCredentials,
626+ AccountState::NeedToSignTermsOfService,
627+ };
628+
629+ for (const auto state : disconnectedStates) {
630+ accountState->setStateForTesting (state);
631+ QVERIFY2 (!FolderMan::canPollFileProviderEtag (*accountState),
632+ qPrintable (AccountState::stateString (state)));
633+ }
634+ }
635+
612636 void testAddFolderRefusedWhenFileProviderModeEnabled ()
613637 {
614638 _fm.reset ({});
You can’t perform that action at this time.
0 commit comments