mirror of
https://github.com/status-im/status-desktop.git
synced 2025-01-16 01:27:01 +00:00
refactor(communities): rename inviteUsersToCommunity
to shareCommunityToUsers
This change corrects legacy naming that was causing confusion. Community invites are no longer sent to users. Instead, the community is just shared. If a user is interested in joining this shared commmunity, they must submit a request to join.
This commit is contained in:
parent
dea0e99bbb
commit
faa425dd29
@ -679,8 +679,8 @@ proc unmuteCategory*(self: Controller, categoryId: string) =
|
|||||||
proc setCommunityMuted*(self: Controller, mutedType: int) =
|
proc setCommunityMuted*(self: Controller, mutedType: int) =
|
||||||
self.communityService.setCommunityMuted(self.sectionId, mutedType)
|
self.communityService.setCommunityMuted(self.sectionId, mutedType)
|
||||||
|
|
||||||
proc inviteUsersToCommunity*(self: Controller, pubKeys: string, inviteMessage: string): string =
|
proc shareCommunityToUsers*(self: Controller, pubKeys: string, inviteMessage: string): string =
|
||||||
result = self.communityService.inviteUsersToCommunityById(self.sectionId, pubKeys, inviteMessage)
|
result = self.communityService.shareCommunityToUsers(self.sectionId, pubKeys, inviteMessage)
|
||||||
|
|
||||||
proc reorderCommunityCategories*(self: Controller, categoryId: string, position: int) =
|
proc reorderCommunityCategories*(self: Controller, categoryId: string, position: int) =
|
||||||
self.communityService.reorderCommunityCategories(self.sectionId, categoryId, position)
|
self.communityService.reorderCommunityCategories(self.sectionId, categoryId, position)
|
||||||
|
@ -307,7 +307,7 @@ method exportCommunity*(self: AccessInterface): string {.base.} =
|
|||||||
method setCommunityMuted*(self: AccessInterface, mutedType: int) {.base.} =
|
method setCommunityMuted*(self: AccessInterface, mutedType: int) {.base.} =
|
||||||
raise newException(ValueError, "No implementation available")
|
raise newException(ValueError, "No implementation available")
|
||||||
|
|
||||||
method inviteUsersToCommunity*(self: AccessInterface, pubKeysJSON: string, inviteMessage: string): string {.base.} =
|
method shareCommunityToUsers*(self: AccessInterface, pubKeysJSON: string, inviteMessage: string): string {.base.} =
|
||||||
raise newException(ValueError, "No implementation available")
|
raise newException(ValueError, "No implementation available")
|
||||||
|
|
||||||
method createCommunityCategory*(self: AccessInterface, name: string, channels: seq[string]) {.base.} =
|
method createCommunityCategory*(self: AccessInterface, name: string, channels: seq[string]) {.base.} =
|
||||||
|
@ -1119,8 +1119,8 @@ method exportCommunity*(self: Module): string =
|
|||||||
method setCommunityMuted*(self: Module, mutedType: int) =
|
method setCommunityMuted*(self: Module, mutedType: int) =
|
||||||
self.controller.setCommunityMuted(mutedType)
|
self.controller.setCommunityMuted(mutedType)
|
||||||
|
|
||||||
method inviteUsersToCommunity*(self: Module, pubKeysJSON: string, inviteMessage: string): string =
|
method shareCommunityToUsers*(self: Module, pubKeysJSON: string, inviteMessage: string): string =
|
||||||
result = self.controller.inviteUsersToCommunity(pubKeysJSON, inviteMessage)
|
result = self.controller.shareCommunityToUsers(pubKeysJSON, inviteMessage)
|
||||||
|
|
||||||
method prepareEditCategoryModel*(self: Module, categoryId: string) =
|
method prepareEditCategoryModel*(self: Module, categoryId: string) =
|
||||||
self.view.editCategoryChannelsModel().clearItems()
|
self.view.editCategoryChannelsModel().clearItems()
|
||||||
|
@ -325,8 +325,8 @@ QtObject:
|
|||||||
proc setCommunityMuted*(self: View, mutedType: int) {.slot.} =
|
proc setCommunityMuted*(self: View, mutedType: int) {.slot.} =
|
||||||
self.delegate.setCommunityMuted(mutedType)
|
self.delegate.setCommunityMuted(mutedType)
|
||||||
|
|
||||||
proc inviteUsersToCommunity*(self: View, pubKeysJSON: string, inviteMessage: string): string {.slot.} =
|
proc shareCommunityToUsers*(self: View, pubKeysJSON: string, inviteMessage: string): string {.slot.} =
|
||||||
result = self.delegate.inviteUsersToCommunity(pubKeysJSON, inviteMessage)
|
result = self.delegate.shareCommunityToUsers(pubKeysJSON, inviteMessage)
|
||||||
|
|
||||||
proc createCommunityCategory*(self: View, name: string, channels: string) {.slot.} =
|
proc createCommunityCategory*(self: View, name: string, channels: string) {.slot.} =
|
||||||
let channelsSeq = map(parseJson(channels).getElems(), proc(x:JsonNode):string = x.getStr())
|
let channelsSeq = map(parseJson(channels).getElems(), proc(x:JsonNode):string = x.getStr())
|
||||||
|
@ -17,8 +17,8 @@ proc newController*(delegate: io_interface.AccessInterface,
|
|||||||
proc delete*(self: Controller) =
|
proc delete*(self: Controller) =
|
||||||
discard
|
discard
|
||||||
|
|
||||||
proc inviteUsersToCommunity*(self: Controller, communityID: string, pubKeys: string, inviteMessage: string): string =
|
proc shareCommunityToUsers*(self: Controller, communityID: string, pubKeys: string, inviteMessage: string): string =
|
||||||
result = self.communityService.inviteUsersToCommunityById(communityID, pubKeys, inviteMessage)
|
result = self.communityService.shareCommunityToUsers(communityID, pubKeys, inviteMessage)
|
||||||
|
|
||||||
proc leaveCommunity*(self: Controller, communityID: string) =
|
proc leaveCommunity*(self: Controller, communityID: string) =
|
||||||
self.communityService.leaveCommunity(communityID)
|
self.communityService.leaveCommunity(communityID)
|
||||||
|
@ -22,7 +22,7 @@ method getModuleAsVariant*(self: AccessInterface): QVariant {.base.} =
|
|||||||
method viewDidLoad*(self: AccessInterface) {.base.} =
|
method viewDidLoad*(self: AccessInterface) {.base.} =
|
||||||
raise newException(ValueError, "No implementation available")
|
raise newException(ValueError, "No implementation available")
|
||||||
|
|
||||||
method inviteUsersToCommunity*(self: AccessInterface, communityID: string, pubKeysJSON: string, inviteMessage: string): string {.base.} =
|
method shareCommunityToUsers*(self: AccessInterface, communityID: string, pubKeysJSON: string, inviteMessage: string): string {.base.} =
|
||||||
raise newException(ValueError, "No implementation available")
|
raise newException(ValueError, "No implementation available")
|
||||||
|
|
||||||
method leaveCommunity*(self: AccessInterface, communityID: string) {.base.} =
|
method leaveCommunity*(self: AccessInterface, communityID: string) {.base.} =
|
||||||
|
@ -42,8 +42,8 @@ method viewDidLoad*(self: Module) =
|
|||||||
method getModuleAsVariant*(self: Module): QVariant =
|
method getModuleAsVariant*(self: Module): QVariant =
|
||||||
return self.viewVariant
|
return self.viewVariant
|
||||||
|
|
||||||
method inviteUsersToCommunity*(self: Module, communityID: string, pubKeysJSON: string, inviteMessage: string): string =
|
method shareCommunityToUsers*(self: Module, communityID: string, pubKeysJSON: string, inviteMessage: string): string =
|
||||||
result = self.controller.inviteUsersToCommunity(communityID, pubKeysJSON, inviteMessage)
|
result = self.controller.shareCommunityToUsers(communityID, pubKeysJSON, inviteMessage)
|
||||||
|
|
||||||
method leaveCommunity*(self: Module, communityID: string) =
|
method leaveCommunity*(self: Module, communityID: string) =
|
||||||
self.controller.leaveCommunity(communityID)
|
self.controller.leaveCommunity(communityID)
|
||||||
|
@ -19,8 +19,8 @@ QtObject:
|
|||||||
proc load*(self: View) =
|
proc load*(self: View) =
|
||||||
self.delegate.viewDidLoad()
|
self.delegate.viewDidLoad()
|
||||||
|
|
||||||
method inviteUsersToCommunity*(self: View, communityID: string, pubKeysJSON: string, inviteMessage: string): string {.slot.} =
|
method shareCommunityToUsers*(self: View, communityID: string, pubKeysJSON: string, inviteMessage: string): string {.slot.} =
|
||||||
result = self.delegate.inviteUsersToCommunity(communityID, pubKeysJSON, inviteMessage)
|
result = self.delegate.shareCommunityToUsers(communityID, pubKeysJSON, inviteMessage)
|
||||||
|
|
||||||
method leaveCommunity*(self: View, communityID: string) {.slot.} =
|
method leaveCommunity*(self: View, communityID: string) {.slot.} =
|
||||||
self.delegate.leaveCommunity(communityID)
|
self.delegate.leaveCommunity(communityID)
|
||||||
|
@ -1745,7 +1745,7 @@ QtObject:
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
error "Error declining request to join community", msg = e.msg
|
error "Error declining request to join community", msg = e.msg
|
||||||
|
|
||||||
proc inviteUsersToCommunityById*(self: Service, communityId: string, pubKeysJson: string, inviteMessage: string): string =
|
proc shareCommunityToUsers*(self: Service, communityId: string, pubKeysJson: string, inviteMessage: string): string =
|
||||||
try:
|
try:
|
||||||
let pubKeysParsed = pubKeysJson.parseJson
|
let pubKeysParsed = pubKeysJson.parseJson
|
||||||
var pubKeys: seq[string] = @[]
|
var pubKeys: seq[string] = @[]
|
||||||
|
@ -401,12 +401,6 @@ proc setCommunityMuted*(communityId: string, mutedType: int): RpcResponse[JsonNo
|
|||||||
"mutedType": mutedType
|
"mutedType": mutedType
|
||||||
}])
|
}])
|
||||||
|
|
||||||
proc inviteUsersToCommunity*(communityId: string, pubKeys: seq[string]): RpcResponse[JsonNode] {.raises: [Exception].} =
|
|
||||||
return callPrivateRPC("inviteUsersToCommunity".prefix, %*[{
|
|
||||||
"communityId": communityId,
|
|
||||||
"users": pubKeys
|
|
||||||
}])
|
|
||||||
|
|
||||||
proc shareCommunityToUsers*(communityId: string, pubKeys: seq[string], inviteMessage: string): RpcResponse[JsonNode] {.raises: [Exception].} =
|
proc shareCommunityToUsers*(communityId: string, pubKeys: seq[string], inviteMessage: string): RpcResponse[JsonNode] {.raises: [Exception].} =
|
||||||
return callPrivateRPC("shareCommunity".prefix, %*[{
|
return callPrivateRPC("shareCommunity".prefix, %*[{
|
||||||
"communityId": communityId,
|
"communityId": communityId,
|
||||||
|
@ -94,8 +94,8 @@ SplitView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
communitySectionModule: QtObject {
|
communitySectionModule: QtObject {
|
||||||
function inviteUsersToCommunity(keys, message) {
|
function shareCommunityToUsers(keys, message) {
|
||||||
logs.logEvent("communitySectionModule::inviteUsersToCommunity",
|
logs.logEvent("communitySectionModule::shareCommunityToUsers",
|
||||||
["keys", "message"], arguments)
|
["keys", "message"], arguments)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,8 +30,8 @@ StatusStackModal {
|
|||||||
readonly property int footerButtonsHeight: 44
|
readonly property int footerButtonsHeight: 44
|
||||||
readonly property int popupContentHeight: 551
|
readonly property int popupContentHeight: 551
|
||||||
|
|
||||||
function sendInvites(pubKeys, inviteMessage) {
|
function shareCommunity(pubKeys, inviteMessage) {
|
||||||
const error = root.communitySectionModule.inviteUsersToCommunity(JSON.stringify(pubKeys), inviteMessage);
|
const error = root.communitySectionModule.shareCommunityToUsers(JSON.stringify(pubKeys), inviteMessage);
|
||||||
d.processInviteResult(error);
|
d.processInviteResult(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -75,7 +75,7 @@ StatusStackModal {
|
|||||||
enabled: root.pubKeys.length > 0
|
enabled: root.pubKeys.length > 0
|
||||||
text: qsTr("Send %n invite(s)", "", root.pubKeys.length)
|
text: qsTr("Send %n invite(s)", "", root.pubKeys.length)
|
||||||
onClicked: {
|
onClicked: {
|
||||||
d.sendInvites(root.pubKeys, root.inviteMessage);
|
d.shareCommunity(root.pubKeys, root.inviteMessage);
|
||||||
root.close();
|
root.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user