-
Notifications
You must be signed in to change notification settings - Fork 671
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow to trigger a backup sync using the socket api #8437
Conversation
325b15e
to
dcda87f
Compare
Is camel case in json a bad idea? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome work!
_remotePath = args[QLatin1String("remotePath")].toString(); | ||
_pattern = args[QLatin1String("pattern")].toString(); | ||
// TODO: use uuid | ||
const auto accname = args[QLatin1String("account")][QLatin1String("name")].toString(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick: QLatin1String -> QStringLiteral ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Json has an overload and as the string is not actually used, besides the lookup, QLatin1String should be slightly better 🙈
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens, when the remote path is not empty?
Should we define what should happen and possibly write a test for that? 🙈
@@ -866,8 +882,7 @@ void SocketApi::sendSharingContextMenuOptions(const FileData &fileData, SocketLi | |||
// If sharing is globally disabled, do not show any sharing entries. | |||
// If there is no permission to share for this file, add a disabled entry saying so | |||
if (isOnTheServer && !record._remotePerm.isNull() && !record._remotePerm.hasPermission(RemotePermissions::CanReshare)) { | |||
listener->sendMessage(QLatin1String("MENU_ITEM:DISABLED:d:") + (!record.isDirectory() | |||
? tr("Resharing this file is not allowed") : tr("Resharing this folder is not allowed"))); | |||
listener->sendMessage(QLatin1String("MENU_ITEM:DISABLED:d:") + (!record.isDirectory() ? tr("Resharing this file is not allowed") : tr("Resharing this folder is not allowed"))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like a "Verschlimmbesserung".
maybe break it up into two real lines instead of a single statement.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clang format does that for some reason and as I moved the file it was touched...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well then move (!record.isDirectory() ? tr("Resharing this file is not allowed") : tr("Resharing this folder is not allowed"))
to a variable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't change that line I can also try to revert the format change....
dcda87f
to
a7e3319
Compare
connect(mkdir, &OCC::MkColJob::finishedWithoutError, _engine, &OCC::SyncEngine::startSync); | ||
connect(mkdir, &OCC::MkColJob::finishedWithError, this, [this](QNetworkReply *reply) { | ||
if (reply->error() == 202) { | ||
// folder does exist, we could also assert here if we want to enforce a backup over a sync |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could fail if the dir already exist as we don't really know what will happen in that case...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't know?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well I expect unintended things, but I guess it will mainly depend on the state of the remote and the local folder...
Kudos, SonarCloud Quality Gate passed! |
Test app output: