feat: community tags (#2708)

Signed-off-by: Richard Ramos <info@richardramos.me>

Co-authored-by: MishkaRogachev <mishkarogachev@gmail.com>
This commit is contained in:
Richard Ramos 2022-06-24 09:40:12 -04:00 committed by GitHub
parent 31feea9f15
commit 2873e65a61
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 243 additions and 85 deletions

View File

@ -1 +1 @@
0.102.3 0.102.4

View File

@ -16,6 +16,7 @@ import (
"github.com/status-im/status-go/images" "github.com/status-im/status-go/images"
"github.com/status-im/status-go/protocol/common" "github.com/status-im/status-go/protocol/common"
"github.com/status-im/status-go/protocol/protobuf" "github.com/status-im/status-go/protocol/protobuf"
"github.com/status-im/status-go/protocol/requests"
"github.com/status-im/status-go/protocol/v1" "github.com/status-im/status-go/protocol/v1"
) )
@ -83,6 +84,11 @@ type CommunityCategory struct {
Position int `json:"position"` // Position is used to sort the categories Position int `json:"position"` // Position is used to sort the categories
} }
type CommunityTag struct {
Name string `json:"name"`
Emoji string `json:"emoji"`
}
func (o *Community) MarshalPublicAPIJSON() ([]byte, error) { func (o *Community) MarshalPublicAPIJSON() ([]byte, error) {
if o.config.MemberIdentity == nil { if o.config.MemberIdentity == nil {
return nil, errors.New("member identity not set") return nil, errors.New("member identity not set")
@ -96,6 +102,7 @@ func (o *Community) MarshalPublicAPIJSON() ([]byte, error) {
Description string `json:"description"` Description string `json:"description"`
IntroMessage string `json:"introMessage"` IntroMessage string `json:"introMessage"`
OutroMessage string `json:"outroMessage"` OutroMessage string `json:"outroMessage"`
Tags []CommunityTag `json:"tags"`
Images map[string]images.IdentityImage `json:"images"` Images map[string]images.IdentityImage `json:"images"`
Color string `json:"color"` Color string `json:"color"`
MembersCount int `json:"membersCount"` MembersCount int `json:"membersCount"`
@ -108,6 +115,7 @@ func (o *Community) MarshalPublicAPIJSON() ([]byte, error) {
Verified: o.config.Verified, Verified: o.config.Verified,
Chats: make(map[string]CommunityChat), Chats: make(map[string]CommunityChat),
Categories: make(map[string]CommunityCategory), Categories: make(map[string]CommunityCategory),
Tags: o.Tags(),
} }
if o.config.CommunityDescription != nil { if o.config.CommunityDescription != nil {
for id, c := range o.config.CommunityDescription.Categories { for id, c := range o.config.CommunityDescription.Categories {
@ -181,6 +189,7 @@ func (o *Community) MarshalJSON() ([]byte, error) {
Description string `json:"description"` Description string `json:"description"`
IntroMessage string `json:"introMessage"` IntroMessage string `json:"introMessage"`
OutroMessage string `json:"outroMessage"` OutroMessage string `json:"outroMessage"`
Tags []CommunityTag `json:"tags"`
Chats map[string]CommunityChat `json:"chats"` Chats map[string]CommunityChat `json:"chats"`
Categories map[string]CommunityCategory `json:"categories"` Categories map[string]CommunityCategory `json:"categories"`
Images map[string]images.IdentityImage `json:"images"` Images map[string]images.IdentityImage `json:"images"`
@ -208,6 +217,7 @@ func (o *Community) MarshalJSON() ([]byte, error) {
RequestedToJoinAt: o.RequestedToJoinAt(), RequestedToJoinAt: o.RequestedToJoinAt(),
IsMember: o.isMember(), IsMember: o.isMember(),
Muted: o.config.Muted, Muted: o.config.Muted,
Tags: o.Tags(),
} }
if o.config.CommunityDescription != nil { if o.config.CommunityDescription != nil {
for id, c := range o.config.CommunityDescription.Categories { for id, c := range o.config.CommunityDescription.Categories {
@ -296,6 +306,22 @@ func (o *Community) IntroMessage() string {
return "" return ""
} }
func (o *Community) Tags() []CommunityTag {
if o != nil &&
o.config != nil &&
o.config.CommunityDescription != nil {
var result []CommunityTag
for _, t := range o.config.CommunityDescription.Tags {
result = append(result, CommunityTag{
Name: t,
Emoji: requests.TagsEmojies[t],
})
}
return result
}
return nil
}
func (o *Community) OutroMessage() string { func (o *Community) OutroMessage() string {
if o != nil && if o != nil &&
o.config != nil && o.config != nil &&
@ -792,6 +818,9 @@ func (o *Community) UpdateCommunityDescription(signer *ecdsa.PublicKey, descript
return nil, ErrNotAuthorized return nil, ErrNotAuthorized
} }
// This is done in case tags are updated and a client sends unknown tags
description.Tags = requests.RemoveUnknownAndDeduplicateTags(description.Tags)
err := ValidateCommunityDescription(description) err := ValidateCommunityDescription(description)
if err != nil { if err != nil {
return nil, err return nil, err

View File

@ -21,6 +21,7 @@ var ErrInvalidCommunityDescriptionCategoryNoName = errors.New("invalid community
var ErrInvalidCommunityDescriptionChatIdentity = errors.New("invalid community chat name, missing") var ErrInvalidCommunityDescriptionChatIdentity = errors.New("invalid community chat name, missing")
var ErrInvalidCommunityDescriptionDuplicatedName = errors.New("invalid community chat name, duplicated") var ErrInvalidCommunityDescriptionDuplicatedName = errors.New("invalid community chat name, duplicated")
var ErrInvalidCommunityDescriptionUnknownChatCategory = errors.New("invalid community category in chat") var ErrInvalidCommunityDescriptionUnknownChatCategory = errors.New("invalid community category in chat")
var ErrInvalidCommunityTags = errors.New("invalid community tags")
var ErrNotAdmin = errors.New("no admin privileges for this community") var ErrNotAdmin = errors.New("no admin privileges for this community")
var ErrInvalidGrant = errors.New("invalid grant") var ErrInvalidGrant = errors.New("invalid grant")
var ErrNotAuthorized = errors.New("not authorized") var ErrNotAuthorized = errors.New("not authorized")

View File

@ -2,6 +2,7 @@ package communities
import ( import (
"github.com/status-im/status-go/protocol/protobuf" "github.com/status-im/status-go/protocol/protobuf"
"github.com/status-im/status-go/protocol/requests"
) )
func validateCommunityChat(desc *protobuf.CommunityDescription, chat *protobuf.CommunityChat) error { func validateCommunityChat(desc *protobuf.CommunityDescription, chat *protobuf.CommunityChat) error {
@ -61,6 +62,11 @@ func ValidateCommunityDescription(desc *protobuf.CommunityDescription) error {
return ErrInvalidCommunityDescriptionUnknownOrgAccess return ErrInvalidCommunityDescriptionUnknownOrgAccess
} }
valid := requests.ValidateTags(desc.Tags)
if !valid {
return ErrInvalidCommunityTags
}
for _, category := range desc.Categories { for _, category := range desc.Categories {
if err := validateCommunityCategory(category); err != nil { if err := validateCommunityCategory(category); err != nil {
return err return err

View File

@ -250,6 +250,7 @@ type CommunityDescription struct {
IntroMessage string `protobuf:"bytes,11,opt,name=intro_message,json=introMessage,proto3" json:"intro_message,omitempty"` IntroMessage string `protobuf:"bytes,11,opt,name=intro_message,json=introMessage,proto3" json:"intro_message,omitempty"`
OutroMessage string `protobuf:"bytes,12,opt,name=outro_message,json=outroMessage,proto3" json:"outro_message,omitempty"` OutroMessage string `protobuf:"bytes,12,opt,name=outro_message,json=outroMessage,proto3" json:"outro_message,omitempty"`
Encrypted bool `protobuf:"varint,13,opt,name=encrypted,proto3" json:"encrypted,omitempty"` Encrypted bool `protobuf:"varint,13,opt,name=encrypted,proto3" json:"encrypted,omitempty"`
Tags []string `protobuf:"bytes,14,rep,name=tags,proto3" json:"tags,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"` XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"` XXX_sizecache int32 `json:"-"`
@ -364,6 +365,13 @@ func (m *CommunityDescription) GetEncrypted() bool {
return false return false
} }
func (m *CommunityDescription) GetTags() []string {
if m != nil {
return m.Tags
}
return nil
}
type CommunityAdminSettings struct { type CommunityAdminSettings struct {
PinMessageAllMembersEnabled bool `protobuf:"varint,1,opt,name=pin_message_all_members_enabled,json=pinMessageAllMembersEnabled,proto3" json:"pin_message_all_members_enabled,omitempty"` PinMessageAllMembersEnabled bool `protobuf:"varint,1,opt,name=pin_message_all_members_enabled,json=pinMessageAllMembersEnabled,proto3" json:"pin_message_all_members_enabled,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_NoUnkeyedLiteral struct{} `json:"-"`
@ -1111,88 +1119,88 @@ func init() {
} }
var fileDescriptor_f937943d74c1cd8b = []byte{ var fileDescriptor_f937943d74c1cd8b = []byte{
// 1315 bytes of a gzipped FileDescriptorProto // 1326 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x56, 0x4f, 0x6f, 0x1b, 0x45, 0x1f, 0x8b, 0x08, 0x00, 0x00,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, 0x7e, 0xb2, 0xd8, 0x04, 0x4f, 0x6b, 0x6f, 0x2a, 0xed, 0x7b, 0x9f, 0xc4, 0x9a, 0xa3, 0x82, 0x3e, 0x3d,
0x0d, 0x00, 0x00, 0xf8, 0x27, 0x00, 0x00, 0xff, 0xff, 0x53, 0xc5, 0x37, 0x14, 0x92, 0x0d, 0x00, 0x00,
} }

View File

@ -48,6 +48,7 @@ message CommunityDescription {
string intro_message = 11; string intro_message = 11;
string outro_message = 12; string outro_message = 12;
bool encrypted = 13; bool encrypted = 13;
repeated string tags = 14;
} }
message CommunityAdminSettings { message CommunityAdminSettings {

View File

@ -0,0 +1,98 @@
package requests
var TagsEmojies map[string]string
func init() {
TagsEmojies = make(map[string]string)
TagsEmojies["Activism"] = "✊"
TagsEmojies["Art"] = "🎨"
TagsEmojies["Blockchain"] = "🔗"
TagsEmojies["Books & blogs"] = "📚"
TagsEmojies["Career"] = "💼"
TagsEmojies["Collaboration"] = "🤝"
TagsEmojies["Commerce"] = "🛒"
TagsEmojies["Culture"] = "🎎"
TagsEmojies["DAO"] = "🚀"
TagsEmojies["DeFi"] = "📈"
TagsEmojies["Design"] = "🧩"
TagsEmojies["DIY"] = "🔨"
TagsEmojies["Environment"] = "🌿"
TagsEmojies["Education"] = "🎒"
TagsEmojies["Entertainment"] = "🍿"
TagsEmojies["Ethereum"] = "Ξ"
TagsEmojies["Event"] = "🗓"
TagsEmojies["Fantasy"] = "🧙‍♂️"
TagsEmojies["Fashion"] = "🧦"
TagsEmojies["Food"] = "🌶"
TagsEmojies["Gaming"] = "🎮"
TagsEmojies["Global"] = "🌍"
TagsEmojies["Health"] = "🧠"
TagsEmojies["Hobby"] = "📐"
TagsEmojies["Innovation"] = "🧪"
TagsEmojies["Language"] = "📜"
TagsEmojies["Lifestyle"] = "✨"
TagsEmojies["Local"] = "📍"
TagsEmojies["Love"] = "❤️"
TagsEmojies["Markets"] = "💎"
TagsEmojies["Movies & TV"] = "🎞"
TagsEmojies["Music"] = "🎶"
TagsEmojies["News"] = "🗞"
TagsEmojies["NFT"] = "🖼"
TagsEmojies["Non-profit"] = "🙏"
TagsEmojies["NSFW"] = "🍆"
TagsEmojies["Org"] = "🏢"
TagsEmojies["Pets"] = "🐶"
TagsEmojies["Play"] = "🎲"
TagsEmojies["Podcast"] = "🎙️"
TagsEmojies["Politics"] = "🗳️"
TagsEmojies["Product"] = "🍱"
TagsEmojies["Psyche"] = "🍁"
TagsEmojies["Privacy"] = "👻"
TagsEmojies["Security"] = "🔒"
TagsEmojies["Social"] = "☕"
TagsEmojies["Software dev"] = "👩‍💻"
TagsEmojies["Sports"] = "⚽️"
TagsEmojies["Tech"] = "📱"
TagsEmojies["Travel"] = "🗺"
TagsEmojies["Vehicles"] = "🚕"
TagsEmojies["Web3"] = "🌐"
}
func ValidateTags(input []string) bool {
for _, t := range input {
_, ok := TagsEmojies[t]
if !ok {
return false
}
}
if len(unique(input)) != len(input) {
// Contains duplicates. Shouldn't have happened
return false
}
return true
}
func RemoveUnknownAndDeduplicateTags(input []string) []string {
var result []string
for _, t := range input {
_, ok := TagsEmojies[t]
if ok {
result = append(result, t)
}
}
return unique(result)
}
func unique(slice []string) []string {
uniqMap := make(map[string]struct{})
for _, v := range slice {
uniqMap[v] = struct{}{}
}
uniqSlice := make([]string, 0, len(uniqMap))
for v := range uniqMap {
uniqSlice = append(uniqSlice, v)
}
return uniqSlice
}

View File

@ -16,6 +16,7 @@ var (
ErrCreateCommunityInvalidIntroMessage = errors.New("create-community: invalid intro message") ErrCreateCommunityInvalidIntroMessage = errors.New("create-community: invalid intro message")
ErrCreateCommunityInvalidOutroMessage = errors.New("create-community: invalid outro message") ErrCreateCommunityInvalidOutroMessage = errors.New("create-community: invalid outro message")
ErrCreateCommunityInvalidMembership = errors.New("create-community: invalid membership") ErrCreateCommunityInvalidMembership = errors.New("create-community: invalid membership")
ErrCreateCommunityInvalidTags = errors.New("create-community: invalid tags")
) )
const ( const (
@ -43,6 +44,7 @@ type CreateCommunity struct {
HistoryArchiveSupportEnabled bool `json:"historyArchiveSupportEnabled,omitempty"` HistoryArchiveSupportEnabled bool `json:"historyArchiveSupportEnabled,omitempty"`
PinMessageAllMembersEnabled bool `json:"pinMessageAllMembersEnabled,omitempty"` PinMessageAllMembersEnabled bool `json:"pinMessageAllMembersEnabled,omitempty"`
Encrypted bool `json:"encrypted,omitempty"` Encrypted bool `json:"encrypted,omitempty"`
Tags []string `json:"tags,omitempty"`
} }
func adaptIdentityImageToProtobuf(img *userimages.IdentityImage) *protobuf.IdentityImage { func adaptIdentityImageToProtobuf(img *userimages.IdentityImage) *protobuf.IdentityImage {
@ -78,6 +80,10 @@ func (c *CreateCommunity) Validate() error {
return ErrCreateCommunityInvalidColor return ErrCreateCommunityInvalidColor
} }
if !ValidateTags(c.Tags) {
return ErrCreateCommunityInvalidTags
}
return nil return nil
} }
@ -125,6 +131,7 @@ func (c *CreateCommunity) ToCommunityDescription() (*protobuf.CommunityDescripti
IntroMessage: c.IntroMessage, IntroMessage: c.IntroMessage,
OutroMessage: c.OutroMessage, OutroMessage: c.OutroMessage,
Encrypted: c.Encrypted, Encrypted: c.Encrypted,
Tags: c.Tags,
} }
return description, nil return description, nil
} }

View File

@ -89,6 +89,7 @@ type ChannelGroup struct {
Description string `json:"description"` Description string `json:"description"`
IntroMessage string `json:"introMessage"` IntroMessage string `json:"introMessage"`
OutroMessage string `json:"outroMessage"` OutroMessage string `json:"outroMessage"`
Tags []communities.CommunityTag `json:"tags"`
Permissions *protobuf.CommunityPermissions `json:"permissions"` Permissions *protobuf.CommunityPermissions `json:"permissions"`
Members map[string]*protobuf.CommunityMember `json:"members"` Members map[string]*protobuf.CommunityMember `json:"members"`
CanManageUsers bool `json:"canManageUsers"` CanManageUsers bool `json:"canManageUsers"`
@ -130,6 +131,7 @@ func (api *API) GetChats(ctx context.Context) (map[string]ChannelGroup, error) {
Description: "", Description: "",
IntroMessage: "", IntroMessage: "",
OutroMessage: "", OutroMessage: "",
Tags: []communities.CommunityTag{},
Permissions: &protobuf.CommunityPermissions{}, Permissions: &protobuf.CommunityPermissions{},
Muted: false, Muted: false,
} }
@ -159,6 +161,7 @@ func (api *API) GetChats(ctx context.Context) (map[string]ChannelGroup, error) {
Description: community.DescriptionText(), Description: community.DescriptionText(),
IntroMessage: community.IntroMessage(), IntroMessage: community.IntroMessage(),
OutroMessage: community.OutroMessage(), OutroMessage: community.OutroMessage(),
Tags: community.Tags(),
Permissions: community.Description().Permissions, Permissions: community.Description().Permissions,
Members: community.Description().Members, Members: community.Description().Members,
CanManageUsers: community.CanManageUsers(community.MemberIdentity()), CanManageUsers: community.CanManageUsers(community.MemberIdentity()),

View File

@ -352,6 +352,11 @@ func (api *PublicAPI) JoinedCommunities(parent context.Context) ([]*communities.
return api.service.messenger.JoinedCommunities() return api.service.messenger.JoinedCommunities()
} }
// CommunityTags return the list of possible community tags
func (api *PublicAPI) CommunityTags(parent context.Context) map[string]string {
return requests.TagsEmojies
}
// CuratedCommunities returns the list of curated communities stored in the smart contract. If a community is // CuratedCommunities returns the list of curated communities stored in the smart contract. If a community is
// already known by the node, its description will be returned and and will asynchronously retrieve the // already known by the node, its description will be returned and and will asynchronously retrieve the
// description for the communities it does not know // description for the communities it does not know