feat: add ViewersCanPostReactions to Chat object
Needed https://github.com/status-im/status-desktop/issues/13523
This commit is contained in:
parent
b02e3b19e2
commit
e3810148d8
|
@ -87,6 +87,9 @@ type Chat struct {
|
|||
// Active indicates whether the chat has been soft deleted
|
||||
Active bool `json:"active"`
|
||||
|
||||
// ViewersCanPostReactions indicates whether users can post reactions in view only mode
|
||||
ViewersCanPostReactions bool `json:"viewersCanPostReactions"`
|
||||
|
||||
ChatType ChatType `json:"chatType"`
|
||||
|
||||
// Timestamp indicates the last time this chat has received/sent a message
|
||||
|
@ -500,6 +503,7 @@ func CreateCommunityChat(orgID, chatID string, orgChat *protobuf.CommunityChat,
|
|||
ReadMessagesAtClockValue: 0,
|
||||
ChatType: ChatTypeCommunityChat,
|
||||
FirstMessageTimestamp: orgChat.Identity.FirstMessageTimestamp,
|
||||
ViewersCanPostReactions: orgChat.ViewersCanPostReactions,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -96,16 +96,17 @@ type CommunityAdminSettings struct {
|
|||
}
|
||||
|
||||
type CommunityChat struct {
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Color string `json:"color"`
|
||||
Emoji string `json:"emoji"`
|
||||
Description string `json:"description"`
|
||||
Members map[string]*protobuf.CommunityMember `json:"members"`
|
||||
Permissions *protobuf.CommunityPermissions `json:"permissions"`
|
||||
CanPost bool `json:"canPost"`
|
||||
Position int `json:"position"`
|
||||
CategoryID string `json:"categoryID"`
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Color string `json:"color"`
|
||||
Emoji string `json:"emoji"`
|
||||
Description string `json:"description"`
|
||||
Members map[string]*protobuf.CommunityMember `json:"members"`
|
||||
Permissions *protobuf.CommunityPermissions `json:"permissions"`
|
||||
CanPost bool `json:"canPost"`
|
||||
ViewersCanPostReactions bool `json:"viewersCanPostReactions"`
|
||||
Position int `json:"position"`
|
||||
CategoryID string `json:"categoryID"`
|
||||
}
|
||||
|
||||
type CommunityCategory struct {
|
||||
|
@ -184,16 +185,17 @@ func (o *Community) MarshalPublicAPIJSON() ([]byte, error) {
|
|||
return nil, err
|
||||
}
|
||||
chat := CommunityChat{
|
||||
ID: id,
|
||||
Name: c.Identity.DisplayName,
|
||||
Color: c.Identity.Color,
|
||||
Emoji: c.Identity.Emoji,
|
||||
Description: c.Identity.Description,
|
||||
Permissions: c.Permissions,
|
||||
Members: c.Members,
|
||||
CanPost: canPost,
|
||||
CategoryID: c.CategoryId,
|
||||
Position: int(c.Position),
|
||||
ID: id,
|
||||
Name: c.Identity.DisplayName,
|
||||
Color: c.Identity.Color,
|
||||
Emoji: c.Identity.Emoji,
|
||||
Description: c.Identity.Description,
|
||||
Permissions: c.Permissions,
|
||||
Members: c.Members,
|
||||
CanPost: canPost,
|
||||
ViewersCanPostReactions: c.ViewersCanPostReactions,
|
||||
CategoryID: c.CategoryId,
|
||||
Position: int(c.Position),
|
||||
}
|
||||
communityItem.Chats[id] = chat
|
||||
}
|
||||
|
@ -320,16 +322,17 @@ func (o *Community) MarshalJSON() ([]byte, error) {
|
|||
return nil, err
|
||||
}
|
||||
chat := CommunityChat{
|
||||
ID: id,
|
||||
Name: c.Identity.DisplayName,
|
||||
Emoji: c.Identity.Emoji,
|
||||
Color: c.Identity.Color,
|
||||
Description: c.Identity.Description,
|
||||
Permissions: c.Permissions,
|
||||
Members: c.Members,
|
||||
CanPost: canPost,
|
||||
CategoryID: c.CategoryId,
|
||||
Position: int(c.Position),
|
||||
ID: id,
|
||||
Name: c.Identity.DisplayName,
|
||||
Emoji: c.Identity.Emoji,
|
||||
Color: c.Identity.Color,
|
||||
Description: c.Identity.Description,
|
||||
Permissions: c.Permissions,
|
||||
Members: c.Members,
|
||||
CanPost: canPost,
|
||||
ViewersCanPostReactions: c.ViewersCanPostReactions,
|
||||
CategoryID: c.CategoryId,
|
||||
Position: int(c.Position),
|
||||
}
|
||||
communityItem.Chats[id] = chat
|
||||
}
|
||||
|
|
|
@ -79,10 +79,11 @@ type Chat struct {
|
|||
PinnedMessages *PinnedMessages `json:"pinnedMessages,omitempty"`
|
||||
// Deprecated: CanPost is deprecated in favor of CanPostMessages/CanPostReactions/etc.
|
||||
// For now CanPost will equal to CanPostMessages.
|
||||
CanPost bool `json:"canPost"`
|
||||
CanPostMessages bool `json:"canPostMessages"`
|
||||
CanPostReactions bool `json:"canPostReactions"`
|
||||
Base64Image string `json:"image,omitempty"`
|
||||
CanPost bool `json:"canPost"`
|
||||
CanPostMessages bool `json:"canPostMessages"`
|
||||
CanPostReactions bool `json:"canPostReactions"`
|
||||
ViewersCanPostReactions bool `json:"viewersCanPostReactions"`
|
||||
Base64Image string `json:"image,omitempty"`
|
||||
}
|
||||
|
||||
type ChannelGroup struct {
|
||||
|
@ -505,6 +506,7 @@ func (chat *Chat) populateCommunityFields(community *communities.Community) erro
|
|||
chat.CanPost = canPostMessages
|
||||
chat.CanPostMessages = canPostMessages
|
||||
chat.CanPostReactions = canPostReactions
|
||||
chat.ViewersCanPostReactions = commChat.ViewersCanPostReactions
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue