remove legacy `requestCommunityInfo` code (#13012)

This commit is contained in:
Igor Sirotin 2023-12-21 20:05:04 +00:00 committed by GitHub
parent 69f872f130
commit 50c187edff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 0 additions and 33 deletions

View File

@ -79,9 +79,6 @@ proc init*(self: Controller) =
let args = CommunityArgs(e) let args = CommunityArgs(e)
self.delegate.communityInfoRequestFailed(args.communityId, args.error) self.delegate.communityInfoRequestFailed(args.communityId, 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)

View File

@ -194,9 +194,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")
method onCommunityTokenMetadataAdded*(self: AccessInterface, communityId: string, tokenMetadata: CommunityTokensMetadataDto) {.base.} = method onCommunityTokenMetadataAdded*(self: AccessInterface, communityId: string, tokenMetadata: CommunityTokensMetadataDto) {.base.} =
raise newException(ValueError, "No implementation available") raise newException(ValueError, "No implementation available")

View File

@ -538,9 +538,6 @@ method requestCancelDiscordCommunityImport*(self: Module, id: string) =
method requestCancelDiscordChannelImport*(self: Module, discordChannelId: string) = method requestCancelDiscordChannelImport*(self: Module, discordChannelId: string) =
self.controller.requestCancelDiscordChannelImport(discordChannelId) self.controller.requestCancelDiscordChannelImport(discordChannelId)
method communityInfoAlreadyRequested*(self: Module) =
self.view.communityInfoAlreadyRequested()
proc createCommunityTokenItem(self: Module, token: CommunityTokensMetadataDto, communityId: string, supply: string, proc createCommunityTokenItem(self: Module, token: CommunityTokensMetadataDto, communityId: string, supply: string,
infiniteSupply: bool): TokenListItem = infiniteSupply: bool): TokenListItem =
result = initTokenListItem( result = initTokenListItem(

View File

@ -132,7 +132,6 @@ QtObject:
proc communityAccessFailed*(self: View, communityId: string, error: string) {.signal.} proc communityAccessFailed*(self: View, communityId: string, error: string) {.signal.}
proc communityEditSharedAddressesSucceeded*(self: View, communityId: string) {.signal.} proc communityEditSharedAddressesSucceeded*(self: View, communityId: string) {.signal.}
proc communityEditSharedAddressesFailed*(self: View, communityId: string, error: string) {.signal.} proc communityEditSharedAddressesFailed*(self: View, communityId: string, error: string) {.signal.}
proc communityInfoAlreadyRequested*(self: View) {.signal.}
proc communityTagsChanged*(self: View) {.signal.} proc communityTagsChanged*(self: View) {.signal.}

View File

@ -234,8 +234,6 @@ 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"
const TOKEN_PERMISSIONS_REMOVED = "tokenPermissionsRemoved" const TOKEN_PERMISSIONS_REMOVED = "tokenPermissionsRemoved"
@ -260,7 +258,6 @@ QtObject:
communityTags: string # JSON string contraining tags map communityTags: string # JSON string contraining tags map
communities: Table[string, CommunityDto] # [community_id, CommunityDto] communities: Table[string, CommunityDto] # [community_id, CommunityDto]
historyArchiveDownloadTaskCommunityIds*: HashSet[string] historyArchiveDownloadTaskCommunityIds*: HashSet[string]
requestedCommunityIds*: HashSet[string]
communityMetrics: Table[string, CommunityMetricsDto] communityMetrics: Table[string, CommunityMetricsDto]
communityInfoRequests: Table[string, Time] communityInfoRequests: Table[string, Time]
@ -296,7 +293,6 @@ QtObject:
result.communityTags = newString(0) result.communityTags = newString(0)
result.communities = initTable[string, CommunityDto]() result.communities = initTable[string, CommunityDto]()
result.historyArchiveDownloadTaskCommunityIds = initHashSet[string]() result.historyArchiveDownloadTaskCommunityIds = initHashSet[string]()
result.requestedCommunityIds = initHashSet[string]()
result.communityMetrics = initTable[string, CommunityMetricsDto]() result.communityMetrics = initTable[string, CommunityMetricsDto]()
result.communityInfoRequests = initTable[string, Time]() result.communityInfoRequests = initTable[string, Time]()
@ -1495,7 +1491,6 @@ QtObject:
let rpcResponseObj = communityIdAndRpcResponse.parseJson let rpcResponseObj = communityIdAndRpcResponse.parseJson
let requestedCommunityId = rpcResponseObj{"communityId"}.getStr() let requestedCommunityId = rpcResponseObj{"communityId"}.getStr()
self.requestedCommunityIds.excl(requestedCommunityId)
if rpcResponseObj{"error"}.kind != JNull and rpcResponseObj{"error"}.getStr != "": if rpcResponseObj{"error"}.kind != JNull and rpcResponseObj{"error"}.getStr != "":
error "Error requesting community info", msg = rpcResponseObj{"error"} error "Error requesting community info", msg = rpcResponseObj{"error"}
@ -1780,11 +1775,6 @@ QtObject:
proc requestCommunityInfo*(self: Service, communityId: string, shard: Shard, importing = false, tryDatabase = true, proc requestCommunityInfo*(self: Service, communityId: string, shard: Shard, importing = false, tryDatabase = true,
requiredTimeSinceLastRequest = initDuration(0, 0)) = requiredTimeSinceLastRequest = initDuration(0, 0)) =
if communityId in self.requestedCommunityIds:
info "requestCommunityInfo: skipping as already requested", communityId
self.events.emit(SIGNAL_COMMUNITY_INFO_ALREADY_REQUESTED, Args())
return
let now = now().toTime() let now = now().toTime()
if self.communityInfoRequests.hasKey(communityId): if self.communityInfoRequests.hasKey(communityId):
let lastRequestTime = self.communityInfoRequests[communityId] let lastRequestTime = self.communityInfoRequests[communityId]
@ -1794,7 +1784,6 @@ QtObject:
return return
self.communityInfoRequests[communityId] = now self.communityInfoRequests[communityId] = now
self.requestedCommunityIds.incl(communityId)
let arg = AsyncRequestCommunityInfoTaskArg( let arg = AsyncRequestCommunityInfoTaskArg(
tptr: cast[ByteAddress](asyncRequestCommunityInfoTask), tptr: cast[ByteAddress](asyncRequestCommunityInfoTask),

View File

@ -98,8 +98,6 @@ QtObject {
signal communityAdded(string communityId) signal communityAdded(string communityId)
signal communityInfoAlreadyRequested()
signal communityAccessRequested(string communityId) signal communityAccessRequested(string communityId)
signal goToMembershipRequestsPage() signal goToMembershipRequestsPage()
@ -575,10 +573,6 @@ QtObject {
root.importingCommunityStateChanged(communityId, state, errorMsg) root.importingCommunityStateChanged(communityId, state, errorMsg)
} }
function onCommunityInfoAlreadyRequested() {
root.communityInfoAlreadyRequested()
}
function onCommunityAccessRequested(communityId) { function onCommunityAccessRequested(communityId) {
root.communityAccessRequested(communityId) root.communityAccessRequested(communityId)
} }

View File

@ -60,8 +60,6 @@ QtObject {
signal importingCommunityStateChanged(string communityId, int state, string errorMsg) signal importingCommunityStateChanged(string communityId, int state, string errorMsg)
signal communityInfoAlreadyRequested()
signal communityInfoRequestCompleted(string communityId, string errorMsg) signal communityInfoRequestCompleted(string communityId, string errorMsg)
function createCommunity(args = { function createCommunity(args = {
@ -251,10 +249,6 @@ QtObject {
root.importingCommunityStateChanged(communityId, state, errorMsg) root.importingCommunityStateChanged(communityId, state, errorMsg)
} }
function onCommunityInfoAlreadyRequested() {
root.communityInfoAlreadyRequested()
}
function onCommunityInfoRequestCompleted(communityId, erorrMsg) { function onCommunityInfoRequestCompleted(communityId, erorrMsg) {
root.communityInfoRequestCompleted(communityId, erorrMsg) root.communityInfoRequestCompleted(communityId, erorrMsg)
} }