From a62e76d3edb67f5eff96c6aa953e8b98c4f35807 Mon Sep 17 00:00:00 2001 From: Eric Mastro Date: Tue, 1 Jun 2021 22:13:17 +1000 Subject: [PATCH] Change community channel description (#2236) Co-authored-by: Volodymyr Kozieiev --- VERSION | 2 +- protocol/chat.go | 8 +- protocol/communities/community.go | 37 ++- protocol/communities/community_test.go | 54 ++++ protocol/communities/manager.go | 24 ++ protocol/messenger_communities.go | 31 ++ protocol/migrations/migrations.go | 279 +++++++++--------- .../1622023791_add_chat_description.up.sql | 2 + protocol/persistence.go | 11 +- protocol/persistence_test.go | 28 ++ services/ext/api.go | 5 + 11 files changed, 329 insertions(+), 152 deletions(-) create mode 100644 protocol/migrations/sqlite/1622023791_add_chat_description.up.sql diff --git a/VERSION b/VERSION index 01b0cd0a7..993d39801 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.79.7 +0.79.8 diff --git a/protocol/chat.go b/protocol/chat.go index c776a06b2..451680227 100644 --- a/protocol/chat.go +++ b/protocol/chat.go @@ -42,9 +42,10 @@ type Chat struct { // ID is the id of the chat, for public chats it is the name e.g. status, for one-to-one // is the hex encoded public key and for group chats is a random uuid appended with // the hex encoded pk of the creator of the chat - ID string `json:"id"` - Name string `json:"name"` - Color string `json:"color"` + ID string `json:"id"` + Name string `json:"name"` + Description string `json:"description"` + Color string `json:"color"` // Active indicates whether the chat has been soft deleted Active bool `json:"active"` @@ -312,6 +313,7 @@ func CreateCommunityChat(orgID, chatID string, orgChat *protobuf.CommunityChat, CommunityID: orgID, CategoryID: orgChat.CategoryId, Name: orgChat.Identity.DisplayName, + Description: orgChat.Identity.Description, Active: true, Color: color, ID: orgID + chatID, diff --git a/protocol/communities/community.go b/protocol/communities/community.go index 2f6420c8e..d6bfc8d4b 100644 --- a/protocol/communities/community.go +++ b/protocol/communities/community.go @@ -59,6 +59,7 @@ func New(config Config) (*Community, error) { type CommunityChat struct { ID string `json:"id"` Name string `json:"name"` + Description string `json:"description"` Members map[string]*protobuf.CommunityMember `json:"members"` Permissions *protobuf.CommunityPermissions `json:"permissions"` CanPost bool `json:"canPost"` @@ -125,6 +126,7 @@ func (o *Community) MarshalJSON() ([]byte, error) { chat := CommunityChat{ ID: id, Name: c.Identity.DisplayName, + Description: c.Identity.Description, Permissions: c.Permissions, Members: c.Members, CanPost: canPost, @@ -189,6 +191,7 @@ func (o *Community) initialize() { } type CommunityChatChanges struct { + ChatModified *protobuf.CommunityChat MembersAdded map[string]*protobuf.CommunityMember MembersRemoved map[string]*protobuf.CommunityMember CategoryModified string @@ -243,7 +246,7 @@ func (o *Community) CreateChat(chatID string, chat *protobuf.CommunityChat) (*Co o.mutex.Lock() defer o.mutex.Unlock() - if o.config.PrivateKey == nil { + if !o.IsAdmin() { return nil, ErrNotAdmin } @@ -276,6 +279,38 @@ func (o *Community) CreateChat(chatID string, chat *protobuf.CommunityChat) (*Co return changes, nil } +func (o *Community) EditChat(chatID string, chat *protobuf.CommunityChat) (*CommunityChanges, error) { + o.mutex.Lock() + defer o.mutex.Unlock() + + if !o.IsAdmin() { + return nil, ErrNotAdmin + } + + err := validateCommunityChat(o.config.CommunityDescription, chat) + if err != nil { + return nil, err + } + + if o.config.CommunityDescription.Chats == nil { + o.config.CommunityDescription.Chats = make(map[string]*protobuf.CommunityChat) + } + if _, exists := o.config.CommunityDescription.Chats[chatID]; !exists { + return nil, ErrChatNotFound + } + + o.config.CommunityDescription.Chats[chatID] = chat + + o.increaseClock() + + changes := o.emptyCommunityChanges() + changes.ChatsModified[chatID] = &CommunityChatChanges{ + ChatModified: chat, + } + + return changes, nil +} + func (o *Community) DeleteChat(chatID string) (*protobuf.CommunityDescription, error) { o.mutex.Lock() defer o.mutex.Unlock() diff --git a/protocol/communities/community_test.go b/protocol/communities/community_test.go index 627d21561..c2fb02725 100644 --- a/protocol/communities/community_test.go +++ b/protocol/communities/community_test.go @@ -143,6 +143,60 @@ func (s *CommunitySuite) TestCreateChat() { s.Require().NotNil(changes.ChatsAdded[newChatID]) } +func (s *CommunitySuite) TestEditChat() { + newChatID := "new-chat-id" + org := s.buildCommunity(&s.identity.PublicKey) + + identity := &protobuf.ChatIdentity{ + DisplayName: "new-chat-display-name", + Description: "new-chat-description", + } + permissions := &protobuf.CommunityPermissions{ + Access: protobuf.CommunityPermissions_NO_MEMBERSHIP, + Private: false, + } + + _, err := org.CreateChat(newChatID, &protobuf.CommunityChat{ + Identity: identity, + Permissions: permissions, + }) + s.Require().NoError(err) + + org.config.PrivateKey = nil + editedIdentity := &protobuf.ChatIdentity{ + DisplayName: "edited-new-chat-display-name", + Description: "edited-new-chat-description", + } + editedPermissions := &protobuf.CommunityPermissions{ + Access: protobuf.CommunityPermissions_NO_MEMBERSHIP, + Private: true, + } + _, err = org.EditChat(newChatID, &protobuf.CommunityChat{ + Identity: editedIdentity, + Permissions: editedPermissions, + }) + s.Require().Equal(ErrNotAdmin, err) + + description := org.config.CommunityDescription + org.config.PrivateKey = s.identity + editChanges, err := org.EditChat(newChatID, &protobuf.CommunityChat{ + Identity: editedIdentity, + Permissions: editedPermissions, + }) + + s.Require().NoError(err) + + s.Require().NotNil(description.Chats[newChatID]) + s.Require().NotEmpty(description.Clock) + s.Require().Equal(editedPermissions, description.Chats[newChatID].Permissions) + s.Require().Equal(editedIdentity, description.Chats[newChatID].Identity) + + s.Require().NotNil(editChanges) + s.Require().NotNil(editChanges.ChatsModified[newChatID]) + s.Require().Equal(editChanges.ChatsModified[newChatID].ChatModified.Identity, editedIdentity) + s.Require().Equal(editChanges.ChatsModified[newChatID].ChatModified.Permissions, editedPermissions) +} + func (s *CommunitySuite) TestDeleteChat() { org := s.buildCommunity(&s.identity.PublicKey) org.config.PrivateKey = nil diff --git a/protocol/communities/manager.go b/protocol/communities/manager.go index b20306524..214c6683d 100644 --- a/protocol/communities/manager.go +++ b/protocol/communities/manager.go @@ -310,6 +310,30 @@ func (m *Manager) CreateChat(communityID types.HexBytes, chat *protobuf.Communit return community, changes, nil } +func (m *Manager) EditChat(communityID types.HexBytes, chatID string, chat *protobuf.CommunityChat) (*Community, *CommunityChanges, error) { + community, err := m.GetByID(communityID) + if err != nil { + return nil, nil, err + } + if community == nil { + return nil, nil, ErrOrgNotFound + } + changes, err := community.EditChat(chatID, chat) + if err != nil { + return nil, nil, err + } + + err = m.persistence.SaveCommunity(community) + if err != nil { + return nil, nil, err + } + + // Advertise changes + m.publish(&Subscription{Community: community}) + + return community, changes, nil +} + func (m *Manager) CreateCategory(request *requests.CreateCommunityCategory) (*Community, *CommunityChanges, error) { community, err := m.GetByID(request.CommunityID) if err != nil { diff --git a/protocol/messenger_communities.go b/protocol/messenger_communities.go index 7f2980e5b..a417e4ee6 100644 --- a/protocol/messenger_communities.go +++ b/protocol/messenger_communities.go @@ -412,6 +412,37 @@ func (m *Messenger) CreateCommunityChat(communityID types.HexBytes, c *protobuf. return &response, m.saveChats(chats) } +func (m *Messenger) EditCommunityChat(communityID types.HexBytes, chatID string, c *protobuf.CommunityChat) (*MessengerResponse, error) { + var response MessengerResponse + community, changes, err := m.communitiesManager.EditChat(communityID, chatID, c) + if err != nil { + return nil, err + } + response.AddCommunity(community) + response.CommunityChanges = []*communities.CommunityChanges{changes} + + var chats []*Chat + var chatIDs []string + for chatID, chat := range changes.ChatsModified { + c := CreateCommunityChat(community.IDString(), chatID, chat.ChatModified, m.getTimesource()) + chats = append(chats, c) + chatIDs = append(chatIDs, c.ID) + response.AddChat(c) + } + + // Load filters + filters, err := m.transport.InitPublicFilters(chatIDs) + if err != nil { + return nil, err + } + _, err = m.scheduleSyncFilters(filters) + if err != nil { + return nil, err + } + + return &response, m.saveChats(chats) +} + func (m *Messenger) CreateCommunity(request *requests.CreateCommunity) (*MessengerResponse, error) { if err := request.Validate(); err != nil { return nil, err diff --git a/protocol/migrations/migrations.go b/protocol/migrations/migrations.go index 37abd6c35..d23cfb280 100644 --- a/protocol/migrations/migrations.go +++ b/protocol/migrations/migrations.go @@ -32,6 +32,7 @@ // 1619099821_add_last_synced_field.up.sql (226B) // 1621933219_add_mentioned.up.sql (70B) // 1622010048_add_unviewed_mentions_count.up.sql (114B) +// 1622023791_add_chat_description.up.sql (93B) // 1622061278_add_message_activity_center_notification_field.up.sql (80B) // 1622464518_set_synced_to_from.up.sql (105B) // README.md (554B) @@ -55,7 +56,7 @@ import ( func bindataRead(data []byte, name string) ([]byte, error) { gz, err := gzip.NewReader(bytes.NewBuffer(data)) if err != nil { - return nil, fmt.Errorf("read %q: %v", name, err) + return nil, fmt.Errorf("read %q: %w", name, err) } var buf bytes.Buffer @@ -63,7 +64,7 @@ func bindataRead(data []byte, name string) ([]byte, error) { clErr := gz.Close() if err != nil { - return nil, fmt.Errorf("read %q: %v", name, err) + return nil, fmt.Errorf("read %q: %w", name, err) } if clErr != nil { return nil, err @@ -119,7 +120,7 @@ func _000001_initDownDbSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "000001_init.down.db.sql", size: 65, mode: os.FileMode(0644), modTime: time.Unix(1610007618, 0)} + info := bindataFileInfo{name: "000001_init.down.db.sql", size: 65, mode: os.FileMode(0644), modTime: time.Unix(1621849873, 0)} a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x5e, 0xbb, 0x3f, 0x1, 0x75, 0x19, 0x70, 0x86, 0xa7, 0x34, 0x40, 0x17, 0x34, 0x3e, 0x18, 0x51, 0x79, 0xd4, 0x22, 0xad, 0x8f, 0x80, 0xcc, 0xa6, 0xcc, 0x6, 0x2b, 0x62, 0x2, 0x47, 0xba, 0xf9}} return a, nil } @@ -139,7 +140,7 @@ func _000001_initUpDbSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "000001_init.up.db.sql", size: 2719, mode: os.FileMode(0644), modTime: time.Unix(1610007618, 0)} + info := bindataFileInfo{name: "000001_init.up.db.sql", size: 2719, mode: os.FileMode(0644), modTime: time.Unix(1621849873, 0)} a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x60, 0xdc, 0xeb, 0xe, 0xc2, 0x4f, 0x75, 0xa, 0xf6, 0x3e, 0xc7, 0xc4, 0x4, 0xe2, 0xe1, 0xa4, 0x73, 0x2f, 0x4a, 0xad, 0x1a, 0x0, 0xc3, 0x93, 0x9d, 0x77, 0x3e, 0x31, 0x91, 0x77, 0x2e, 0xc8}} return a, nil } @@ -159,7 +160,7 @@ func _000002_add_last_ens_clock_valueUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "000002_add_last_ens_clock_value.up.sql", size: 77, mode: os.FileMode(0644), modTime: time.Unix(1610007618, 0)} + info := bindataFileInfo{name: "000002_add_last_ens_clock_value.up.sql", size: 77, mode: os.FileMode(0644), modTime: time.Unix(1621849873, 0)} a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x4d, 0x3, 0x8f, 0xd5, 0x85, 0x83, 0x47, 0xbe, 0xf9, 0x82, 0x7e, 0x81, 0xa4, 0xbd, 0xaa, 0xd5, 0x98, 0x18, 0x5, 0x2d, 0x82, 0x42, 0x3b, 0x3, 0x50, 0xc3, 0x1e, 0x84, 0x35, 0xf, 0xb6, 0x2b}} return a, nil } @@ -179,7 +180,7 @@ func _1586358095_add_replaceUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1586358095_add_replace.up.sql", size: 224, mode: os.FileMode(0644), modTime: time.Unix(1611588719, 0)} + info := bindataFileInfo{name: "1586358095_add_replace.up.sql", size: 224, mode: os.FileMode(0644), modTime: time.Unix(1621849873, 0)} a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xd2, 0xb3, 0xa9, 0xc7, 0x7f, 0x9d, 0x8f, 0x43, 0x8c, 0x9e, 0x58, 0x8d, 0x44, 0xbc, 0xfa, 0x6b, 0x5f, 0x3f, 0x5a, 0xbe, 0xe8, 0xb1, 0x16, 0xf, 0x91, 0x2a, 0xa0, 0x71, 0xbb, 0x8d, 0x6b, 0xcb}} return a, nil } @@ -199,7 +200,7 @@ func _1588665364_add_image_dataUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1588665364_add_image_data.up.sql", size: 186, mode: os.FileMode(0644), modTime: time.Unix(1611588719, 0)} + info := bindataFileInfo{name: "1588665364_add_image_data.up.sql", size: 186, mode: os.FileMode(0644), modTime: time.Unix(1621849873, 0)} a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xd6, 0xc6, 0x35, 0xb4, 0x4c, 0x39, 0x96, 0x29, 0x30, 0xda, 0xf4, 0x8f, 0xcb, 0xf1, 0x9f, 0x84, 0xdc, 0x88, 0xd4, 0xd5, 0xbc, 0xb6, 0x5b, 0x46, 0x78, 0x67, 0x76, 0x1a, 0x5, 0x36, 0xdc, 0xe5}} return a, nil } @@ -219,7 +220,7 @@ func _1589365189_add_pow_targetUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1589365189_add_pow_target.up.sql", size: 66, mode: os.FileMode(0644), modTime: time.Unix(1611588719, 0)} + info := bindataFileInfo{name: "1589365189_add_pow_target.up.sql", size: 66, mode: os.FileMode(0644), modTime: time.Unix(1621849873, 0)} a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x4e, 0x3a, 0xe2, 0x2e, 0x7d, 0xaf, 0xbb, 0xcc, 0x21, 0xa1, 0x7a, 0x41, 0x9a, 0xd0, 0xbb, 0xa9, 0xc8, 0x35, 0xf9, 0x32, 0x34, 0x46, 0x44, 0x9a, 0x86, 0x40, 0x7c, 0xb9, 0x23, 0xc7, 0x3, 0x3f}} return a, nil } @@ -239,7 +240,7 @@ func _1591277220_add_index_messagesUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1591277220_add_index_messages.up.sql", size: 240, mode: os.FileMode(0644), modTime: time.Unix(1614609069, 0)} + info := bindataFileInfo{name: "1591277220_add_index_messages.up.sql", size: 240, mode: os.FileMode(0644), modTime: time.Unix(1621849873, 0)} a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x9c, 0xfe, 0xbe, 0xd5, 0xb8, 0x8f, 0xdd, 0xef, 0xbb, 0xa8, 0xad, 0x7f, 0xed, 0x5b, 0x5b, 0x2f, 0xe6, 0x82, 0x27, 0x78, 0x1f, 0xb9, 0x57, 0xdc, 0x8, 0xc2, 0xb2, 0xa9, 0x9a, 0x4, 0xe1, 0x7a}} return a, nil } @@ -259,7 +260,7 @@ func _1593087212_add_mute_chat_and_raw_message_fieldsUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1593087212_add_mute_chat_and_raw_message_fields.up.sql", size: 215, mode: os.FileMode(0644), modTime: time.Unix(1611588835, 0)} + info := bindataFileInfo{name: "1593087212_add_mute_chat_and_raw_message_fields.up.sql", size: 215, mode: os.FileMode(0644), modTime: time.Unix(1621849873, 0)} a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x73, 0x99, 0x61, 0xd1, 0xaa, 0xb4, 0xbf, 0xaf, 0xd7, 0x20, 0x17, 0x40, 0xf9, 0x2, 0xfb, 0xcc, 0x40, 0x2a, 0xd, 0x86, 0x36, 0x30, 0x88, 0x89, 0x25, 0x80, 0x42, 0xb0, 0x5b, 0xe9, 0x73, 0x78}} return a, nil } @@ -279,7 +280,7 @@ func _1595862781_add_audio_dataUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1595862781_add_audio_data.up.sql", size: 246, mode: os.FileMode(0644), modTime: time.Unix(1611588835, 0)} + info := bindataFileInfo{name: "1595862781_add_audio_data.up.sql", size: 246, mode: os.FileMode(0644), modTime: time.Unix(1621849873, 0)} a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xae, 0xd2, 0xee, 0x55, 0xfb, 0x36, 0xa4, 0x92, 0x66, 0xe, 0x81, 0x62, 0x1e, 0x7a, 0x69, 0xa, 0xd5, 0x4b, 0xa5, 0x6a, 0x8d, 0x1d, 0xce, 0xf3, 0x3e, 0xc0, 0x5f, 0x9c, 0x66, 0x1b, 0xb4, 0xed}} return a, nil } @@ -299,7 +300,7 @@ func _1595865249_create_emoji_reactions_tableUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1595865249_create_emoji_reactions_table.up.sql", size: 300, mode: os.FileMode(0644), modTime: time.Unix(1611588835, 0)} + info := bindataFileInfo{name: "1595865249_create_emoji_reactions_table.up.sql", size: 300, mode: os.FileMode(0644), modTime: time.Unix(1621849873, 0)} a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x3e, 0xc5, 0x43, 0x5c, 0x3d, 0x53, 0x43, 0x2c, 0x1a, 0xa5, 0xb6, 0xbf, 0x7, 0x4, 0x5a, 0x3e, 0x40, 0x8b, 0xa4, 0x57, 0x12, 0x58, 0xbc, 0x42, 0xe2, 0xc3, 0xde, 0x76, 0x98, 0x80, 0xe2, 0xbe}} return a, nil } @@ -319,7 +320,7 @@ func _1596805115_create_group_chat_invitations_tableUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1596805115_create_group_chat_invitations_table.up.sql", size: 231, mode: os.FileMode(0644), modTime: time.Unix(1611588835, 0)} + info := bindataFileInfo{name: "1596805115_create_group_chat_invitations_table.up.sql", size: 231, mode: os.FileMode(0644), modTime: time.Unix(1621849873, 0)} a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x6d, 0xb1, 0x14, 0x6d, 0x54, 0x28, 0x67, 0xc3, 0x23, 0x6a, 0xfc, 0x80, 0xdf, 0x9e, 0x4c, 0x35, 0x36, 0xf, 0xf8, 0xf3, 0x5f, 0xae, 0xad, 0xb, 0xc1, 0x51, 0x8e, 0x17, 0x7, 0xe5, 0x7f, 0x91}} return a, nil } @@ -339,7 +340,7 @@ func _1597322655_add_invitation_admin_chat_fieldUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1597322655_add_invitation_admin_chat_field.up.sql", size: 54, mode: os.FileMode(0644), modTime: time.Unix(1611588835, 0)} + info := bindataFileInfo{name: "1597322655_add_invitation_admin_chat_field.up.sql", size: 54, mode: os.FileMode(0644), modTime: time.Unix(1621849873, 0)} a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xa9, 0x7a, 0xa0, 0xf2, 0xdb, 0x13, 0x91, 0x91, 0xa8, 0x34, 0x1a, 0xa1, 0x49, 0x68, 0xd5, 0xae, 0x2c, 0xd8, 0xd5, 0xea, 0x8f, 0x8c, 0xc7, 0x2, 0x4e, 0x58, 0x2c, 0x3a, 0x14, 0xd4, 0x4f, 0x2c}} return a, nil } @@ -359,7 +360,7 @@ func _1597757544_add_nicknameUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1597757544_add_nickname.up.sql", size: 52, mode: os.FileMode(0644), modTime: time.Unix(1611588835, 0)} + info := bindataFileInfo{name: "1597757544_add_nickname.up.sql", size: 52, mode: os.FileMode(0644), modTime: time.Unix(1621849873, 0)} a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xf4, 0xa2, 0x64, 0x50, 0xc5, 0x4, 0xb9, 0x8b, 0xd1, 0x18, 0x9b, 0xc3, 0x91, 0x36, 0x2a, 0x1f, 0xc3, 0x6c, 0x2d, 0x92, 0xf8, 0x5e, 0xff, 0xb1, 0x59, 0x61, 0x2, 0x1c, 0xe1, 0x85, 0x90, 0xa4}} return a, nil } @@ -379,7 +380,7 @@ func _1598955122_add_mentionsUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1598955122_add_mentions.up.sql", size: 52, mode: os.FileMode(0644), modTime: time.Unix(1611588835, 0)} + info := bindataFileInfo{name: "1598955122_add_mentions.up.sql", size: 52, mode: os.FileMode(0644), modTime: time.Unix(1621849873, 0)} a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x8d, 0x22, 0x17, 0x92, 0xd2, 0x11, 0x4e, 0x7, 0x93, 0x9a, 0x55, 0xfd, 0xb, 0x97, 0xc4, 0x63, 0x6a, 0x81, 0x97, 0xcd, 0xb2, 0xf8, 0x4b, 0x5f, 0x3c, 0xfa, 0x3a, 0x38, 0x53, 0x10, 0xed, 0x9d}} return a, nil } @@ -399,7 +400,7 @@ func _1599641390_add_emoji_reactions_indexUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1599641390_add_emoji_reactions_index.up.sql", size: 126, mode: os.FileMode(0644), modTime: time.Unix(1611588835, 0)} + info := bindataFileInfo{name: "1599641390_add_emoji_reactions_index.up.sql", size: 126, mode: os.FileMode(0644), modTime: time.Unix(1621849873, 0)} a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xf9, 0xd8, 0xdc, 0xa7, 0xb, 0x92, 0x7a, 0x61, 0x37, 0x24, 0x1c, 0x77, 0x5e, 0xe, 0x7e, 0xfc, 0x9f, 0x98, 0x7b, 0x65, 0xe7, 0xf9, 0x71, 0x57, 0x89, 0x2d, 0x90, 0x1b, 0xf6, 0x5e, 0x37, 0xe8}} return a, nil } @@ -419,7 +420,7 @@ func _1599720851_add_seen_index_remove_long_messagesUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1599720851_add_seen_index_remove_long_messages.up.sql", size: 150, mode: os.FileMode(0644), modTime: time.Unix(1611588835, 0)} + info := bindataFileInfo{name: "1599720851_add_seen_index_remove_long_messages.up.sql", size: 150, mode: os.FileMode(0644), modTime: time.Unix(1621849873, 0)} a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x24, 0x1c, 0xc4, 0x78, 0x91, 0xc7, 0xeb, 0xfe, 0xc8, 0xa0, 0xd8, 0x13, 0x27, 0x97, 0xc8, 0x96, 0x56, 0x97, 0x33, 0x2c, 0x1e, 0x16, 0x8a, 0xd3, 0x49, 0x99, 0x3, 0xe9, 0xbb, 0xc4, 0x5, 0x3c}} return a, nil } @@ -439,7 +440,7 @@ func _1603198582_add_profile_chat_fieldUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1603198582_add_profile_chat_field.up.sql", size: 45, mode: os.FileMode(0644), modTime: time.Unix(1617280156, 0)} + info := bindataFileInfo{name: "1603198582_add_profile_chat_field.up.sql", size: 45, mode: os.FileMode(0644), modTime: time.Unix(1621849873, 0)} a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xaa, 0xca, 0xe, 0x46, 0xa0, 0x9, 0x9d, 0x47, 0x57, 0xe9, 0xfb, 0x17, 0xeb, 0x9c, 0xf6, 0xb8, 0x1d, 0xe9, 0xd, 0x0, 0xd5, 0xe5, 0xd8, 0x9e, 0x60, 0xa, 0xbf, 0x32, 0x2c, 0x52, 0x7f, 0x6a}} return a, nil } @@ -459,7 +460,7 @@ func _1603816533_add_linksUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1603816533_add_links.up.sql", size: 48, mode: os.FileMode(0644), modTime: time.Unix(1617280156, 0)} + info := bindataFileInfo{name: "1603816533_add_links.up.sql", size: 48, mode: os.FileMode(0644), modTime: time.Unix(1621849873, 0)} a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xc9, 0x24, 0xd6, 0x1d, 0xa, 0x83, 0x1e, 0x4d, 0xf, 0xae, 0x4d, 0x8c, 0x51, 0x32, 0xa8, 0x37, 0xb0, 0x14, 0xfb, 0x32, 0x34, 0xc8, 0xc, 0x4e, 0x5b, 0xc5, 0x15, 0x65, 0x73, 0x0, 0x0, 0x1d}} return a, nil } @@ -479,7 +480,7 @@ func _1603888149_create_chat_identity_last_published_tableUpSql() (*asset, error return nil, err } - info := bindataFileInfo{name: "1603888149_create_chat_identity_last_published_table.up.sql", size: 407, mode: os.FileMode(0644), modTime: time.Unix(1617280156, 0)} + info := bindataFileInfo{name: "1603888149_create_chat_identity_last_published_table.up.sql", size: 407, mode: os.FileMode(0644), modTime: time.Unix(1621849873, 0)} a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x7f, 0x9, 0xf, 0xfb, 0xdb, 0x3c, 0x86, 0x70, 0x82, 0xda, 0x10, 0x25, 0xe2, 0x4e, 0x40, 0x45, 0xab, 0x8b, 0x1c, 0x91, 0x7c, 0xf1, 0x70, 0x2e, 0x81, 0xf3, 0x71, 0x45, 0xda, 0xe2, 0xa4, 0x57}} return a, nil } @@ -499,7 +500,7 @@ func _1605075346_add_communitiesUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1605075346_add_communities.up.sql", size: 6971, mode: os.FileMode(0644), modTime: time.Unix(1617280156, 0)} + info := bindataFileInfo{name: "1605075346_add_communities.up.sql", size: 6971, mode: os.FileMode(0644), modTime: time.Unix(1621849873, 0)} a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x1f, 0x64, 0xea, 0xb4, 0xae, 0x9e, 0xdb, 0x9, 0x58, 0xb6, 0x5c, 0x7a, 0x50, 0xc5, 0xfe, 0x93, 0x5d, 0x36, 0x85, 0x5d, 0x6a, 0xba, 0xc9, 0x7e, 0x84, 0xd7, 0xbf, 0x2a, 0x53, 0xf3, 0x97, 0xf1}} return a, nil } @@ -519,7 +520,7 @@ func _1610117927_add_message_cacheUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1610117927_add_message_cache.up.sql", size: 142, mode: os.FileMode(0644), modTime: time.Unix(1617280156, 0)} + info := bindataFileInfo{name: "1610117927_add_message_cache.up.sql", size: 142, mode: os.FileMode(0644), modTime: time.Unix(1621849873, 0)} a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x34, 0xf1, 0xf0, 0x82, 0x79, 0x28, 0x19, 0xc2, 0x39, 0x6a, 0xa5, 0x96, 0x59, 0x23, 0xa0, 0xed, 0x60, 0x58, 0x86, 0x9, 0xb9, 0xad, 0xfb, 0xa, 0xe3, 0x47, 0x6e, 0xa1, 0x18, 0xe8, 0x39, 0x2c}} return a, nil } @@ -539,7 +540,7 @@ func _1610959908_add_dont_wrap_to_raw_messagesUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1610959908_add_dont_wrap_to_raw_messages.up.sql", size: 83, mode: os.FileMode(0644), modTime: time.Unix(1617280156, 0)} + info := bindataFileInfo{name: "1610959908_add_dont_wrap_to_raw_messages.up.sql", size: 83, mode: os.FileMode(0644), modTime: time.Unix(1621849873, 0)} a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x71, 0x2, 0x9a, 0xca, 0xd4, 0x38, 0x44, 0x30, 0x2b, 0xa8, 0x27, 0x32, 0x63, 0x53, 0x22, 0x60, 0x59, 0x84, 0x23, 0x96, 0x77, 0xf0, 0x56, 0xd7, 0x94, 0xe0, 0x95, 0x28, 0x6, 0x1d, 0x4e, 0xb1}} return a, nil } @@ -559,7 +560,7 @@ func _1610960912_add_send_on_personal_topicUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1610960912_add_send_on_personal_topic.up.sql", size: 82, mode: os.FileMode(0644), modTime: time.Unix(1617280156, 0)} + info := bindataFileInfo{name: "1610960912_add_send_on_personal_topic.up.sql", size: 82, mode: os.FileMode(0644), modTime: time.Unix(1621849873, 0)} a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x77, 0xac, 0x2f, 0xc4, 0xd, 0xa7, 0x1b, 0x37, 0x30, 0xc2, 0x68, 0xee, 0xde, 0x54, 0x5e, 0xbf, 0x3f, 0xa0, 0xd6, 0xc6, 0x9f, 0xd4, 0x34, 0x12, 0x76, 0x1e, 0x66, 0x4a, 0xfc, 0xf, 0xee, 0xc9}} return a, nil } @@ -579,7 +580,7 @@ func _1612870480_add_datasync_idUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1612870480_add_datasync_id.up.sql", size: 111, mode: os.FileMode(0644), modTime: time.Unix(1617280156, 0)} + info := bindataFileInfo{name: "1612870480_add_datasync_id.up.sql", size: 111, mode: os.FileMode(0644), modTime: time.Unix(1621849873, 0)} a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x34, 0x9a, 0xbc, 0xfa, 0xaa, 0x8c, 0x9c, 0x37, 0x67, 0x15, 0x9c, 0x7e, 0x78, 0x75, 0x66, 0x82, 0x18, 0x72, 0x10, 0xbc, 0xd4, 0xab, 0x44, 0xfe, 0x57, 0x85, 0x6d, 0x19, 0xf5, 0x96, 0x8a, 0xbe}} return a, nil } @@ -599,7 +600,7 @@ func _1614152139_add_communities_request_to_joinUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1614152139_add_communities_request_to_join.up.sql", size: 831, mode: os.FileMode(0644), modTime: time.Unix(1617280156, 0)} + info := bindataFileInfo{name: "1614152139_add_communities_request_to_join.up.sql", size: 831, mode: os.FileMode(0644), modTime: time.Unix(1621849873, 0)} a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x11, 0x3, 0x26, 0xf9, 0x29, 0x50, 0x4f, 0xcd, 0x46, 0xe5, 0xb1, 0x6b, 0xb9, 0x2, 0x40, 0xb1, 0xdf, 0x4a, 0x4c, 0x7a, 0xda, 0x3, 0x35, 0xcd, 0x2d, 0xcc, 0x80, 0x7d, 0x57, 0x5f, 0x3, 0x5c}} return a, nil } @@ -619,7 +620,7 @@ func _1615374373_add_confirmationsUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1615374373_add_confirmations.up.sql", size: 227, mode: os.FileMode(0644), modTime: time.Unix(1617280156, 0)} + info := bindataFileInfo{name: "1615374373_add_confirmations.up.sql", size: 227, mode: os.FileMode(0644), modTime: time.Unix(1621849873, 0)} a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xdd, 0xa6, 0x65, 0xc5, 0x1d, 0xb2, 0x77, 0x36, 0xe3, 0x79, 0xda, 0xe8, 0x7a, 0xa4, 0xdf, 0x45, 0xae, 0xd8, 0xb4, 0xba, 0x90, 0xfd, 0x74, 0x71, 0x14, 0x75, 0x73, 0x72, 0xb9, 0x9e, 0x1, 0x81}} return a, nil } @@ -639,7 +640,7 @@ func _1617694931_add_notification_centerUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1617694931_add_notification_center.up.sql", size: 572, mode: os.FileMode(0644), modTime: time.Unix(1618913882, 0)} + info := bindataFileInfo{name: "1617694931_add_notification_center.up.sql", size: 572, mode: os.FileMode(0644), modTime: time.Unix(1621849873, 0)} a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x10, 0x45, 0xc6, 0xc9, 0x73, 0xbb, 0x1f, 0xda, 0xa3, 0x4d, 0x19, 0x98, 0x85, 0x2d, 0xca, 0xda, 0xcc, 0x3b, 0x32, 0xff, 0xc7, 0x7b, 0xe3, 0x9f, 0x9b, 0x2a, 0x93, 0xf5, 0xdf, 0x65, 0x38, 0x91}} return a, nil } @@ -659,7 +660,7 @@ func _1618923660_create_pin_messagesUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1618923660_create_pin_messages.up.sql", size: 265, mode: os.FileMode(0644), modTime: time.Unix(1621583900, 0)} + info := bindataFileInfo{name: "1618923660_create_pin_messages.up.sql", size: 265, mode: os.FileMode(0644), modTime: time.Unix(1621849873, 0)} a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x61, 0x44, 0x3a, 0xbe, 0x30, 0xd2, 0x7e, 0xc0, 0xe2, 0x8e, 0x65, 0x53, 0x54, 0xbb, 0x7a, 0x1c, 0xb3, 0x5d, 0xd2, 0xa6, 0xa9, 0x28, 0xb7, 0xa4, 0x5f, 0x8b, 0x9, 0x5f, 0x17, 0xc1, 0x85, 0x21}} return a, nil } @@ -679,7 +680,7 @@ func _1619094007_add_joined_chat_fieldUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1619094007_add_joined_chat_field.up.sql", size: 101, mode: os.FileMode(0644), modTime: time.Unix(1621583900, 0)} + info := bindataFileInfo{name: "1619094007_add_joined_chat_field.up.sql", size: 101, mode: os.FileMode(0644), modTime: time.Unix(1621849873, 0)} a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xfa, 0x30, 0x81, 0x3a, 0x2f, 0x9f, 0xb3, 0x0, 0x55, 0x8e, 0x1d, 0xa8, 0xb0, 0x68, 0xf0, 0x40, 0x1a, 0x6c, 0xaa, 0xfc, 0x33, 0xd1, 0xd1, 0x55, 0x3f, 0xf2, 0xbd, 0x54, 0xa1, 0x2b, 0x40, 0x95}} return a, nil } @@ -699,7 +700,7 @@ func _1619099821_add_last_synced_fieldUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1619099821_add_last_synced_field.up.sql", size: 226, mode: os.FileMode(0644), modTime: time.Unix(1621583900, 0)} + info := bindataFileInfo{name: "1619099821_add_last_synced_field.up.sql", size: 226, mode: os.FileMode(0644), modTime: time.Unix(1621849873, 0)} a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xf, 0x52, 0x22, 0xe, 0x2f, 0xd7, 0x93, 0x5f, 0x42, 0xc2, 0x93, 0x4, 0x35, 0x6f, 0xc9, 0x19, 0xed, 0x6b, 0x52, 0x6f, 0xae, 0x99, 0xe2, 0x68, 0x3d, 0x4f, 0x40, 0xe, 0xe1, 0xa, 0x47, 0x21}} return a, nil } @@ -719,7 +720,7 @@ func _1621933219_add_mentionedUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1621933219_add_mentioned.up.sql", size: 70, mode: os.FileMode(0644), modTime: time.Unix(1622099951, 0)} + info := bindataFileInfo{name: "1621933219_add_mentioned.up.sql", size: 70, mode: os.FileMode(0644), modTime: time.Unix(1622025511, 0)} a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x36, 0x76, 0x8a, 0xc9, 0x7, 0x8f, 0xa5, 0xcb, 0x12, 0x21, 0x4e, 0xfe, 0x96, 0x77, 0xcf, 0x7f, 0x76, 0x75, 0x36, 0x2c, 0xf8, 0x1d, 0x13, 0xcb, 0xcd, 0x6e, 0x70, 0xbf, 0xf5, 0x93, 0x67, 0xd1}} return a, nil } @@ -739,11 +740,31 @@ func _1622010048_add_unviewed_mentions_countUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1622010048_add_unviewed_mentions_count.up.sql", size: 114, mode: os.FileMode(0644), modTime: time.Unix(1622199953, 0)} + info := bindataFileInfo{name: "1622010048_add_unviewed_mentions_count.up.sql", size: 114, mode: os.FileMode(0644), modTime: time.Unix(1622464564, 0)} a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x7c, 0x16, 0x85, 0xa6, 0x5b, 0xe1, 0x66, 0xb9, 0x84, 0xbe, 0x7f, 0xa, 0x77, 0x23, 0xb9, 0xef, 0x8e, 0x2, 0x8, 0xfc, 0x61, 0xb2, 0x43, 0xa9, 0x63, 0xae, 0xb4, 0xdf, 0x30, 0xb1, 0x61, 0x4b}} return a, nil } +var __1622023791_add_chat_descriptionUpSql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x72\xf4\x09\x71\x0d\x52\x08\x71\x74\xf2\x71\x55\x48\xce\x48\x2c\x29\x56\x70\x74\x71\x51\x70\xf6\xf7\x09\xf5\xf5\x53\x48\x49\x2d\x4e\x2e\xca\x2c\x28\xc9\xcc\xcf\x53\x08\x71\x8d\x08\x51\x70\x71\x75\x73\x0c\xf5\x09\x51\x50\x52\xb2\xe6\x0a\x0d\x70\x71\x0c\x81\x69\x0a\x76\x0d\x41\x51\x6d\x0b\x56\x02\x08\x00\x00\xff\xff\x12\x5c\x00\x32\x5d\x00\x00\x00") + +func _1622023791_add_chat_descriptionUpSqlBytes() ([]byte, error) { + return bindataRead( + __1622023791_add_chat_descriptionUpSql, + "1622023791_add_chat_description.up.sql", + ) +} + +func _1622023791_add_chat_descriptionUpSql() (*asset, error) { + bytes, err := _1622023791_add_chat_descriptionUpSqlBytes() + if err != nil { + return nil, err + } + + info := bindataFileInfo{name: "1622023791_add_chat_description.up.sql", size: 93, mode: os.FileMode(0644), modTime: time.Unix(1622547948, 0)} + a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x36, 0x2e, 0x89, 0x31, 0xec, 0xef, 0xeb, 0x43, 0xf5, 0x96, 0x6d, 0xce, 0x91, 0x8a, 0x37, 0x2a, 0x11, 0x7a, 0x3f, 0xd9, 0x10, 0xbb, 0xa1, 0xbc, 0x7, 0xe0, 0x3b, 0xa5, 0xf4, 0xa6, 0xf4, 0xa1}} + return a, nil +} + var __1622061278_add_message_activity_center_notification_fieldUpSql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x04\xc0\xb1\x0a\xc3\x20\x10\x06\xe0\xbd\x4f\xf1\xbf\x47\xa7\xb3\xda\xe9\xaa\x50\x74\x16\x91\x4b\xb8\x21\x0a\xf1\x08\xe4\xed\xf3\x11\xe7\xf0\x47\x26\xc7\x01\xad\x9b\x5e\x6a\x77\xed\x32\x4c\xce\x3a\xa6\xe9\xa6\xbd\x99\xce\xb1\x40\xde\xe3\x93\xb8\xfc\x22\x0e\x59\xab\xed\x02\xc7\xc9\xc1\x87\x2f\x15\xce\x88\x85\xf9\xfd\x7a\x02\x00\x00\xff\xff\xa2\xbd\x4d\x28\x50\x00\x00\x00") func _1622061278_add_message_activity_center_notification_fieldUpSqlBytes() ([]byte, error) { @@ -759,7 +780,7 @@ func _1622061278_add_message_activity_center_notification_fieldUpSql() (*asset, return nil, err } - info := bindataFileInfo{name: "1622061278_add_message_activity_center_notification_field.up.sql", size: 80, mode: os.FileMode(0644), modTime: time.Unix(1622442755, 0)} + info := bindataFileInfo{name: "1622061278_add_message_activity_center_notification_field.up.sql", size: 80, mode: os.FileMode(0644), modTime: time.Unix(1622464564, 0)} a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x8, 0xc, 0xa6, 0x1f, 0xa5, 0xc6, 0x7c, 0x6f, 0xab, 0x2c, 0x2d, 0xb5, 0xa4, 0xdd, 0xc1, 0xd6, 0x44, 0x83, 0xf9, 0xb1, 0xa5, 0xce, 0x34, 0x3d, 0x2, 0xa9, 0x35, 0xcf, 0xc6, 0xb2, 0x43, 0x37}} return a, nil } @@ -779,7 +800,7 @@ func _1622464518_set_synced_to_fromUpSql() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "1622464518_set_synced_to_from.up.sql", size: 105, mode: os.FileMode(0644), modTime: time.Unix(1622464910, 0)} + info := bindataFileInfo{name: "1622464518_set_synced_to_from.up.sql", size: 105, mode: os.FileMode(0644), modTime: time.Unix(1622547948, 0)} a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x33, 0x3e, 0x2b, 0xa, 0x1e, 0xc7, 0x6d, 0x6f, 0xd1, 0x1d, 0xe8, 0x4b, 0xdd, 0x92, 0x76, 0xea, 0xf2, 0x3e, 0x15, 0x85, 0xc4, 0xc3, 0x31, 0xf1, 0xc0, 0xa2, 0xd7, 0x47, 0xde, 0x4e, 0xfd, 0xc6}} return a, nil } @@ -799,7 +820,7 @@ func readmeMd() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "README.md", size: 554, mode: os.FileMode(0644), modTime: time.Unix(1617280156, 0)} + info := bindataFileInfo{name: "README.md", size: 554, mode: os.FileMode(0644), modTime: time.Unix(1621849873, 0)} a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x1c, 0x6e, 0xfb, 0xcc, 0x81, 0x94, 0x4d, 0x8c, 0xa0, 0x3b, 0x5, 0xb0, 0x18, 0xd6, 0xbb, 0xb3, 0x79, 0xc8, 0x8f, 0xff, 0xc1, 0x10, 0xf9, 0xf, 0x20, 0x1b, 0x4a, 0x74, 0x96, 0x42, 0xd7, 0xa8}} return a, nil } @@ -819,7 +840,7 @@ func docGo() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "doc.go", size: 850, mode: os.FileMode(0644), modTime: time.Unix(1611588719, 0)} + info := bindataFileInfo{name: "doc.go", size: 850, mode: os.FileMode(0644), modTime: time.Unix(1621849873, 0)} a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xa0, 0xcc, 0x41, 0xe1, 0x61, 0x12, 0x97, 0xe, 0x36, 0x8c, 0xa7, 0x9e, 0xe0, 0x6e, 0x59, 0x9e, 0xee, 0xd5, 0x4a, 0xcf, 0x1e, 0x60, 0xd6, 0xc3, 0x3a, 0xc9, 0x6c, 0xf2, 0x86, 0x5a, 0xb4, 0x1e}} return a, nil } @@ -915,79 +936,48 @@ func AssetNames() []string { // _bindata is a table, holding each asset generator, mapped to its name. var _bindata = map[string]func() (*asset, error){ - "000001_init.down.db.sql": _000001_initDownDbSql, - - "000001_init.up.db.sql": _000001_initUpDbSql, - - "000002_add_last_ens_clock_value.up.sql": _000002_add_last_ens_clock_valueUpSql, - - "1586358095_add_replace.up.sql": _1586358095_add_replaceUpSql, - - "1588665364_add_image_data.up.sql": _1588665364_add_image_dataUpSql, - - "1589365189_add_pow_target.up.sql": _1589365189_add_pow_targetUpSql, - - "1591277220_add_index_messages.up.sql": _1591277220_add_index_messagesUpSql, - - "1593087212_add_mute_chat_and_raw_message_fields.up.sql": _1593087212_add_mute_chat_and_raw_message_fieldsUpSql, - - "1595862781_add_audio_data.up.sql": _1595862781_add_audio_dataUpSql, - - "1595865249_create_emoji_reactions_table.up.sql": _1595865249_create_emoji_reactions_tableUpSql, - - "1596805115_create_group_chat_invitations_table.up.sql": _1596805115_create_group_chat_invitations_tableUpSql, - - "1597322655_add_invitation_admin_chat_field.up.sql": _1597322655_add_invitation_admin_chat_fieldUpSql, - - "1597757544_add_nickname.up.sql": _1597757544_add_nicknameUpSql, - - "1598955122_add_mentions.up.sql": _1598955122_add_mentionsUpSql, - - "1599641390_add_emoji_reactions_index.up.sql": _1599641390_add_emoji_reactions_indexUpSql, - - "1599720851_add_seen_index_remove_long_messages.up.sql": _1599720851_add_seen_index_remove_long_messagesUpSql, - - "1603198582_add_profile_chat_field.up.sql": _1603198582_add_profile_chat_fieldUpSql, - - "1603816533_add_links.up.sql": _1603816533_add_linksUpSql, - - "1603888149_create_chat_identity_last_published_table.up.sql": _1603888149_create_chat_identity_last_published_tableUpSql, - - "1605075346_add_communities.up.sql": _1605075346_add_communitiesUpSql, - - "1610117927_add_message_cache.up.sql": _1610117927_add_message_cacheUpSql, - - "1610959908_add_dont_wrap_to_raw_messages.up.sql": _1610959908_add_dont_wrap_to_raw_messagesUpSql, - - "1610960912_add_send_on_personal_topic.up.sql": _1610960912_add_send_on_personal_topicUpSql, - - "1612870480_add_datasync_id.up.sql": _1612870480_add_datasync_idUpSql, - - "1614152139_add_communities_request_to_join.up.sql": _1614152139_add_communities_request_to_joinUpSql, - - "1615374373_add_confirmations.up.sql": _1615374373_add_confirmationsUpSql, - - "1617694931_add_notification_center.up.sql": _1617694931_add_notification_centerUpSql, - - "1618923660_create_pin_messages.up.sql": _1618923660_create_pin_messagesUpSql, - - "1619094007_add_joined_chat_field.up.sql": _1619094007_add_joined_chat_fieldUpSql, - - "1619099821_add_last_synced_field.up.sql": _1619099821_add_last_synced_fieldUpSql, - - "1621933219_add_mentioned.up.sql": _1621933219_add_mentionedUpSql, - - "1622010048_add_unviewed_mentions_count.up.sql": _1622010048_add_unviewed_mentions_countUpSql, - + "000001_init.down.db.sql": _000001_initDownDbSql, + "000001_init.up.db.sql": _000001_initUpDbSql, + "000002_add_last_ens_clock_value.up.sql": _000002_add_last_ens_clock_valueUpSql, + "1586358095_add_replace.up.sql": _1586358095_add_replaceUpSql, + "1588665364_add_image_data.up.sql": _1588665364_add_image_dataUpSql, + "1589365189_add_pow_target.up.sql": _1589365189_add_pow_targetUpSql, + "1591277220_add_index_messages.up.sql": _1591277220_add_index_messagesUpSql, + "1593087212_add_mute_chat_and_raw_message_fields.up.sql": _1593087212_add_mute_chat_and_raw_message_fieldsUpSql, + "1595862781_add_audio_data.up.sql": _1595862781_add_audio_dataUpSql, + "1595865249_create_emoji_reactions_table.up.sql": _1595865249_create_emoji_reactions_tableUpSql, + "1596805115_create_group_chat_invitations_table.up.sql": _1596805115_create_group_chat_invitations_tableUpSql, + "1597322655_add_invitation_admin_chat_field.up.sql": _1597322655_add_invitation_admin_chat_fieldUpSql, + "1597757544_add_nickname.up.sql": _1597757544_add_nicknameUpSql, + "1598955122_add_mentions.up.sql": _1598955122_add_mentionsUpSql, + "1599641390_add_emoji_reactions_index.up.sql": _1599641390_add_emoji_reactions_indexUpSql, + "1599720851_add_seen_index_remove_long_messages.up.sql": _1599720851_add_seen_index_remove_long_messagesUpSql, + "1603198582_add_profile_chat_field.up.sql": _1603198582_add_profile_chat_fieldUpSql, + "1603816533_add_links.up.sql": _1603816533_add_linksUpSql, + "1603888149_create_chat_identity_last_published_table.up.sql": _1603888149_create_chat_identity_last_published_tableUpSql, + "1605075346_add_communities.up.sql": _1605075346_add_communitiesUpSql, + "1610117927_add_message_cache.up.sql": _1610117927_add_message_cacheUpSql, + "1610959908_add_dont_wrap_to_raw_messages.up.sql": _1610959908_add_dont_wrap_to_raw_messagesUpSql, + "1610960912_add_send_on_personal_topic.up.sql": _1610960912_add_send_on_personal_topicUpSql, + "1612870480_add_datasync_id.up.sql": _1612870480_add_datasync_idUpSql, + "1614152139_add_communities_request_to_join.up.sql": _1614152139_add_communities_request_to_joinUpSql, + "1615374373_add_confirmations.up.sql": _1615374373_add_confirmationsUpSql, + "1617694931_add_notification_center.up.sql": _1617694931_add_notification_centerUpSql, + "1618923660_create_pin_messages.up.sql": _1618923660_create_pin_messagesUpSql, + "1619094007_add_joined_chat_field.up.sql": _1619094007_add_joined_chat_fieldUpSql, + "1619099821_add_last_synced_field.up.sql": _1619099821_add_last_synced_fieldUpSql, + "1621933219_add_mentioned.up.sql": _1621933219_add_mentionedUpSql, + "1622010048_add_unviewed_mentions_count.up.sql": _1622010048_add_unviewed_mentions_countUpSql, + "1622023791_add_chat_description.up.sql": _1622023791_add_chat_descriptionUpSql, "1622061278_add_message_activity_center_notification_field.up.sql": _1622061278_add_message_activity_center_notification_fieldUpSql, - - "1622464518_set_synced_to_from.up.sql": _1622464518_set_synced_to_fromUpSql, - - "README.md": readmeMd, - - "doc.go": docGo, + "1622464518_set_synced_to_from.up.sql": _1622464518_set_synced_to_fromUpSql, + "README.md": readmeMd, + "doc.go": docGo, } +// AssetDebug is true if the assets were built with the debug flag enabled. +const AssetDebug = false + // AssetDir returns the file names below a certain // directory embedded in the file by go-bindata. // For example if you run go-bindata on data/... and data contains the @@ -1029,42 +1019,43 @@ type bintree struct { } var _bintree = &bintree{nil, map[string]*bintree{ - "000001_init.down.db.sql": &bintree{_000001_initDownDbSql, map[string]*bintree{}}, - "000001_init.up.db.sql": &bintree{_000001_initUpDbSql, map[string]*bintree{}}, - "000002_add_last_ens_clock_value.up.sql": &bintree{_000002_add_last_ens_clock_valueUpSql, map[string]*bintree{}}, - "1586358095_add_replace.up.sql": &bintree{_1586358095_add_replaceUpSql, map[string]*bintree{}}, - "1588665364_add_image_data.up.sql": &bintree{_1588665364_add_image_dataUpSql, map[string]*bintree{}}, - "1589365189_add_pow_target.up.sql": &bintree{_1589365189_add_pow_targetUpSql, map[string]*bintree{}}, - "1591277220_add_index_messages.up.sql": &bintree{_1591277220_add_index_messagesUpSql, map[string]*bintree{}}, - "1593087212_add_mute_chat_and_raw_message_fields.up.sql": &bintree{_1593087212_add_mute_chat_and_raw_message_fieldsUpSql, map[string]*bintree{}}, - "1595862781_add_audio_data.up.sql": &bintree{_1595862781_add_audio_dataUpSql, map[string]*bintree{}}, - "1595865249_create_emoji_reactions_table.up.sql": &bintree{_1595865249_create_emoji_reactions_tableUpSql, map[string]*bintree{}}, - "1596805115_create_group_chat_invitations_table.up.sql": &bintree{_1596805115_create_group_chat_invitations_tableUpSql, map[string]*bintree{}}, - "1597322655_add_invitation_admin_chat_field.up.sql": &bintree{_1597322655_add_invitation_admin_chat_fieldUpSql, map[string]*bintree{}}, - "1597757544_add_nickname.up.sql": &bintree{_1597757544_add_nicknameUpSql, map[string]*bintree{}}, - "1598955122_add_mentions.up.sql": &bintree{_1598955122_add_mentionsUpSql, map[string]*bintree{}}, - "1599641390_add_emoji_reactions_index.up.sql": &bintree{_1599641390_add_emoji_reactions_indexUpSql, map[string]*bintree{}}, - "1599720851_add_seen_index_remove_long_messages.up.sql": &bintree{_1599720851_add_seen_index_remove_long_messagesUpSql, map[string]*bintree{}}, - "1603198582_add_profile_chat_field.up.sql": &bintree{_1603198582_add_profile_chat_fieldUpSql, map[string]*bintree{}}, - "1603816533_add_links.up.sql": &bintree{_1603816533_add_linksUpSql, map[string]*bintree{}}, - "1603888149_create_chat_identity_last_published_table.up.sql": &bintree{_1603888149_create_chat_identity_last_published_tableUpSql, map[string]*bintree{}}, - "1605075346_add_communities.up.sql": &bintree{_1605075346_add_communitiesUpSql, map[string]*bintree{}}, - "1610117927_add_message_cache.up.sql": &bintree{_1610117927_add_message_cacheUpSql, map[string]*bintree{}}, - "1610959908_add_dont_wrap_to_raw_messages.up.sql": &bintree{_1610959908_add_dont_wrap_to_raw_messagesUpSql, map[string]*bintree{}}, - "1610960912_add_send_on_personal_topic.up.sql": &bintree{_1610960912_add_send_on_personal_topicUpSql, map[string]*bintree{}}, - "1612870480_add_datasync_id.up.sql": &bintree{_1612870480_add_datasync_idUpSql, map[string]*bintree{}}, - "1614152139_add_communities_request_to_join.up.sql": &bintree{_1614152139_add_communities_request_to_joinUpSql, map[string]*bintree{}}, - "1615374373_add_confirmations.up.sql": &bintree{_1615374373_add_confirmationsUpSql, map[string]*bintree{}}, - "1617694931_add_notification_center.up.sql": &bintree{_1617694931_add_notification_centerUpSql, map[string]*bintree{}}, - "1618923660_create_pin_messages.up.sql": &bintree{_1618923660_create_pin_messagesUpSql, map[string]*bintree{}}, - "1619094007_add_joined_chat_field.up.sql": &bintree{_1619094007_add_joined_chat_fieldUpSql, map[string]*bintree{}}, - "1619099821_add_last_synced_field.up.sql": &bintree{_1619099821_add_last_synced_fieldUpSql, map[string]*bintree{}}, - "1621933219_add_mentioned.up.sql": &bintree{_1621933219_add_mentionedUpSql, map[string]*bintree{}}, - "1622010048_add_unviewed_mentions_count.up.sql": &bintree{_1622010048_add_unviewed_mentions_countUpSql, map[string]*bintree{}}, - "1622061278_add_message_activity_center_notification_field.up.sql": &bintree{_1622061278_add_message_activity_center_notification_fieldUpSql, map[string]*bintree{}}, - "1622464518_set_synced_to_from.up.sql": &bintree{_1622464518_set_synced_to_fromUpSql, map[string]*bintree{}}, - "README.md": &bintree{readmeMd, map[string]*bintree{}}, - "doc.go": &bintree{docGo, map[string]*bintree{}}, + "000001_init.down.db.sql": {_000001_initDownDbSql, map[string]*bintree{}}, + "000001_init.up.db.sql": {_000001_initUpDbSql, map[string]*bintree{}}, + "000002_add_last_ens_clock_value.up.sql": {_000002_add_last_ens_clock_valueUpSql, map[string]*bintree{}}, + "1586358095_add_replace.up.sql": {_1586358095_add_replaceUpSql, map[string]*bintree{}}, + "1588665364_add_image_data.up.sql": {_1588665364_add_image_dataUpSql, map[string]*bintree{}}, + "1589365189_add_pow_target.up.sql": {_1589365189_add_pow_targetUpSql, map[string]*bintree{}}, + "1591277220_add_index_messages.up.sql": {_1591277220_add_index_messagesUpSql, map[string]*bintree{}}, + "1593087212_add_mute_chat_and_raw_message_fields.up.sql": {_1593087212_add_mute_chat_and_raw_message_fieldsUpSql, map[string]*bintree{}}, + "1595862781_add_audio_data.up.sql": {_1595862781_add_audio_dataUpSql, map[string]*bintree{}}, + "1595865249_create_emoji_reactions_table.up.sql": {_1595865249_create_emoji_reactions_tableUpSql, map[string]*bintree{}}, + "1596805115_create_group_chat_invitations_table.up.sql": {_1596805115_create_group_chat_invitations_tableUpSql, map[string]*bintree{}}, + "1597322655_add_invitation_admin_chat_field.up.sql": {_1597322655_add_invitation_admin_chat_fieldUpSql, map[string]*bintree{}}, + "1597757544_add_nickname.up.sql": {_1597757544_add_nicknameUpSql, map[string]*bintree{}}, + "1598955122_add_mentions.up.sql": {_1598955122_add_mentionsUpSql, map[string]*bintree{}}, + "1599641390_add_emoji_reactions_index.up.sql": {_1599641390_add_emoji_reactions_indexUpSql, map[string]*bintree{}}, + "1599720851_add_seen_index_remove_long_messages.up.sql": {_1599720851_add_seen_index_remove_long_messagesUpSql, map[string]*bintree{}}, + "1603198582_add_profile_chat_field.up.sql": {_1603198582_add_profile_chat_fieldUpSql, map[string]*bintree{}}, + "1603816533_add_links.up.sql": {_1603816533_add_linksUpSql, map[string]*bintree{}}, + "1603888149_create_chat_identity_last_published_table.up.sql": {_1603888149_create_chat_identity_last_published_tableUpSql, map[string]*bintree{}}, + "1605075346_add_communities.up.sql": {_1605075346_add_communitiesUpSql, map[string]*bintree{}}, + "1610117927_add_message_cache.up.sql": {_1610117927_add_message_cacheUpSql, map[string]*bintree{}}, + "1610959908_add_dont_wrap_to_raw_messages.up.sql": {_1610959908_add_dont_wrap_to_raw_messagesUpSql, map[string]*bintree{}}, + "1610960912_add_send_on_personal_topic.up.sql": {_1610960912_add_send_on_personal_topicUpSql, map[string]*bintree{}}, + "1612870480_add_datasync_id.up.sql": {_1612870480_add_datasync_idUpSql, map[string]*bintree{}}, + "1614152139_add_communities_request_to_join.up.sql": {_1614152139_add_communities_request_to_joinUpSql, map[string]*bintree{}}, + "1615374373_add_confirmations.up.sql": {_1615374373_add_confirmationsUpSql, map[string]*bintree{}}, + "1617694931_add_notification_center.up.sql": {_1617694931_add_notification_centerUpSql, map[string]*bintree{}}, + "1618923660_create_pin_messages.up.sql": {_1618923660_create_pin_messagesUpSql, map[string]*bintree{}}, + "1619094007_add_joined_chat_field.up.sql": {_1619094007_add_joined_chat_fieldUpSql, map[string]*bintree{}}, + "1619099821_add_last_synced_field.up.sql": {_1619099821_add_last_synced_fieldUpSql, map[string]*bintree{}}, + "1621933219_add_mentioned.up.sql": {_1621933219_add_mentionedUpSql, map[string]*bintree{}}, + "1622010048_add_unviewed_mentions_count.up.sql": {_1622010048_add_unviewed_mentions_countUpSql, map[string]*bintree{}}, + "1622023791_add_chat_description.up.sql": {_1622023791_add_chat_descriptionUpSql, map[string]*bintree{}}, + "1622061278_add_message_activity_center_notification_field.up.sql": {_1622061278_add_message_activity_center_notification_fieldUpSql, map[string]*bintree{}}, + "1622464518_set_synced_to_from.up.sql": {_1622464518_set_synced_to_fromUpSql, map[string]*bintree{}}, + "README.md": {readmeMd, map[string]*bintree{}}, + "doc.go": {docGo, map[string]*bintree{}}, }} // RestoreAsset restores an asset under the given directory. diff --git a/protocol/migrations/sqlite/1622023791_add_chat_description.up.sql b/protocol/migrations/sqlite/1622023791_add_chat_description.up.sql new file mode 100644 index 000000000..bff257611 --- /dev/null +++ b/protocol/migrations/sqlite/1622023791_add_chat_description.up.sql @@ -0,0 +1,2 @@ +ALTER TABLE chats ADD COLUMN description TEXT DEFAULT ""; +UPDATE chats SET description = ""; diff --git a/protocol/persistence.go b/protocol/persistence.go index 724c0db7f..290dc29a3 100644 --- a/protocol/persistence.go +++ b/protocol/persistence.go @@ -130,8 +130,8 @@ func (db sqlitePersistence) saveChat(tx *sql.Tx, chat Chat) error { } // Insert record - stmt, err := tx.Prepare(`INSERT INTO chats(id, name, color, active, type, timestamp, deleted_at_clock_value, unviewed_message_count, unviewed_mentions_count, last_clock_value, last_message, members, membership_updates, muted, invitation_admin, profile, community_id, joined, synced_from, synced_to) - VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,?, ?,?,?,?,?,?,?)`) + stmt, err := tx.Prepare(`INSERT INTO chats(id, name, color, active, type, timestamp, deleted_at_clock_value, unviewed_message_count, unviewed_mentions_count, last_clock_value, last_message, members, membership_updates, muted, invitation_admin, profile, community_id, joined, synced_from, synced_to, description) + VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,?, ?,?,?,?,?,?,?,?)`) if err != nil { return err } @@ -158,6 +158,7 @@ func (db sqlitePersistence) saveChat(tx *sql.Tx, chat Chat) error { chat.Joined, chat.SyncedFrom, chat.SyncedTo, + chat.Description, ) if err != nil { @@ -248,6 +249,7 @@ func (db sqlitePersistence) chats(tx *sql.Tx) (chats []*Chat, err error) { chats.joined, chats.synced_from, chats.synced_to, + chats.description, contacts.identicon, contacts.alias FROM chats LEFT JOIN contacts ON chats.id = contacts.id @@ -292,6 +294,7 @@ func (db sqlitePersistence) chats(tx *sql.Tx) (chats []*Chat, err error) { &chat.Joined, &syncedFrom, &syncedTo, + &chat.Description, &identicon, &alias, ) @@ -376,7 +379,8 @@ func (db sqlitePersistence) Chat(chatID string) (*Chat, error) { invitation_admin, profile, community_id, - joined + joined, + description FROM chats WHERE id = ? `, chatID).Scan(&chat.ID, @@ -397,6 +401,7 @@ func (db sqlitePersistence) Chat(chatID string) (*Chat, error) { &profile, &chat.CommunityID, &chat.Joined, + &chat.Description, ) switch err { case sql.ErrNoRows: diff --git a/protocol/persistence_test.go b/protocol/persistence_test.go index 04cac5113..2bbf3dfed 100644 --- a/protocol/persistence_test.go +++ b/protocol/persistence_test.go @@ -1262,3 +1262,31 @@ func TestActivityCenterPersistence(t *testing.T) { // It should not return those require.Len(t, notifications, 0) } + +func TestSaveCommunityChat(t *testing.T) { + db, err := openTestDB() + require.NoError(t, err) + p := NewSQLitePersistence(db) + + identity := &protobuf.ChatIdentity{ + DisplayName: "community-chat-name", + Description: "community-chat-name-description", + } + permissions := &protobuf.CommunityPermissions{ + Access: protobuf.CommunityPermissions_NO_MEMBERSHIP, + } + + communityChat := &protobuf.CommunityChat{ + Identity: identity, + Permissions: permissions, + } + + chat := CreateCommunityChat("test-or-gid", "test-chat-id", communityChat, &testTimeSource{}) + chat.LastMessage = &common.Message{} + err = p.SaveChat(*chat) + require.NoError(t, err) + + retrievedChat, err := p.Chat(chat.ID) + require.NoError(t, err) + require.Equal(t, chat, retrievedChat) +} diff --git a/services/ext/api.go b/services/ext/api.go index 5106937a0..536606d17 100644 --- a/services/ext/api.go +++ b/services/ext/api.go @@ -367,6 +367,11 @@ func (api *PublicAPI) CreateCommunityChat(communityID types.HexBytes, c *protobu return api.service.messenger.CreateCommunityChat(communityID, c) } +// CreateCommunityChat creates a community chat in the given community +func (api *PublicAPI) EditCommunityChat(communityID types.HexBytes, chatID string, c *protobuf.CommunityChat) (*protocol.MessengerResponse, error) { + return api.service.messenger.EditCommunityChat(communityID, chatID, c) +} + // InviteUsersToCommunity invites the users with pks to the community with ID func (api *PublicAPI) InviteUsersToCommunity(request *requests.InviteUsersToCommunity) (*protocol.MessengerResponse, error) { return api.service.messenger.InviteUsersToCommunity(request)