fix(invitation-bubble): Adds loading state for unfurling links
Fixes: #10422
This commit is contained in:
parent
2f5a76db02
commit
92a9c41238
|
@ -52,6 +52,9 @@ proc init*(self: Controller) =
|
||||||
let args = CommunityArgs(e)
|
let args = CommunityArgs(e)
|
||||||
self.delegate.onImportCommunityErrorOccured(args.community.id, args.error)
|
self.delegate.onImportCommunityErrorOccured(args.community.id, args.error)
|
||||||
|
|
||||||
|
self.events.on(SIGNAL_COMMUNITY_INFO_ALREADY_REQUESTED) do(e: Args):
|
||||||
|
self.delegate.communityInfoAlreadyRequested()
|
||||||
|
|
||||||
self.events.on(SIGNAL_CURATED_COMMUNITY_FOUND) do(e:Args):
|
self.events.on(SIGNAL_CURATED_COMMUNITY_FOUND) do(e:Args):
|
||||||
let args = CommunityArgs(e)
|
let args = CommunityArgs(e)
|
||||||
self.delegate.curatedCommunityAdded(args.community)
|
self.delegate.curatedCommunityAdded(args.community)
|
||||||
|
|
|
@ -159,3 +159,6 @@ method curatedCommunitiesLoadingFailed*(self: AccessInterface) {.base.} =
|
||||||
|
|
||||||
method curatedCommunitiesLoaded*(self: AccessInterface, curatedCommunities: seq[CommunityDto]) {.base.} =
|
method curatedCommunitiesLoaded*(self: AccessInterface, curatedCommunities: seq[CommunityDto]) {.base.} =
|
||||||
raise newException(ValueError, "No implementation available")
|
raise newException(ValueError, "No implementation available")
|
||||||
|
|
||||||
|
method communityInfoAlreadyRequested*(self: AccessInterface) {.base.} =
|
||||||
|
raise newException(ValueError, "No implementation available")
|
||||||
|
|
|
@ -382,3 +382,5 @@ method discordImportProgressUpdated*(
|
||||||
method requestCancelDiscordCommunityImport*(self: Module, id: string) =
|
method requestCancelDiscordCommunityImport*(self: Module, id: string) =
|
||||||
self.controller.requestCancelDiscordCommunityImport(id)
|
self.controller.requestCancelDiscordCommunityImport(id)
|
||||||
|
|
||||||
|
method communityInfoAlreadyRequested*(self: Module) =
|
||||||
|
self.view.communityInfoAlreadyRequested()
|
||||||
|
|
|
@ -101,6 +101,7 @@ QtObject:
|
||||||
proc discordOldestMessageTimestampChanged*(self: View) {.signal.}
|
proc discordOldestMessageTimestampChanged*(self: View) {.signal.}
|
||||||
proc discordImportErrorsCountChanged*(self: View) {.signal.}
|
proc discordImportErrorsCountChanged*(self: View) {.signal.}
|
||||||
proc communityAccessRequested*(self: View, communityId: string) {.signal.}
|
proc communityAccessRequested*(self: View, communityId: string) {.signal.}
|
||||||
|
proc communityInfoAlreadyRequested*(self: View) {.signal.}
|
||||||
|
|
||||||
proc communityTagsChanged*(self: View) {.signal.}
|
proc communityTagsChanged*(self: View) {.signal.}
|
||||||
|
|
||||||
|
|
|
@ -166,6 +166,8 @@ const SIGNAL_ACCEPT_REQUEST_TO_JOIN_LOADING* = "acceptRequestToJoinLoading"
|
||||||
const SIGNAL_ACCEPT_REQUEST_TO_JOIN_FAILED* = "acceptRequestToJoinFailed"
|
const SIGNAL_ACCEPT_REQUEST_TO_JOIN_FAILED* = "acceptRequestToJoinFailed"
|
||||||
const SIGNAL_ACCEPT_REQUEST_TO_JOIN_FAILED_NO_PERMISSION* = "acceptRequestToJoinFailedNoPermission"
|
const SIGNAL_ACCEPT_REQUEST_TO_JOIN_FAILED_NO_PERMISSION* = "acceptRequestToJoinFailedNoPermission"
|
||||||
|
|
||||||
|
const SIGNAL_COMMUNITY_INFO_ALREADY_REQUESTED* = "communityInfoAlreadyRequested"
|
||||||
|
|
||||||
const TOKEN_PERMISSIONS_ADDED = "tokenPermissionsAdded"
|
const TOKEN_PERMISSIONS_ADDED = "tokenPermissionsAdded"
|
||||||
const TOKEN_PERMISSIONS_MODIFIED = "tokenPermissionsModified"
|
const TOKEN_PERMISSIONS_MODIFIED = "tokenPermissionsModified"
|
||||||
|
|
||||||
|
@ -1453,6 +1455,7 @@ QtObject:
|
||||||
|
|
||||||
if communityId in self.requestedCommunityIds:
|
if communityId in self.requestedCommunityIds:
|
||||||
info "requestCommunityInfo: skipping as already requested", communityId
|
info "requestCommunityInfo: skipping as already requested", communityId
|
||||||
|
self.events.emit(SIGNAL_COMMUNITY_INFO_ALREADY_REQUESTED, Args())
|
||||||
return
|
return
|
||||||
|
|
||||||
self.requestedCommunityIds.incl(communityId)
|
self.requestedCommunityIds.incl(communityId)
|
||||||
|
|
|
@ -76,6 +76,8 @@ QtObject {
|
||||||
|
|
||||||
signal importingCommunityStateChanged(string communityId, int state, string errorMsg)
|
signal importingCommunityStateChanged(string communityId, int state, string errorMsg)
|
||||||
|
|
||||||
|
signal communityInfoAlreadyRequested()
|
||||||
|
|
||||||
signal goToMembershipRequestsPage()
|
signal goToMembershipRequestsPage()
|
||||||
|
|
||||||
function setActiveCommunity(communityId) {
|
function setActiveCommunity(communityId) {
|
||||||
|
@ -615,6 +617,10 @@ QtObject {
|
||||||
function onImportingCommunityStateChanged(communityId, state, errorMsg) {
|
function onImportingCommunityStateChanged(communityId, state, errorMsg) {
|
||||||
root.importingCommunityStateChanged(communityId, state, errorMsg)
|
root.importingCommunityStateChanged(communityId, state, errorMsg)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function onCommunityInfoAlreadyRequested() {
|
||||||
|
root.communityInfoAlreadyRequested()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
readonly property Connections mainModuleInstConnections: Connections {
|
readonly property Connections mainModuleInstConnections: Connections {
|
||||||
|
|
|
@ -249,5 +249,14 @@ Item {
|
||||||
Constants.ephemeralNotificationType.normal,
|
Constants.ephemeralNotificationType.normal,
|
||||||
"")
|
"")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function onCommunityInfoAlreadyRequested() {
|
||||||
|
Global.displayToastMessage(qsTr("Community data not loaded yet."),
|
||||||
|
qsTr("Please wait for the unfurl to show"),
|
||||||
|
"",
|
||||||
|
true,
|
||||||
|
Constants.ephemeralNotificationType.normal,
|
||||||
|
"")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,11 +15,12 @@ import shared.popups 1.0
|
||||||
Control {
|
Control {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
implicitWidth: d.invitedCommunity ? 270 /*by design*/ : 0
|
implicitWidth: d.invitedCommunity || loading ? 270 /*by design*/ : 0
|
||||||
padding: 1
|
padding: 1
|
||||||
|
|
||||||
property var store
|
property var store
|
||||||
property string communityId
|
property string communityId
|
||||||
|
property bool loading: false
|
||||||
|
|
||||||
QtObject {
|
QtObject {
|
||||||
id: d
|
id: d
|
||||||
|
@ -133,6 +134,8 @@ Control {
|
||||||
color: d.communityColor
|
color: d.communityColor
|
||||||
isImage: true
|
isImage: true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
visible: !root.loading
|
||||||
}
|
}
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
|
@ -141,7 +144,7 @@ Control {
|
||||||
StatusBaseText {
|
StatusBaseText {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
|
||||||
text: d.communityName
|
text: root.loading ? qsTr("Community data not loaded yet.") : d.communityName
|
||||||
font.weight: Font.Bold
|
font.weight: Font.Bold
|
||||||
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
|
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
|
||||||
font.pixelSize: 17
|
font.pixelSize: 17
|
||||||
|
@ -151,7 +154,7 @@ Control {
|
||||||
StatusBaseText {
|
StatusBaseText {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
|
||||||
text: d.communityDescription
|
text: root.loading ? qsTr("Please wait for the unfurl to show") : d.communityDescription
|
||||||
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
|
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
|
||||||
color: Theme.palette.directColor1
|
color: Theme.palette.directColor1
|
||||||
}
|
}
|
||||||
|
@ -159,7 +162,7 @@ Control {
|
||||||
StatusBaseText {
|
StatusBaseText {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
|
||||||
text: qsTr("%n member(s)", "", d.communityNbMembers)
|
text: root.loading ? "" : qsTr("%n member(s)", "", d.communityNbMembers)
|
||||||
font.pixelSize: 13
|
font.pixelSize: 13
|
||||||
font.weight: Font.Medium
|
font.weight: Font.Medium
|
||||||
color: Theme.palette.baseColor1
|
color: Theme.palette.baseColor1
|
||||||
|
@ -180,6 +183,7 @@ Control {
|
||||||
Layout.preferredHeight: 44
|
Layout.preferredHeight: 44
|
||||||
|
|
||||||
text: qsTr("Go to Community")
|
text: qsTr("Go to Community")
|
||||||
|
loading: root.loading
|
||||||
radius: d.radius - 1 // We do -1, otherwise there's a gap between border and button
|
radius: d.radius - 1 // We do -1, otherwise there's a gap between border and button
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
|
|
|
@ -190,7 +190,8 @@ Column {
|
||||||
store: root.store
|
store: root.store
|
||||||
communityId: invitationData ? invitationData.communityId : ""
|
communityId: invitationData ? invitationData.communityId : ""
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
visible: !!invitationData && !invitationData.fetching
|
visible: !!invitationData
|
||||||
|
loading: invitationData.fetching
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
enabled: !!invitationData && invitationData.fetching
|
enabled: !!invitationData && invitationData.fetching
|
||||||
|
|
Loading…
Reference in New Issue