From 6fc88fe0d569ac1e336353848298f6dae0ca87a1 Mon Sep 17 00:00:00 2001 From: Slava Monich Date: Sat, 5 Dec 2020 20:00:11 +0200 Subject: [PATCH] Mark readonly properties as such --- qml/components/PollPreview.qml | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/qml/components/PollPreview.qml b/qml/components/PollPreview.qml index e790230..49e6001 100644 --- a/qml/components/PollPreview.qml +++ b/qml/components/PollPreview.qml @@ -28,23 +28,21 @@ Item { property ListItem messageListItem property MessageOverlayFlickable overlayFlickable - property var rawMessage: messageListItem ? messageListItem.myMessage : overlayFlickable.overlayMessage - property string chatId: rawMessage.chat_id - - property bool isOwnMessage: messageListItem ? messageListItem.isOwnMessage : overlayFlickable.isOwnMessage - - property string messageId: rawMessage.id - property bool canEdit: rawMessage.can_be_edited - property var pollData: rawMessage.content.poll + readonly property var rawMessage: messageListItem ? messageListItem.myMessage : overlayFlickable.overlayMessage + readonly property string chatId: rawMessage.chat_id + readonly property bool isOwnMessage: messageListItem ? messageListItem.isOwnMessage : overlayFlickable.isOwnMessage + readonly property string messageId: rawMessage.id + readonly property bool canEdit: rawMessage.can_be_edited + readonly property var pollData: rawMessage.content.poll property var chosenPollData:({}) property var chosenIndexes: [] - property bool hasAnswered: { + readonly property bool hasAnswered: { return pollData.options.filter(function(option){ return option.is_chosen }).length > 0; } - property bool canAnswer: !hasAnswered && !pollData.is_closed - property bool isQuiz: pollData.type['@type'] === "pollTypeQuiz" + readonly property bool canAnswer: !hasAnswered && !pollData.is_closed + readonly property bool isQuiz: pollData.type['@type'] === "pollTypeQuiz" property bool highlighted width: parent.width height: pollColumn.height