summaryrefslogtreecommitdiff
path: root/eventsview-plugins/eventsview-plugin-mastodon/MastodonFeedItem.qml
diff options
context:
space:
mode:
authorAndrew Branson <andrew.branson@jolla.com>2026-02-20 14:26:11 +0100
committerAndrew Branson <andrew.branson@jolla.com>2026-02-21 12:56:46 +0100
commit97c06240cd8ba05c5348efa57ce0bed9690ff545 (patch)
treeaef9139a2bc4f888ff8952258db017f60d78229e /eventsview-plugins/eventsview-plugin-mastodon/MastodonFeedItem.qml
parent2100e260e58e12cef347ecf17e3aad9422d22e86 (diff)
Simplify FeedItem and delegate
Diffstat (limited to 'eventsview-plugins/eventsview-plugin-mastodon/MastodonFeedItem.qml')
-rw-r--r--eventsview-plugins/eventsview-plugin-mastodon/MastodonFeedItem.qml23
1 files changed, 11 insertions, 12 deletions
diff --git a/eventsview-plugins/eventsview-plugin-mastodon/MastodonFeedItem.qml b/eventsview-plugins/eventsview-plugin-mastodon/MastodonFeedItem.qml
index 9d04dfe..8db1811 100644
--- a/eventsview-plugins/eventsview-plugin-mastodon/MastodonFeedItem.qml
+++ b/eventsview-plugins/eventsview-plugin-mastodon/MastodonFeedItem.qml
@@ -9,20 +9,19 @@ import Sailfish.Silica 1.0
import Sailfish.TextLinking 1.0
import org.nemomobile.lipstick 0.1
import "shared"
-import "shared/SocialFeedUtils.js" as FeedUtils
SocialMediaFeedItem {
id: item
property variant imageList
- property string resolvedStatusUrl: FeedUtils.stringRole(model, ["url", "link", "uri"], "")
+ property string resolvedStatusUrl: model && model.url ? model.url.toString() : ""
property string postId
property QtObject postActions
- property int likeCount: FeedUtils.intRole(model, ["favouritesCount", "likeCount", "favoriteCount"], 0)
- property int commentCount: FeedUtils.intRole(model, ["repliesCount", "commentCount"], 0)
- property int boostCount: FeedUtils.intRole(model, ["reblogsCount", "boostCount", "repostsCount"], 0)
- property bool favourited: FeedUtils.boolRole(model, ["favourited"], false)
- property bool reblogged: FeedUtils.boolRole(model, ["reblogged"], false)
+ property int likeCount: model && model.favouritesCount ? model.favouritesCount : 0
+ property int commentCount: model && model.repliesCount ? model.repliesCount : 0
+ property int boostCount: model && model.reblogsCount ? model.reblogsCount : 0
+ property bool favourited: model ? !!model.favourited : false
+ property bool reblogged: model ? !!model.reblogged : false
property int _likeCountOverride: -1
property int _boostCountOverride: -1
property int _favouritedOverride: -1
@@ -36,10 +35,10 @@ SocialMediaFeedItem {
property var _actionMenu
property real _contextMenuHeight: (_contextMenuOpen && _actionMenu) ? _actionMenu.height : 0
- property string _booster: FeedUtils.stringRole(model, ["boostedBy", "rebloggedBy", "retweeter"], "")
- property string _displayName: FeedUtils.stringRole(model, ["name", "displayName", "display_name"], "")
- property string _accountName: FeedUtils.stringRole(model, ["accountName", "acct", "screenName", "username"], "")
- property string _bodyText: FeedUtils.stringRole(model, ["body", "content", "text"], "")
+ property string _booster: model && model.boostedBy ? model.boostedBy.toString() : ""
+ property string _displayName: model && model.name ? model.name.toString() : ""
+ property string _accountName: model && model.accountName ? model.accountName.toString() : ""
+ property string _bodyText: model && model.body ? model.body.toString() : ""
//: Action label shown in Mastodon interaction menu.
//% "Favourite"
readonly property string _favouriteActionText: qsTrId("lipstick-jolla-home-la-mastodon_favourite")
@@ -187,7 +186,7 @@ SocialMediaFeedItem {
if (item.postId.length > 0) {
return item.postId
}
- return FeedUtils.stringRole(model, ["mastodonId", "statusId", "id", "twitterId"], "")
+ return model && model.mastodonId ? model.mastodonId.toString() : ""
}
function actionAccountId() {