diff options
author | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2018-01-15 11:20:48 +0900 |
---|---|---|
committer | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2018-01-15 11:20:48 +0900 |
commit | 5d6360b641084cf95a7f30bb760abdb7a73ebd27 (patch) | |
tree | ae78fac47a1037657b233c408121bc17b0ae80b0 | |
parent | 0de5e3b421633bb58805aa4b9d1bf3f07535702c (diff) | |
download | libquotient-5d6360b641084cf95a7f30bb760abdb7a73ebd27.tar.gz libquotient-5d6360b641084cf95a7f30bb760abdb7a73ebd27.zip |
EventContent: provide mediaId in the top-level JSON, not in "info" subobject
Given that it's a sidedoor anyway, it should at least be straightforward to use.
-rw-r--r-- | events/eventcontent.cpp | 1 | ||||
-rw-r--r-- | events/eventcontent.h | 5 |
2 files changed, 4 insertions, 2 deletions
diff --git a/events/eventcontent.cpp b/events/eventcontent.cpp index c96da9b3..f5974b46 100644 --- a/events/eventcontent.cpp +++ b/events/eventcontent.cpp @@ -44,7 +44,6 @@ FileInfo::FileInfo(const QUrl& u, const QJsonObject& infoJson, , payloadSize(infoJson["size"].toInt()) , originalName(originalFilename) { - originalInfoJson.insert("mediaId", url.authority() + url.path()); if (!mimeType.isValid()) mimeType = QMimeDatabase().mimeTypeForData(QByteArray()); } diff --git a/events/eventcontent.h b/events/eventcontent.h index 91e4ca94..0733b347 100644 --- a/events/eventcontent.h +++ b/events/eventcontent.h @@ -223,7 +223,10 @@ namespace QMatrixClient : TypedBase(json) , InfoT(json["url"].toString(), json["info"].toObject(), json["filename"].toString()) - { } + { + // A small hack to facilitate links creation in QML. + originalJson.insert("mediaId", InfoT::mediaId()); + } QMimeType type() const override { return InfoT::mimeType; } const FileInfo* fileInfo() const override { return this; } |