diff --git a/CustomModels/messagemodel.cpp b/CustomModels/messagemodel.cpp index d1645e9eaa276c49f79f891751ec6123b7889725..94e7c47a2a266162d0c9bb17ae327a59dc7313b6 100644 --- a/CustomModels/messagemodel.cpp +++ b/CustomModels/messagemodel.cpp @@ -109,10 +109,12 @@ QVariant MessagesModel::data( const QModelIndex &index, int role ) const if ( !first.isNull() ) { //TODO: WTF!!! - auto msg = qSharedPointerCast<RocketChatReplyMessage>( first ); + if ( first->getType() == QStringLiteral( "replyMessage" ) ) { + auto msg = qSharedPointerCast<RocketChatReplyMessage>( first ); - if ( !msg.isNull() ) { - return msg->getMessageString(); + if ( !msg.isNull() ) { + return msg->getMessageString(); + } } } } @@ -127,10 +129,12 @@ QVariant MessagesModel::data( const QModelIndex &index, int role ) const if ( !first.isNull() ) { //TODO: WTF!!! - auto msg = qSharedPointerCast<RocketChatReplyMessage>( first ); + if ( first->getType() == QStringLiteral( "replyMessage" ) ) { + auto msg = qSharedPointerCast<RocketChatReplyMessage>( first ); - if ( !msg.isNull() ) { - return msg->getAuthor(); + if ( !msg.isNull() ) { + return msg->getAuthor(); + } } } } diff --git a/repos/entities/rocketchatattachment.h b/repos/entities/rocketchatattachment.h index 97d6d11b39316ccf77e2fcdd7b05751a4b6f92f3..f63c78b5b492d917165372dd847d392da0b8de57 100644 --- a/repos/entities/rocketchatattachment.h +++ b/repos/entities/rocketchatattachment.h @@ -28,10 +28,14 @@ class RocketChatAttachment : public QObject { Q_OBJECT public: - RocketChatAttachment( const QString &pFileUrl, const QString &pType, const QString &pTitle ); + enum class attachmentsType { + replyMessage + }; + + RocketChatAttachment( const QString &pFileUrl, const attachmentsType &pType, const QString &pTitle ); const QString &getUrl() const; - const QString &getType() const; + const attachmentsType getType() const; const QString &getTitle() const; int getWidth() const; @@ -42,7 +46,7 @@ class RocketChatAttachment : public QObject protected: QString mUrl; - QString mType; + attachmentsType mType; QString mTitle; int mWidth = -1; int mHeight = -1;