feat: add ViewersCanPostReactions to Chat object

Needed https://github.com/status-im/status-desktop/issues/13523
This commit is contained in:
Jonathan Rainville 2024-03-06 16:46:41 -05:00
parent b02e3b19e2
commit e3810148d8
3 changed files with 43 additions and 34 deletions

View File

@ -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,
}
}

View File

@ -104,6 +104,7 @@ type CommunityChat struct {
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"`
}
@ -192,6 +193,7 @@ func (o *Community) MarshalPublicAPIJSON() ([]byte, error) {
Permissions: c.Permissions,
Members: c.Members,
CanPost: canPost,
ViewersCanPostReactions: c.ViewersCanPostReactions,
CategoryID: c.CategoryId,
Position: int(c.Position),
}
@ -328,6 +330,7 @@ func (o *Community) MarshalJSON() ([]byte, error) {
Permissions: c.Permissions,
Members: c.Members,
CanPost: canPost,
ViewersCanPostReactions: c.ViewersCanPostReactions,
CategoryID: c.CategoryId,
Position: int(c.Position),
}

View File

@ -82,6 +82,7 @@ type Chat struct {
CanPost bool `json:"canPost"`
CanPostMessages bool `json:"canPostMessages"`
CanPostReactions bool `json:"canPostReactions"`
ViewersCanPostReactions bool `json:"viewersCanPostReactions"`
Base64Image string `json:"image,omitempty"`
}
@ -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
}