mirror of
https://github.com/status-im/status-desktop.git
synced 2025-01-13 15:55:18 +00:00
parent
0675d6a7d9
commit
9b8a86a3cb
@ -197,6 +197,13 @@ QtObject:
|
||||
read = bannedMembers
|
||||
notify = bannedMembersChanged
|
||||
|
||||
proc amIBanned(self: ActiveSection): bool {.slot.} =
|
||||
return self.item.amIBanned
|
||||
|
||||
QtProperty[bool] amIBanned:
|
||||
read = amIBanned
|
||||
notify = bannedMembersChanged
|
||||
|
||||
proc pendingMemberRequests(self: ActiveSection): QVariant {.slot.} =
|
||||
if (self.item.id == ""):
|
||||
# FIXME (Jo) I don't know why but the Item is sometimes empty and doing anything here crashes the app
|
||||
|
@ -1,6 +1,7 @@
|
||||
import strformat
|
||||
import ./member_model, ./member_item
|
||||
import ../main/communities/models/[pending_request_item, pending_request_model]
|
||||
import ../../global/global_singleton
|
||||
|
||||
import ../../../app_service/common/types
|
||||
|
||||
@ -280,6 +281,9 @@ proc updateMember*(
|
||||
proc bannedMembers*(self: SectionItem): member_model.Model {.inline.} =
|
||||
self.bannedMembersModel
|
||||
|
||||
proc amIBanned*(self: SectionItem): bool {.inline.} =
|
||||
self.bannedMembersModel.isContactWithIdAdded(singletonInstance.userProfile.getPubKey())
|
||||
|
||||
proc pendingMemberRequests*(self: SectionItem): member_model.Model {.inline.} =
|
||||
self.pendingMemberRequestsModel
|
||||
|
||||
|
@ -239,23 +239,7 @@ QtObject:
|
||||
|
||||
self.items[index].muted = muted
|
||||
let dataIndex = self.createIndex(index, 0, nil)
|
||||
self.dataChanged(dataIndex, dataIndex, @[
|
||||
ModelRole.Name.int,
|
||||
ModelRole.Description.int,
|
||||
ModelRole.Image.int,
|
||||
ModelRole.Icon.int,
|
||||
ModelRole.Color.int,
|
||||
ModelRole.HasNotification.int,
|
||||
ModelRole.NotificationsCount.int,
|
||||
ModelRole.IsMember.int,
|
||||
ModelRole.CanJoin.int,
|
||||
ModelRole.Joined.int,
|
||||
ModelRole.Muted.int,
|
||||
ModelRole.MembersModel.int,
|
||||
ModelRole.PendingRequestsToJoinModel.int,
|
||||
ModelRole.HistoryArchiveSupportEnabled.int,
|
||||
ModelRole.BannedMembersModel.int
|
||||
])
|
||||
self.dataChanged(dataIndex, dataIndex, @[ModelRole.Muted.int])
|
||||
|
||||
|
||||
proc editItem*(self: SectionModel, item: SectionItem) =
|
||||
@ -405,6 +389,7 @@ QtObject:
|
||||
"canManageUsers": item.canManageUsers,
|
||||
"canRequestAccess": item.canRequestAccess,
|
||||
"isMember": item.isMember,
|
||||
"amIBanned": item.amIBanned,
|
||||
"access": item.access,
|
||||
"ensOnly": item.ensOnly,
|
||||
"nbMembers": item.members.getCount(),
|
||||
|
@ -179,7 +179,7 @@ ColumnLayout {
|
||||
anchors.fill: parent
|
||||
anchors.margins: Style.current.smallPadding
|
||||
|
||||
enabled: root.activeSectionData.joined
|
||||
enabled: root.activeSectionData.joined && !root.activeSectionData.amIBanned
|
||||
|
||||
store: root.rootStore
|
||||
usersStore: root.usersStore
|
||||
@ -199,7 +199,7 @@ ColumnLayout {
|
||||
}
|
||||
|
||||
Binding on chatInputPlaceholder {
|
||||
when: !root.activeSectionData.joined
|
||||
when: !root.activeSectionData.joined || root.activeSectionData.amIBanned
|
||||
value: qsTr("You need to join this community to send messages")
|
||||
}
|
||||
|
||||
|
@ -51,7 +51,7 @@ Item {
|
||||
|
||||
readonly property real scrollY: chatLogView.visibleArea.yPosition * chatLogView.contentHeight
|
||||
readonly property bool isMostRecentMessageInViewport: chatLogView.visibleArea.yPosition >= 0.999 - chatLogView.visibleArea.heightRatio
|
||||
readonly property var chatDetails: chatContentModule.chatDetails
|
||||
readonly property var chatDetails: chatContentModule.chatDetails || null
|
||||
|
||||
function markAllMessagesReadIfMostRecentMessageIsInViewport() {
|
||||
if (!isMostRecentMessageInViewport) {
|
||||
|
@ -106,11 +106,14 @@ Item {
|
||||
anchors.topMargin: 8
|
||||
anchors.bottomMargin: Style.current.halfPadding
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
enabled: !root.communityData.amIBanned
|
||||
|
||||
visible: !communityData.joined
|
||||
visible: !communityData.joined || root.communityData.amIBanned
|
||||
|
||||
text: {
|
||||
if (root.communityData.amIBanned) return qsTr("You were banned from community")
|
||||
if (invitationPending) return qsTr("Membership request pending...")
|
||||
|
||||
return root.communityData.access === Constants.communityChatOnRequestAccess ?
|
||||
qsTr("Request to join") : qsTr("Join Community")
|
||||
}
|
||||
|
@ -1375,8 +1375,9 @@ Item {
|
||||
Connections {
|
||||
target: appMain.rootStore.mainModuleInst
|
||||
function onActiveSectionChanged() {
|
||||
if (!!appMain.rootStore.mainModuleInst.getCommunitySectionModule())
|
||||
rootDropAreaPanel.activeChatType = appMain.rootStore.mainModuleInst.getCommunitySectionModule().activeItem.type
|
||||
let communitySectionModule = appMain.rootStore.mainModuleInst.getCommunitySectionModule()
|
||||
if (communitySectionModule)
|
||||
rootDropAreaPanel.activeChatType = communitySectionModule.activeItem.type
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user