fix reblog mnu

This commit is contained in:
molan-git 2020-06-19 16:06:11 +02:00
parent 0eef51ac28
commit d5cffbebcc

View file

@ -283,9 +283,9 @@ BackgroundItem {
id: mnuBoost id: mnuBoost
visible: model.type !== "follow" visible: model.type !== "follow"
enabled: status_visibility !== "direct" enabled: status_visibility !== "direct"
text: typeof model.reblogged !== "undefined" && model.reblogged ? qsTr("Unboost") : qsTr("Boost") text: typeof model.status_reblogged !== "undefined" && model.status_reblogged ? qsTr("Unboost") : qsTr("Boost")
onClicked: { onClicked: {
var status = typeof model.reblogged !== "undefined" && model.reblogged var status = typeof model.status_reblogged !== "undefined" && model.status_reblogged
worker.sendMessage({ worker.sendMessage({
"conf" : Logic.conf, "conf" : Logic.conf,
"params" : [], "params" : [],
@ -294,12 +294,12 @@ BackgroundItem {
"action" : "statuses/"+model.status_id+"/" + (status ? "unreblog" : "reblog") "action" : "statuses/"+model.status_id+"/" + (status ? "unreblog" : "reblog")
}) })
model.status_reblogs_count = !status ? model.status_reblogs_count+1 : (model.status_reblogs_count > 0 ? model.status_reblogs_count-1 : model.status_reblogs_count); model.status_reblogs_count = !status ? model.status_reblogs_count+1 : (model.status_reblogs_count > 0 ? model.status_reblogs_count-1 : model.status_reblogs_count);
model.reblogged = !model.reblogged model.status_reblogged = !model.status_reblogged
} }
Icon { Icon {
id: icRT id: icRT
source: "image://theme/icon-s-retweet?" + (!model.reblogged ? Theme.highlightColor : Theme.primaryColor) source: "image://theme/icon-s-retweet?" + (!model.status_reblogged ? Theme.highlightColor : Theme.primaryColor)
width: Theme.iconSizeExtraSmall width: Theme.iconSizeExtraSmall
height: width height: width
anchors { anchors {
@ -312,7 +312,7 @@ BackgroundItem {
Label { Label {
text: status_reblogs_count // from API.js text: status_reblogs_count // from API.js
font.pixelSize: Theme.fontSizeExtraSmall font.pixelSize: Theme.fontSizeExtraSmall
color: !model.reblogged ? Theme.highlightColor : Theme.primaryColor color: !model.status_reblogged ? Theme.highlightColor : Theme.primaryColor
anchors { anchors {
left: icRT.right left: icRT.right
leftMargin: Theme.paddingMedium leftMargin: Theme.paddingMedium