fix: fix channel color in communities
This commit is contained in:
parent
b33a7b8fcf
commit
84034d5dbf
|
@ -91,6 +91,25 @@ QtObject:
|
||||||
|
|
||||||
result.setup()
|
result.setup()
|
||||||
|
|
||||||
|
|
||||||
|
proc getChannel*(self: ChatsView, index: int): Chat =
|
||||||
|
if (self.communities.activeCommunity.active):
|
||||||
|
return self.communities.activeCommunity.chats.getChannel(index)
|
||||||
|
else:
|
||||||
|
return self.chats.getChannel(index)
|
||||||
|
|
||||||
|
proc getChannelById*(self: ChatsView, channel: string): Chat =
|
||||||
|
if (self.communities.activeCommunity.active):
|
||||||
|
return self.communities.activeCommunity.chats.getChannel(self.communities.activeCommunity.chats.chats.findIndexById(channel))
|
||||||
|
else:
|
||||||
|
return self.chats.getChannel(self.chats.chats.findIndexById(channel))
|
||||||
|
|
||||||
|
proc updateChannelInRightList*(self: ChatsView, channel: Chat) =
|
||||||
|
if (self.communities.activeCommunity.active):
|
||||||
|
self.communities.activeCommunity.chats.updateChat(channel)
|
||||||
|
else:
|
||||||
|
self.chats.updateChat(channel)
|
||||||
|
|
||||||
proc oldestMessageTimestampChanged*(self: ChatsView) {.signal.}
|
proc oldestMessageTimestampChanged*(self: ChatsView) {.signal.}
|
||||||
|
|
||||||
proc getOldestMessageTimestamp*(self: ChatsView): QVariant {.slot.} =
|
proc getOldestMessageTimestamp*(self: ChatsView): QVariant {.slot.} =
|
||||||
|
@ -125,7 +144,10 @@ QtObject:
|
||||||
read = getCommunities
|
read = getCommunities
|
||||||
|
|
||||||
proc getChannelColor*(self: ChatsView, channel: string): string {.slot.} =
|
proc getChannelColor*(self: ChatsView, channel: string): string {.slot.} =
|
||||||
self.chats.getChannelColor(channel)
|
if (channel == ""): return
|
||||||
|
let selectedChannel = self.getChannelById(channel)
|
||||||
|
if (selectedChannel.id == "") : return
|
||||||
|
return selectedChannel.color
|
||||||
|
|
||||||
proc replaceMentionsWithPubKeys(self: ChatsView, mentions: seq[string], contacts: seq[Profile], message: string, predicate: proc (contact: Profile): string): string =
|
proc replaceMentionsWithPubKeys(self: ChatsView, mentions: seq[string], contacts: seq[Profile], message: string, predicate: proc (contact: Profile): string): string =
|
||||||
var updatedMessage = message
|
var updatedMessage = message
|
||||||
|
@ -169,18 +191,6 @@ QtObject:
|
||||||
|
|
||||||
self.status.chat.sendMessage(channelId, m, replyTo, contentType)
|
self.status.chat.sendMessage(channelId, m, replyTo, contentType)
|
||||||
|
|
||||||
proc getChannel*(self: ChatsView, index: int): Chat =
|
|
||||||
if (self.communities.activeCommunity.active):
|
|
||||||
return self.communities.activeCommunity.chats.getChannel(index)
|
|
||||||
else:
|
|
||||||
return self.chats.getChannel(index)
|
|
||||||
|
|
||||||
proc getChannelById*(self: ChatsView, channel: string): Chat =
|
|
||||||
if (self.communities.activeCommunity.active):
|
|
||||||
return self.communities.activeCommunity.chats.getChannel(self.communities.activeCommunity.chats.chats.findIndexById(channel))
|
|
||||||
else:
|
|
||||||
return self.chats.getChannel(self.chats.chats.findIndexById(channel))
|
|
||||||
|
|
||||||
proc verifyMessageSent*(self: ChatsView, data: string) {.slot.} =
|
proc verifyMessageSent*(self: ChatsView, data: string) {.slot.} =
|
||||||
let messageData = data.parseJson
|
let messageData = data.parseJson
|
||||||
self.messageList[messageData["chatId"].getStr].checkTimeout(messageData["id"].getStr)
|
self.messageList[messageData["chatId"].getStr].checkTimeout(messageData["id"].getStr)
|
||||||
|
|
|
@ -27,8 +27,15 @@ Column {
|
||||||
if (chatsModel.activeChannel.chatType === Constants.chatTypeOneToOne) {
|
if (chatsModel.activeChannel.chatType === Constants.chatTypeOneToOne) {
|
||||||
return Style.current.transparent
|
return Style.current.transparent
|
||||||
}
|
}
|
||||||
|
if (chatsModel.activeChannel.color) {
|
||||||
return chatsModel.activeChannel.color
|
return chatsModel.activeChannel.color
|
||||||
}
|
}
|
||||||
|
const color = chatsModel.getChannelColor(chatId)
|
||||||
|
if (!color) {
|
||||||
|
return Style.current.orange
|
||||||
|
}
|
||||||
|
return color
|
||||||
|
}
|
||||||
|
|
||||||
RoundedImage {
|
RoundedImage {
|
||||||
visible: chatsModel.activeChannel.chatType === Constants.chatTypeOneToOne
|
visible: chatsModel.activeChannel.chatType === Constants.chatTypeOneToOne
|
||||||
|
|
|
@ -60,6 +60,7 @@ Rectangle {
|
||||||
id: chatInfo
|
id: chatInfo
|
||||||
StatusChatInfo {
|
StatusChatInfo {
|
||||||
identiconSize: 36
|
identiconSize: 36
|
||||||
|
chatId: chatsModel.activeChannel.id
|
||||||
chatName: chatsModel.activeChannel.name
|
chatName: chatsModel.activeChannel.name
|
||||||
chatType: chatsModel.activeChannel.chatType
|
chatType: chatsModel.activeChannel.chatType
|
||||||
identicon: chatsModel.activeChannel.identicon
|
identicon: chatsModel.activeChannel.identicon
|
||||||
|
|
|
@ -56,6 +56,7 @@ Rectangle {
|
||||||
id: contactImage
|
id: contactImage
|
||||||
height: !isCompact ? 40 : 28
|
height: !isCompact ? 40 : 28
|
||||||
width: !isCompact ? 40 : 28
|
width: !isCompact ? 40 : 28
|
||||||
|
chatId: wrapper.chatId
|
||||||
chatName: wrapper.name
|
chatName: wrapper.name
|
||||||
chatType: wrapper.chatType
|
chatType: wrapper.chatType
|
||||||
identicon: wrapper.profileImage || wrapper.identicon
|
identicon: wrapper.profileImage || wrapper.identicon
|
||||||
|
|
|
@ -61,6 +61,7 @@ ModalPopup {
|
||||||
height: 36
|
height: 36
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
color: popup.channel.color
|
color: popup.channel.color
|
||||||
|
chatId: popup.channel.id
|
||||||
chatName: popup.channel.name
|
chatName: popup.channel.name
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,6 +34,7 @@ Item {
|
||||||
StatusIdenticon {
|
StatusIdenticon {
|
||||||
id: chatIdenticon
|
id: chatIdenticon
|
||||||
chatType: root.chatType
|
chatType: root.chatType
|
||||||
|
chatId: root.chatId
|
||||||
chatName: root.chatName
|
chatName: root.chatName
|
||||||
identicon: root.profileImage || root.identicon
|
identicon: root.profileImage || root.identicon
|
||||||
width: root.isCompact ? 20 : root.identiconSize
|
width: root.isCompact ? 20 : root.identiconSize
|
||||||
|
|
|
@ -6,6 +6,7 @@ import "../../shared/status"
|
||||||
Item {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
|
property string chatId
|
||||||
property string chatName
|
property string chatName
|
||||||
property int chatType
|
property int chatType
|
||||||
property string identicon
|
property string identicon
|
||||||
|
@ -22,6 +23,7 @@ Item {
|
||||||
id: letterIdenticon
|
id: letterIdenticon
|
||||||
|
|
||||||
StatusLetterIdenticon {
|
StatusLetterIdenticon {
|
||||||
|
chatId: root.chatId
|
||||||
chatName: root.chatName
|
chatName: root.chatName
|
||||||
width: parent.width
|
width: parent.width
|
||||||
height: parent.height
|
height: parent.height
|
||||||
|
|
|
@ -5,6 +5,7 @@ import "../../shared"
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
|
property string chatId
|
||||||
property string chatName
|
property string chatName
|
||||||
|
|
||||||
width: 40
|
width: 40
|
||||||
|
@ -12,7 +13,7 @@ Rectangle {
|
||||||
radius: width / 2
|
radius: width / 2
|
||||||
|
|
||||||
color: {
|
color: {
|
||||||
const color = chatsModel.getChannelColor(root.chatName.startsWith("#") ? root.chatName.substr(1) : root.chatName)
|
const color = chatsModel.getChannelColor(chatId)
|
||||||
if (!color) {
|
if (!color) {
|
||||||
return Style.current.orange
|
return Style.current.orange
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue