mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-22 04:55:48 +03:00
Revert "Discovery: consider also the "shared by me" as shared"
This reverts pull request 5313 (commit2d6e473a40
and2f3db04e87
) The problem is that this loads the server too much.
This commit is contained in:
parent
89f55cf9df
commit
efa7821dd2
6 changed files with 16 additions and 42 deletions
|
@ -20,7 +20,6 @@
|
|||
#include <QUrl>
|
||||
#include "account.h"
|
||||
#include <QFileInfo>
|
||||
#include <cstring>
|
||||
|
||||
namespace OCC {
|
||||
|
||||
|
@ -237,8 +236,7 @@ void DiscoverySingleDirectoryJob::start()
|
|||
QList<QByteArray> props;
|
||||
props << "resourcetype" << "getlastmodified" << "getcontentlength" << "getetag"
|
||||
<< "http://owncloud.org/ns:id" << "http://owncloud.org/ns:downloadURL"
|
||||
<< "http://owncloud.org/ns:dDC" << "http://owncloud.org/ns:permissions"
|
||||
<< "http://owncloud.org/ns:share-types";
|
||||
<< "http://owncloud.org/ns:dDC" << "http://owncloud.org/ns:permissions";
|
||||
if (_isRootPath)
|
||||
props << "http://owncloud.org/ns:data-fingerprint";
|
||||
|
||||
|
@ -310,25 +308,9 @@ static csync_vio_file_stat_t* propertyMapToFileStat(const QMap<QString,QString>
|
|||
} else {
|
||||
qWarning() << "permissions too large" << v;
|
||||
}
|
||||
} else if (property == "share-types" && !value.isEmpty()) {
|
||||
// Since QMap is sorted, "share-types" is always "permissions".
|
||||
if (file_stat->remotePerm[0] == '\0' || !(file_stat->fields & CSYNC_VIO_FILE_STAT_FIELDS_PERM)) {
|
||||
qWarning() << "Server returned a share type, but no permissions?";
|
||||
} else {
|
||||
// S means shared with me.
|
||||
// But for our purpose, we want to know if the file is shared. It does not matter
|
||||
// if we are the owner or not.
|
||||
// Piggy back on the persmission field 'S'
|
||||
if (!std::strchr(file_stat->remotePerm, 'S')) {
|
||||
if (std::strlen(file_stat->remotePerm) < sizeof(file_stat->remotePerm)-1) {
|
||||
std::strcat(file_stat->remotePerm, "S");
|
||||
} else {
|
||||
qWarning() << "permissions too large" << file_stat->remotePerm;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return file_stat;
|
||||
}
|
||||
|
||||
|
|
|
@ -17,12 +17,12 @@
|
|||
|
||||
namespace OCC {
|
||||
SyncFileStatus::SyncFileStatus()
|
||||
:_tag(StatusNone), _shared(false)
|
||||
:_tag(StatusNone), _sharedWithMe(false)
|
||||
{
|
||||
}
|
||||
|
||||
SyncFileStatus::SyncFileStatus(SyncFileStatusTag tag)
|
||||
:_tag(tag), _shared(false)
|
||||
:_tag(tag), _sharedWithMe(false)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -37,14 +37,14 @@ SyncFileStatus::SyncFileStatusTag SyncFileStatus::tag() const
|
|||
return _tag;
|
||||
}
|
||||
|
||||
void SyncFileStatus::setShared(bool isShared)
|
||||
void SyncFileStatus::setSharedWithMe(bool isShared)
|
||||
{
|
||||
_shared = isShared;
|
||||
_sharedWithMe = isShared;
|
||||
}
|
||||
|
||||
bool SyncFileStatus::shared() const
|
||||
bool SyncFileStatus::sharedWithMe() const
|
||||
{
|
||||
return _shared;
|
||||
return _sharedWithMe;
|
||||
}
|
||||
|
||||
QString SyncFileStatus::toSocketAPIString() const
|
||||
|
@ -72,7 +72,7 @@ QString SyncFileStatus::toSocketAPIString() const
|
|||
statusString = QLatin1String("ERROR");
|
||||
break;
|
||||
}
|
||||
if(canBeShared && _shared) {
|
||||
if(canBeShared && _sharedWithMe) {
|
||||
statusString += QLatin1String("+SWM");
|
||||
}
|
||||
|
||||
|
|
|
@ -43,18 +43,18 @@ public:
|
|||
void set(SyncFileStatusTag tag);
|
||||
SyncFileStatusTag tag() const;
|
||||
|
||||
void setShared( bool isShared );
|
||||
bool shared() const;
|
||||
void setSharedWithMe( bool isShared );
|
||||
bool sharedWithMe() const;
|
||||
|
||||
QString toSocketAPIString() const;
|
||||
private:
|
||||
SyncFileStatusTag _tag;
|
||||
bool _shared;
|
||||
bool _sharedWithMe;
|
||||
|
||||
};
|
||||
|
||||
inline bool operator==(const SyncFileStatus &a, const SyncFileStatus &b) {
|
||||
return a.tag() == b.tag() && a.shared() == b.shared();
|
||||
return a.tag() == b.tag() && a.sharedWithMe() == b.sharedWithMe();
|
||||
}
|
||||
|
||||
inline bool operator!=(const SyncFileStatus &a, const SyncFileStatus &b) {
|
||||
|
|
|
@ -272,7 +272,7 @@ SyncFileStatus SyncFileStatusTracker::resolveSyncAndErrorStatus(const QString &r
|
|||
}
|
||||
|
||||
if (isShared)
|
||||
status.setShared(true);
|
||||
status.setSharedWithMe(true);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
|
|
@ -263,7 +263,6 @@ public:
|
|||
QDateTime lastModified = QDateTime::currentDateTime().addDays(-7);
|
||||
QString etag = generateEtag();
|
||||
QByteArray fileId = generateFileId();
|
||||
QByteArray extraDavProperties;
|
||||
qint64 size = 0;
|
||||
char contentChar = 'W';
|
||||
|
||||
|
@ -340,7 +339,6 @@ public:
|
|||
xml.writeTextElement(davUri, QStringLiteral("getetag"), fileInfo.etag);
|
||||
xml.writeTextElement(ocUri, QStringLiteral("permissions"), fileInfo.isShared ? QStringLiteral("SRDNVCKW") : QStringLiteral("RDNVCKW"));
|
||||
xml.writeTextElement(ocUri, QStringLiteral("id"), fileInfo.fileId);
|
||||
buffer.write(fileInfo.extraDavProperties);
|
||||
xml.writeEndElement(); // prop
|
||||
xml.writeTextElement(davUri, QStringLiteral("status"), "HTTP/1.1 200 OK");
|
||||
xml.writeEndElement(); // propstat
|
||||
|
@ -751,7 +749,7 @@ public:
|
|||
OCC::SyncEngine &syncEngine() const { return *_syncEngine; }
|
||||
|
||||
FileModifier &localModifier() { return _localModifier; }
|
||||
FileInfo &remoteModifier() { return _fakeQnam->currentRemoteState(); }
|
||||
FileModifier &remoteModifier() { return _fakeQnam->currentRemoteState(); }
|
||||
FileInfo currentLocalState() {
|
||||
QDir rootDir{_tempDir.path()};
|
||||
FileInfo rootTemplate;
|
||||
|
|
|
@ -371,15 +371,11 @@ private slots:
|
|||
|
||||
void sharedStatus() {
|
||||
SyncFileStatus sharedUpToDateStatus(SyncFileStatus::StatusUpToDate);
|
||||
sharedUpToDateStatus.setShared(true);
|
||||
sharedUpToDateStatus.setSharedWithMe(true);
|
||||
|
||||
FakeFolder fakeFolder{FileInfo::A12_B12_C12_S12()};
|
||||
fakeFolder.remoteModifier().insert("S/s0");
|
||||
fakeFolder.remoteModifier().appendByte("S/s1");
|
||||
fakeFolder.remoteModifier().insert("B/b3");
|
||||
fakeFolder.remoteModifier().find("B/b3")->extraDavProperties
|
||||
= "<oc:share-types><oc:share-type>0</oc:share-type></oc:share-types>";
|
||||
|
||||
StatusPushSpy statusSpy(fakeFolder.syncEngine());
|
||||
|
||||
fakeFolder.scheduleSync();
|
||||
|
@ -399,8 +395,6 @@ private slots:
|
|||
QEXPECT_FAIL("", "We currently only know if a new file is shared on the second sync, after a PROPFIND.", Continue);
|
||||
QCOMPARE(statusSpy.statusOf("S/s0"), sharedUpToDateStatus);
|
||||
QCOMPARE(statusSpy.statusOf("S/s1"), sharedUpToDateStatus);
|
||||
QCOMPARE(statusSpy.statusOf("B/b1").shared(), false);
|
||||
QCOMPARE(statusSpy.statusOf("B/b3"), sharedUpToDateStatus);
|
||||
|
||||
QCOMPARE(fakeFolder.currentLocalState(), fakeFolder.currentRemoteState());
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue