fix(invitation): fix community invite not showing in 1-1 chats
Fixes #4851
This commit is contained in:
parent
52fb195b39
commit
3985272037
|
@ -74,6 +74,7 @@ method convertToItems*[T](
|
|||
let contactDetails = self.controller.getContactDetails(n.message.`from`)
|
||||
messageItem = message_item_qobject.newMessageItem(initItem(
|
||||
n.message.id,
|
||||
n.message.communityId,
|
||||
n.message.responseTo,
|
||||
n.message.`from`,
|
||||
contactDetails.displayName,
|
||||
|
|
|
@ -73,6 +73,7 @@ proc createFetchMoreMessagesItem(self: Module): Item =
|
|||
let isIdenticon = false
|
||||
result = initItem(
|
||||
FETCH_MORE_MESSAGES_MESSAGE_ID,
|
||||
communityId = "",
|
||||
responseToMessageWithId = "",
|
||||
senderId = chatDto.id,
|
||||
senderDisplayName = "",
|
||||
|
@ -104,6 +105,7 @@ proc createChatIdentifierItem(self: Module): Item =
|
|||
|
||||
result = initItem(
|
||||
CHAT_IDENTIFIER_MESSAGE_ID,
|
||||
communityId = "",
|
||||
responseToMessageWithId = "",
|
||||
senderId = chatDto.id,
|
||||
senderDisplayName = chatName,
|
||||
|
@ -165,6 +167,7 @@ method newMessagesLoaded*(self: Module, messages: seq[MessageDto], reactions: se
|
|||
isCurrentUser = self.currentUserWalletContainsAddress(m.transactionParameters.fromAddress)
|
||||
var item = initItem(
|
||||
m.id,
|
||||
m.communityId,
|
||||
m.responseTo,
|
||||
m.`from`,
|
||||
sender.displayName,
|
||||
|
@ -246,6 +249,7 @@ method messageAdded*(self: Module, message: MessageDto) =
|
|||
self.view.model().removeItem(message.replace)
|
||||
var item = initItem(
|
||||
message.id,
|
||||
message.communityId,
|
||||
message.responseTo,
|
||||
message.`from`,
|
||||
sender.displayName,
|
||||
|
|
|
@ -157,6 +157,7 @@ proc buildPinnedMessageItem(self: Module, messageId: string, actionInitiatedBy:
|
|||
isCurrentUser = self.currentUserWalletContainsAddress(m.transactionParameters.fromAddress)
|
||||
item = pinned_msg_item.initItem(
|
||||
m.id,
|
||||
m.communityId,
|
||||
m.responseTo,
|
||||
m.`from`,
|
||||
contactDetails.displayName,
|
||||
|
|
|
@ -40,6 +40,10 @@ method init*(self: Controller) =
|
|||
let args = CommunityArgs(e)
|
||||
self.delegate.communityAdded(args.community)
|
||||
|
||||
self.events.on(SIGNAL_COMMUNITY_ADDED) do(e:Args):
|
||||
let args = CommunityArgs(e)
|
||||
self.delegate.communityAdded(args.community)
|
||||
|
||||
self.events.on(SIGNAL_COMMUNITY_IMPORTED) do(e:Args):
|
||||
let args = CommunityArgs(e)
|
||||
if(args.error.len > 0):
|
||||
|
|
|
@ -7,6 +7,7 @@ import message_reaction_model, message_reaction_item, message_transaction_parame
|
|||
type
|
||||
Item* = ref object
|
||||
id: string
|
||||
communityId: string
|
||||
responseToMessageWithId: string
|
||||
senderId: string
|
||||
senderDisplayName: string
|
||||
|
@ -36,6 +37,7 @@ type
|
|||
|
||||
proc initItem*(
|
||||
id,
|
||||
communityId,
|
||||
responseToMessageWithId,
|
||||
senderId,
|
||||
senderDisplayName,
|
||||
|
@ -58,6 +60,7 @@ proc initItem*(
|
|||
): Item =
|
||||
result = Item()
|
||||
result.id = id
|
||||
result.communityId = communityId
|
||||
result.responseToMessageWithId = responseToMessageWithId
|
||||
result.senderId = senderId
|
||||
result.senderDisplayName = senderDisplayName
|
||||
|
@ -85,6 +88,7 @@ proc initItem*(
|
|||
proc `$`*(self: Item): string =
|
||||
result = fmt"""Item(
|
||||
id: {$self.id},
|
||||
communityId: {$self.communityId},
|
||||
responseToMessageWithId: {self.responseToMessageWithId},
|
||||
senderId: {self.senderId},
|
||||
senderDisplayName: {$self.senderDisplayName},
|
||||
|
@ -110,6 +114,9 @@ proc `$`*(self: Item): string =
|
|||
proc id*(self: Item): string {.inline.} =
|
||||
self.id
|
||||
|
||||
proc communityId*(self: Item): string {.inline.} =
|
||||
self.communityId
|
||||
|
||||
proc responseToMessageWithId*(self: Item): string {.inline.} =
|
||||
self.responseToMessageWithId
|
||||
|
||||
|
@ -219,6 +226,7 @@ proc transactionParameters*(self: Item): TransactionParametersItem {.inline.} =
|
|||
proc toJsonNode*(self: Item): JsonNode =
|
||||
result = %* {
|
||||
"id": self.id,
|
||||
"communityId": self.communityId,
|
||||
"responseToMessageWithId": self.responseToMessageWithId,
|
||||
"senderId": self.senderId,
|
||||
"senderDisplayName": self.senderDisplayName,
|
||||
|
|
|
@ -5,6 +5,7 @@ import message_item, message_reaction_item, message_transaction_parameters_item
|
|||
type
|
||||
ModelRole {.pure.} = enum
|
||||
Id = UserRole + 1
|
||||
CommunityId
|
||||
ResponseToMessageWithId
|
||||
SenderId
|
||||
SenderDisplayName
|
||||
|
@ -75,6 +76,7 @@ QtObject:
|
|||
method roleNames(self: Model): Table[int, string] =
|
||||
{
|
||||
ModelRole.Id.int:"id",
|
||||
ModelRole.CommunityId.int:"communityId",
|
||||
ModelRole.ResponseToMessageWithId.int:"responseToMessageWithId",
|
||||
ModelRole.SenderId.int:"senderId",
|
||||
ModelRole.SenderDisplayName.int:"senderDisplayName",
|
||||
|
@ -116,6 +118,8 @@ QtObject:
|
|||
case enumRole:
|
||||
of ModelRole.Id:
|
||||
result = newQVariant(item.id)
|
||||
of ModelRole.CommunityId:
|
||||
result = newQVariant(item.communityId)
|
||||
of ModelRole.ResponseToMessageWithId:
|
||||
result = newQVariant(item.responseToMessageWithId)
|
||||
of ModelRole.SenderId:
|
||||
|
|
|
@ -66,6 +66,7 @@ const SIGNAL_COMMUNITY_JOINED* = "communityJoined"
|
|||
const SIGNAL_COMMUNITY_MY_REQUEST_ADDED* = "communityMyRequestAdded"
|
||||
const SIGNAL_COMMUNITY_LEFT* = "communityLeft"
|
||||
const SIGNAL_COMMUNITY_CREATED* = "communityCreated"
|
||||
const SIGNAL_COMMUNITY_ADDED* = "communityAdded"
|
||||
const SIGNAL_COMMUNITY_IMPORTED* = "communityImported"
|
||||
const SIGNAL_COMMUNITY_DATA_IMPORTED* = "communityDataImported" # This one is when just loading the data with requestCommunityInfo
|
||||
const SIGNAL_COMMUNITY_EDITED* = "communityEdited"
|
||||
|
@ -183,6 +184,12 @@ QtObject:
|
|||
|
||||
proc handleCommunityUpdates(self: Service, communities: seq[CommunityDto], updatedChats: seq[ChatDto]) =
|
||||
var community = communities[0]
|
||||
|
||||
if(not self.allCommunities.hasKey(community.id)):
|
||||
self.events.emit(SIGNAL_COMMUNITY_ADDED, CommunityArgs(community: community))
|
||||
# add or update community
|
||||
self.allCommunities[community.id] = community
|
||||
|
||||
if(not self.joinedCommunities.hasKey(community.id)):
|
||||
return
|
||||
|
||||
|
|
|
@ -48,6 +48,7 @@ type TransactionParameters* = object
|
|||
|
||||
type MessageDto* = object
|
||||
id*: string
|
||||
communityId*: string
|
||||
whisperTimestamp*: int64
|
||||
`from`*: string
|
||||
alias*: string
|
||||
|
@ -120,6 +121,7 @@ proc toTransactionParameters*(jsonObj: JsonNode): TransactionParameters =
|
|||
proc toMessageDto*(jsonObj: JsonNode): MessageDto =
|
||||
result = MessageDto()
|
||||
discard jsonObj.getProp("id", result.id)
|
||||
discard jsonObj.getProp("communityId", result.communityId)
|
||||
discard jsonObj.getProp("whisperTimestamp", result.whisperTimestamp)
|
||||
discard jsonObj.getProp("from", result.from)
|
||||
discard jsonObj.getProp("alias", result.alias)
|
||||
|
|
|
@ -249,6 +249,7 @@ Item {
|
|||
messageContextMenu: messageContextMenuInst
|
||||
|
||||
messageId: model.id
|
||||
communityId: model.communityId
|
||||
responseToMessageWithId: model.responseToMessageWithId
|
||||
senderId: model.senderId
|
||||
senderDisplayName: model.senderDisplayName
|
||||
|
|
|
@ -35,6 +35,7 @@ Item {
|
|||
property bool amISender: false
|
||||
property bool isHovered: false
|
||||
property bool isInPinnedPopup: false
|
||||
property string communityId
|
||||
property bool showMoreButton: {
|
||||
if(!root.messageStore)
|
||||
return false
|
||||
|
@ -643,9 +644,8 @@ Item {
|
|||
sourceComponent: Component {
|
||||
id: invitationBubble
|
||||
InvitationBubbleView {
|
||||
// Not Refactored Yet
|
||||
// store: rootStore
|
||||
communityId: root.container.communityId
|
||||
store: root.store
|
||||
communityId: root.communityId
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@ Column {
|
|||
property bool isChatBlocked: false
|
||||
|
||||
property string messageId: ""
|
||||
property string communityId: ""
|
||||
property string responseToMessageWithId: ""
|
||||
property string senderId: ""
|
||||
property string senderDisplayName: ""
|
||||
|
@ -365,6 +366,7 @@ Column {
|
|||
contentType: root.messageContentType
|
||||
isChatBlocked: root.isChatBlocked
|
||||
|
||||
communityId: root.communityId
|
||||
stickersLoaded: root.stickersLoaded
|
||||
sticker: root.sticker
|
||||
stickerPack: root.stickerPack
|
||||
|
|
Loading…
Reference in New Issue