Skip to content

Commit

Permalink
Make an early return when canShare() is false in ShareModel::initShar…
Browse files Browse the repository at this point in the history
…eManager

Signed-off-by: Claudio Cambra <[email protected]>
  • Loading branch information
claucambra committed Jul 12, 2023
1 parent f2d5988 commit cc95a1e
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions src/gui/filedetails/sharemodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -325,18 +325,15 @@ void ShareModel::initShareManager()
{
if (!_accountState || _accountState->account().isNull()) {
return;
}

bool sharingPossible = true;
if (!canShare()) {
} else if (!canShare()) {
qCWarning(lcSharing) << "The file cannot be shared because it does not have sharing permission.";
sharingPossible = false;
return;
}

if (_manager.isNull() && sharingPossible) {
if (_manager.isNull()) {
_manager.reset(new ShareManager(_accountState->account(), this));
connect(_manager.data(), &ShareManager::sharesFetched, this, &ShareModel::slotSharesFetched);
connect(_manager.data(), &ShareManager::shareCreated, this, [&] {
connect(_manager.data(), &ShareManager::shareCreated, this, [this] {
_manager->fetchShares(_sharePath);
});
connect(_manager.data(), &ShareManager::linkShareCreated, this, &ShareModel::slotAddShare);
Expand Down

0 comments on commit cc95a1e

Please sign in to comment.