return m_followListName == QStringLiteral("list");
}
+bool SocialGraphModel::isBlockList() const
+{
+ return m_followListName == QStringLiteral("blocks");
+}
+
+bool SocialGraphModel::isMuteList() const
+{
+ return m_followListName == QStringLiteral("mutes");
+}
+
void SocialGraphModel::actionAllow(const QModelIndex &index)
{
auto account = AccountManager::instance().selectedAccount();
});
}
+void SocialGraphModel::actionUnblock(const QModelIndex &index)
+{
+ auto account = AccountManager::instance().selectedAccount();
+
+ if (!checkIndex(index, QAbstractItemModel::CheckIndexOption::IndexIsValid))
+ return;
+
+ auto requestIdentity = m_accounts[index.row()].get();
+ account->unblockAccount(requestIdentity);
+
+ beginRemoveRows({}, index.row(), index.row());
+ m_accounts.removeAt(index.row());
+ endRemoveRows();
+}
+
+void SocialGraphModel::actionUnmute(const QModelIndex &index)
+{
+ auto account = AccountManager::instance().selectedAccount();
+
+ if (!checkIndex(index, QAbstractItemModel::CheckIndexOption::IndexIsValid))
+ return;
+
+ auto requestIdentity = m_accounts[index.row()].get();
+ account->unmuteAccount(requestIdentity);
+
+ beginRemoveRows({}, index.row(), index.row());
+ m_accounts.removeAt(index.row());
+ endRemoveRows();
+}
+
bool SocialGraphModel::canFetchMore(const QModelIndex &parent) const
{
Q_UNUSED(parent);
Q_PROPERTY(bool isFollowing READ isFollowing CONSTANT)
Q_PROPERTY(bool isFollower READ isFollower CONSTANT)
Q_PROPERTY(bool isList READ isList CONSTANT)
+ Q_PROPERTY(bool isMuteList READ isMuteList CONSTANT)
+ Q_PROPERTY(bool isBlockList READ isBlockList CONSTANT)
/**
* @brief The account id of the account we want to display
[[nodiscard]] bool isFollowing() const;
[[nodiscard]] bool isFollower() const;
[[nodiscard]] bool isList() const;
+ [[nodiscard]] bool isMuteList() const;
+ [[nodiscard]] bool isBlockList() const;
[[nodiscard]] QString statusId() const;
void setStatusId(const QString &statusId);
[[nodiscard]] int count() const;
void actionRemoveFollower(const QModelIndex &index);
void actionRemoveFromList(const QModelIndex &index);
void actionAddToList(const QString &accountId);
+ void actionUnblock(const QModelIndex &index);
+ void actionUnmute(const QModelIndex &index);
Q_SIGNALS:
void loadingChanged();
onClicked: model.actionRemoveFromList(model.index(delegate.index, 0))
visible: model.isList && model.accountId === AccountManager.selectedAccount.identity.id
}
+
+ QQC2.Button {
+ text: i18nc("@action:button Unblock this user", "Unblock")
+ onClicked: model.actionUnblock(model.index(delegate.index, 0))
+ visible: model.isBlockList
+ }
+
+ QQC2.Button {
+ text: i18nc("@action:button Unmute this user", "Unmute")
+ onClicked: model.actionUnmute(model.index(delegate.index, 0))
+ visible: model.isMuteList
+ }
}
QQC2.ProgressBar {