Skip to content

Commit a7f95ab

Browse files
authored
Merge pull request #107 from anyproto/GO-6294-revert-space-type-chat
GO-6294 revert space type chat
2 parents f1435d0 + 5cd05e2 commit a7f95ab

File tree

8 files changed

+39
-75
lines changed

8 files changed

+39
-75
lines changed

accountlimit/accountlimit.go

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ var log = logger.NewNamed(CName)
3232

3333
type configGetter interface {
3434
GetAccountLimit() SpaceLimits
35-
GetChatSpaceLimit() SpaceLimits
3635
}
3736

3837
type SpaceLimits struct {
@@ -63,7 +62,6 @@ type accountLimit struct {
6362
coll *mongo.Collection
6463
spaceStatus spacestatus.SpaceStatus
6564
defaultLimits SpaceLimits
66-
chatLimits SpaceLimits
6765
}
6866

6967
func (al *accountLimit) Init(a *app.App) (err error) {
@@ -72,10 +70,6 @@ func (al *accountLimit) Init(a *app.App) (err error) {
7270
al.coll = a.MustComponent(db.CName).(db.Database).Db().Collection(collName)
7371
al.spaceStatus = a.MustComponent(spacestatus.CName).(spacestatus.SpaceStatus)
7472
al.defaultLimits = a.MustComponent("config").(configGetter).GetAccountLimit()
75-
al.chatLimits = a.MustComponent("config").(configGetter).GetChatSpaceLimit()
76-
if al.chatLimits.SharedSpacesLimit+al.chatLimits.SpaceMembersRead+al.chatLimits.SpaceMembersWrite == 0 {
77-
al.chatLimits = al.defaultLimits
78-
}
7973
return nil
8074
}
8175

@@ -145,8 +139,6 @@ func (al *accountLimit) GetLimitsBySpace(ctx context.Context, spaceId string) (s
145139
SpaceMembersRead: 1,
146140
SpaceMembersWrite: 1,
147141
}, nil
148-
case spacestatus.SpaceTypeChat:
149-
return al.chatLimits, nil
150142
}
151143

152144
limits, err := al.GetLimits(ctx, entry.Identity)

accountlimit/accountlimit_test.go

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -102,22 +102,6 @@ func TestAccountLimit_GetLimitsBySpace(t *testing.T) {
102102
require.NoError(t, err)
103103
assert.Equal(t, SpaceLimits{10, 5, 3}, limits)
104104
})
105-
106-
t.Run("chat", func(t *testing.T) {
107-
fx := newFixture(t)
108-
defer fx.finish(t)
109-
110-
fx.spaceStatus.EXPECT().Status(ctx, spaceId).Return(spacestatus.StatusEntry{
111-
SpaceId: spaceId,
112-
Identity: identity,
113-
Type: spacestatus.SpaceTypeChat,
114-
}, nil)
115-
116-
limits, err := fx.GetLimitsBySpace(ctx, spaceId)
117-
require.NoError(t, err)
118-
assert.Equal(t, SpaceLimits{100, 50, 0}, limits)
119-
})
120-
121105
}
122106

123107
var ctx = context.Background()
@@ -188,10 +172,3 @@ func (c *testConfig) GetAccountLimit() SpaceLimits {
188172
SharedSpacesLimit: 3,
189173
}
190174
}
191-
192-
func (c *testConfig) GetChatSpaceLimit() SpaceLimits {
193-
return SpaceLimits{
194-
SpaceMembersRead: 100,
195-
SpaceMembersWrite: 50,
196-
}
197-
}

config/config.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ type Config struct {
4343
Yamux yamux.Config `yaml:"yamux"`
4444
Quic quic.Config `yaml:"quic"`
4545
AccountLimits accountlimit.SpaceLimits `yaml:"defaultLimits"`
46-
ChatSpaceLimits accountlimit.SpaceLimits `yaml:"chatSpaceLimits"`
4746
}
4847

4948
func (c Config) Init(a *app.App) (err error) {
@@ -97,7 +96,3 @@ func (c Config) GetQuic() quic.Config {
9796
func (c Config) GetAccountLimit() accountlimit.SpaceLimits {
9897
return c.AccountLimits
9998
}
100-
101-
func (c Config) GetChatSpaceLimit() accountlimit.SpaceLimits {
102-
return c.ChatSpaceLimits
103-
}

etc/any-sync-coordinator.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,3 @@ defaultLimits:
6464
spaceMembersRead: 1000
6565
spaceMembersWrite: 100
6666
sharedSpacesLimit: 10
67-
chatSpaceLimits:
68-
spaceMembersRead: 1000
69-
spaceMembersWrite: 100
70-
sharedSpacesLimit: 10

go.mod

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ go 1.24.0
44

55
require (
66
github.com/ahmetb/govvv v0.3.0
7-
github.com/anyproto/any-sync v0.10.0
7+
github.com/anyproto/any-sync v0.10.2
88
github.com/gogo/protobuf v1.3.2
99
github.com/stretchr/testify v1.11.1
1010
go.mongodb.org/mongo-driver v1.17.4
@@ -43,10 +43,10 @@ require (
4343
github.com/google/uuid v1.6.0 // indirect
4444
github.com/hashicorp/yamux v0.1.2 // indirect
4545
github.com/ipfs/go-cid v0.5.0 // indirect
46-
github.com/ipfs/go-log/v2 v2.6.0 // indirect
46+
github.com/ipfs/go-log/v2 v2.8.1 // indirect
4747
github.com/jbenet/go-temp-err-catcher v0.1.0 // indirect
4848
github.com/klauspost/compress v1.18.0 // indirect
49-
github.com/klauspost/cpuid/v2 v2.2.10 // indirect
49+
github.com/klauspost/cpuid/v2 v2.3.0 // indirect
5050
github.com/libp2p/go-buffer-pool v0.1.0 // indirect
5151
github.com/libp2p/go-libp2p v0.43.0 // indirect
5252
github.com/mattn/go-isatty v0.0.20 // indirect
@@ -55,7 +55,7 @@ require (
5555
github.com/mr-tron/base58 v1.2.0 // indirect
5656
github.com/multiformats/go-base32 v0.1.0 // indirect
5757
github.com/multiformats/go-base36 v0.2.0 // indirect
58-
github.com/multiformats/go-multiaddr v0.16.0 // indirect
58+
github.com/multiformats/go-multiaddr v0.16.1 // indirect
5959
github.com/multiformats/go-multibase v0.2.0 // indirect
6060
github.com/multiformats/go-multicodec v0.9.2 // indirect
6161
github.com/multiformats/go-multihash v0.2.3 // indirect
@@ -68,7 +68,7 @@ require (
6868
github.com/prometheus/client_golang v1.23.2 // indirect
6969
github.com/prometheus/client_model v0.6.2 // indirect
7070
github.com/prometheus/common v0.66.1 // indirect
71-
github.com/prometheus/procfs v0.16.1 // indirect
71+
github.com/prometheus/procfs v0.17.0 // indirect
7272
github.com/quic-go/quic-go v0.54.0 // indirect
7373
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
7474
github.com/spaolacci/murmur3 v1.1.0 // indirect
@@ -86,14 +86,14 @@ require (
8686
golang.org/x/crypto v0.42.0 // indirect
8787
golang.org/x/exp v0.0.0-20250819193227-8b4c13bb791b // indirect
8888
golang.org/x/image v0.21.0 // indirect
89-
golang.org/x/mod v0.27.0 // indirect
90-
golang.org/x/net v0.43.0 // indirect
89+
golang.org/x/mod v0.28.0 // indirect
90+
golang.org/x/net v0.44.0 // indirect
9191
golang.org/x/sync v0.17.0 // indirect
9292
golang.org/x/sys v0.36.0 // indirect
9393
golang.org/x/text v0.29.0 // indirect
9494
golang.org/x/time v0.13.0 // indirect
95-
golang.org/x/tools v0.36.0 // indirect
96-
google.golang.org/protobuf v1.36.8 // indirect
95+
golang.org/x/tools v0.37.0 // indirect
96+
google.golang.org/protobuf v1.36.9 // indirect
9797
lukechampine.com/blake3 v1.4.1 // indirect
9898
modernc.org/libc v1.66.8 // indirect
9999
modernc.org/mathutil v1.7.1 // indirect

go.sum

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ github.com/ahmetb/govvv v0.3.0 h1:YGLGwEyiUwHFy5eh/RUhdupbuaCGBYn5T5GWXp+WJB0=
77
github.com/ahmetb/govvv v0.3.0/go.mod h1:4WRFpdWtc/YtKgPFwa1dr5+9hiRY5uKAL08bOlxOR6s=
88
github.com/anyproto/any-store v0.3.5 h1:a/IQx6sATqmZ0Gqa5+nNDeSHYfInjWSsCN17BbPDV0w=
99
github.com/anyproto/any-store v0.3.5/go.mod h1:P9CnoL9Q06eh051DwtcvCiiWCwdXO7AbEILcnD6yrss=
10-
github.com/anyproto/any-sync v0.10.0 h1:aC9KzQWJF2NQ/Zt4BRo5Ay8e0INHkInvetkwx9SmbeY=
11-
github.com/anyproto/any-sync v0.10.0/go.mod h1:Gm/eRMSo5iXU/M9pzcdo6i+TGHdGfx4NUjiMhBJ0cd8=
10+
github.com/anyproto/any-sync v0.10.2 h1:na1g2iAVX5/tef9+qjyRz+skVe6LoSvYmWV3YecareI=
11+
github.com/anyproto/any-sync v0.10.2/go.mod h1:kSAW2IXIeDSUabu9jMKJirgFCyM4a99lM6URR8GCH6A=
1212
github.com/anyproto/go-chash v0.1.0 h1:I9meTPjXFRfXZHRJzjOHC/XF7Q5vzysKkiT/grsogXY=
1313
github.com/anyproto/go-chash v0.1.0/go.mod h1:0UjNQi3PDazP0fINpFYu6VKhuna+W/V+1vpXHAfNgLY=
1414
github.com/anyproto/go-slip10 v1.0.0 h1:uAEtSuudR3jJBOfkOXf3bErxVoxbuKwdoJN55M1i6IA=
@@ -82,8 +82,8 @@ github.com/hashicorp/yamux v0.1.2/go.mod h1:C+zze2n6e/7wshOZep2A70/aQU6QBRWJO/G6
8282
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
8383
github.com/ipfs/go-cid v0.5.0 h1:goEKKhaGm0ul11IHA7I6p1GmKz8kEYniqFopaB5Otwg=
8484
github.com/ipfs/go-cid v0.5.0/go.mod h1:0L7vmeNXpQpUS9vt+yEARkJ8rOg43DF3iPgn4GIN0mk=
85-
github.com/ipfs/go-log/v2 v2.6.0 h1:2Nu1KKQQ2ayonKp4MPo6pXCjqw1ULc9iohRqWV5EYqg=
86-
github.com/ipfs/go-log/v2 v2.6.0/go.mod h1:p+Efr3qaY5YXpx9TX7MoLCSEZX5boSWj9wh86P5HJa8=
85+
github.com/ipfs/go-log/v2 v2.8.1 h1:Y/X36z7ASoLJaYIJAL4xITXgwf7RVeqb1+/25aq/Xk0=
86+
github.com/ipfs/go-log/v2 v2.8.1/go.mod h1:NyhTBcZmh2Y55eWVjOeKf8M7e4pnJYM3yDZNxQBWEEY=
8787
github.com/jbenet/go-temp-err-catcher v0.1.0 h1:zpb3ZH6wIE8Shj2sKS+khgRvf7T7RABoLk/+KKHggpk=
8888
github.com/jbenet/go-temp-err-catcher v0.1.0/go.mod h1:0kJRvmDZXNMIiJirNPEYfhpPwbGVtZVWC34vc5WLsDk=
8989
github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
@@ -93,8 +93,8 @@ github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+o
9393
github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4=
9494
github.com/klauspost/compress v1.18.0 h1:c/Cqfb0r+Yi+JtIEq73FWXVkRonBlf0CRNYc8Zttxdo=
9595
github.com/klauspost/compress v1.18.0/go.mod h1:2Pp+KzxcywXVXMr50+X0Q/Lsb43OQHYWRCY2AiWywWQ=
96-
github.com/klauspost/cpuid/v2 v2.2.10 h1:tBs3QSyvjDyFTq3uoc/9xFpCuOsJQFNPiAhYdw2skhE=
97-
github.com/klauspost/cpuid/v2 v2.2.10/go.mod h1:hqwkgyIinND0mEev00jJYCxPNVRVXFQeu1XKlok6oO0=
96+
github.com/klauspost/cpuid/v2 v2.3.0 h1:S4CRMLnYUhGeDFDqkGriYKdfoFlDnMtqTiI/sFzhA9Y=
97+
github.com/klauspost/cpuid/v2 v2.3.0/go.mod h1:hqwkgyIinND0mEev00jJYCxPNVRVXFQeu1XKlok6oO0=
9898
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
9999
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
100100
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
@@ -121,8 +121,8 @@ github.com/multiformats/go-base32 v0.1.0 h1:pVx9xoSPqEIQG8o+UbAe7DNi51oej1NtK+aG
121121
github.com/multiformats/go-base32 v0.1.0/go.mod h1:Kj3tFY6zNr+ABYMqeUNeGvkIC/UYgtWibDcT0rExnbI=
122122
github.com/multiformats/go-base36 v0.2.0 h1:lFsAbNOGeKtuKozrtBsAkSVhv1p9D0/qedU9rQyccr0=
123123
github.com/multiformats/go-base36 v0.2.0/go.mod h1:qvnKE++v+2MWCfePClUEjE78Z7P2a1UV0xHgWc0hkp4=
124-
github.com/multiformats/go-multiaddr v0.16.0 h1:oGWEVKioVQcdIOBlYM8BH1rZDWOGJSqr9/BKl6zQ4qc=
125-
github.com/multiformats/go-multiaddr v0.16.0/go.mod h1:JSVUmXDjsVFiW7RjIFMP7+Ev+h1DTbiJgVeTV/tcmP0=
124+
github.com/multiformats/go-multiaddr v0.16.1 h1:fgJ0Pitow+wWXzN9do+1b8Pyjmo8m5WhGfzpL82MpCw=
125+
github.com/multiformats/go-multiaddr v0.16.1/go.mod h1:JSVUmXDjsVFiW7RjIFMP7+Ev+h1DTbiJgVeTV/tcmP0=
126126
github.com/multiformats/go-multibase v0.2.0 h1:isdYCVLvksgWlMW9OZRYJEa9pZETFivncJHmHnnd87g=
127127
github.com/multiformats/go-multibase v0.2.0/go.mod h1:bFBZX4lKCA/2lyOFSAoKH5SS6oPyjtnzK/XTFDPkNuk=
128128
github.com/multiformats/go-multicodec v0.9.2 h1:YrlXCuqxjqm3bXl+vBq5LKz5pz4mvAsugdqy78k0pXQ=
@@ -152,8 +152,8 @@ github.com/prometheus/client_model v0.6.2 h1:oBsgwpGs7iVziMvrGhE53c/GrLUsZdHnqNw
152152
github.com/prometheus/client_model v0.6.2/go.mod h1:y3m2F6Gdpfy6Ut/GBsUqTWZqCUvMVzSfMLjcu6wAwpE=
153153
github.com/prometheus/common v0.66.1 h1:h5E0h5/Y8niHc5DlaLlWLArTQI7tMrsfQjHV+d9ZoGs=
154154
github.com/prometheus/common v0.66.1/go.mod h1:gcaUsgf3KfRSwHY4dIMXLPV0K/Wg1oZ8+SbZk/HH/dA=
155-
github.com/prometheus/procfs v0.16.1 h1:hZ15bTNuirocR6u0JZ6BAHHmwS1p8B4P6MRqxtzMyRg=
156-
github.com/prometheus/procfs v0.16.1/go.mod h1:teAbpZRB1iIAJYREa1LsoWUXykVXA1KlTmWl8x/U+Is=
155+
github.com/prometheus/procfs v0.17.0 h1:FuLQ+05u4ZI+SS/w9+BWEM2TXiHKsUQ9TADiRH7DuK0=
156+
github.com/prometheus/procfs v0.17.0/go.mod h1:oPQLaDAMRbA+u8H5Pbfq+dl3VDAvHxMUOVhe0wYB2zw=
157157
github.com/quic-go/quic-go v0.54.0 h1:6s1YB9QotYI6Ospeiguknbp2Znb/jZYjZLRXn9kMQBg=
158158
github.com/quic-go/quic-go v0.54.0/go.mod h1:e68ZEaCdyviluZmy44P6Iey98v/Wfz6HCjQEm+l8zTY=
159159
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94icq4NjY3clb7Lk8O1qJ8BdBEF8z0ibU0rE=
@@ -217,17 +217,17 @@ golang.org/x/image v0.21.0/go.mod h1:vUbsLavqK/W303ZroQQVKQ+Af3Yl6Uz1Ppu5J/cLz78
217217
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
218218
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
219219
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
220-
golang.org/x/mod v0.27.0 h1:kb+q2PyFnEADO2IEF935ehFUXlWiNjJWtRNgBLSfbxQ=
221-
golang.org/x/mod v0.27.0/go.mod h1:rWI627Fq0DEoudcK+MBkNkCe0EetEaDSwJJkCcjpazc=
220+
golang.org/x/mod v0.28.0 h1:gQBtGhjxykdjY9YhZpSlZIsbnaE2+PgjfLWUQTnoZ1U=
221+
golang.org/x/mod v0.28.0/go.mod h1:yfB/L0NOf/kmEbXjzCPOx1iK1fRutOydrCMsqRhEBxI=
222222
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
223223
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
224224
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
225225
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
226226
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
227227
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
228228
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
229-
golang.org/x/net v0.43.0 h1:lat02VYK2j4aLzMzecihNvTlJNQUq316m2Mr9rnM6YE=
230-
golang.org/x/net v0.43.0/go.mod h1:vhO1fvI4dGsIjh73sWfUVjj3N7CA9WkKJNQm2svM6Jg=
229+
golang.org/x/net v0.44.0 h1:evd8IRDyfNBMBTTY5XRF1vaZlD+EmWx6x8PkhR04H/I=
230+
golang.org/x/net v0.44.0/go.mod h1:ECOoLqd5U3Lhyeyo/QDCEVQ4sNgYsqvCZ722XogGieY=
231231
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
232232
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
233233
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
@@ -262,14 +262,14 @@ golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtn
262262
golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
263263
golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
264264
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
265-
golang.org/x/tools v0.36.0 h1:kWS0uv/zsvHEle1LbV5LE8QujrxB3wfQyxHfhOk0Qkg=
266-
golang.org/x/tools v0.36.0/go.mod h1:WBDiHKJK8YgLHlcQPYQzNCkUxUypCaa5ZegCVutKm+s=
265+
golang.org/x/tools v0.37.0 h1:DVSRzp7FwePZW356yEAChSdNcQo6Nsp+fex1SUW09lE=
266+
golang.org/x/tools v0.37.0/go.mod h1:MBN5QPQtLMHVdvsbtarmTNukZDdgwdwlO5qGacAzF0w=
267267
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
268268
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
269269
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
270270
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
271-
google.golang.org/protobuf v1.36.8 h1:xHScyCOEuuwZEc6UtSOvPbAT4zRh0xcNRYekJwfqyMc=
272-
google.golang.org/protobuf v1.36.8/go.mod h1:fuxRtAxBytpl4zzqUh6/eyUujkJdNiuEkXntxiD/uRU=
271+
google.golang.org/protobuf v1.36.9 h1:w2gp2mA27hUeUzj9Ex9FBjsBm40zfaDtEWow293U7Iw=
272+
google.golang.org/protobuf v1.36.9/go.mod h1:fuxRtAxBytpl4zzqUh6/eyUujkJdNiuEkXntxiD/uRU=
273273
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
274274
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
275275
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=

spacestatus/changeverifier.go

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,9 @@ func (c *changeVerifier) Verify(change StatusChange) (err error) {
4848
}
4949

5050
const (
51-
techSpaceType = "anytype.techspace"
52-
chatSpaceType = "anytype.chatspace"
51+
regularSpaceType = "anytype.space"
52+
techSpaceType = "anytype.techspace"
53+
chatSpaceType = "anytype.chatspace"
5354
)
5455

5556
func VerifySpaceHeader(identity crypto.PubKey, headerBytes []byte) (spaceType SpaceType, err error) {
@@ -74,10 +75,13 @@ func VerifySpaceHeader(identity crypto.PubKey, headerBytes []byte) (spaceType Sp
7475
case techSpaceType:
7576
return SpaceTypeTech, nil
7677
case chatSpaceType:
77-
return SpaceTypeChat, nil
78-
}
79-
if header.Timestamp == 0 {
80-
return SpaceTypePersonal, nil
78+
return SpaceTypeRegular, nil
79+
case "", regularSpaceType:
80+
if header.Timestamp == 0 {
81+
return SpaceTypePersonal, nil
82+
}
83+
return SpaceTypeRegular, nil
84+
default:
85+
return 0, fmt.Errorf("unknown space type: %s", header.SpaceType)
8186
}
82-
return SpaceTypeRegular, nil
8387
}

spacestatus/changeverifier_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,6 @@ func TestVerifySpaceHeader(t *testing.T) {
6868
SpaceType: chatSpaceType,
6969
}, false))
7070
require.NoError(t, err)
71-
assert.Equal(t, SpaceTypeChat, spaceType)
71+
assert.Equal(t, SpaceTypeRegular, spaceType)
7272
})
7373
}

0 commit comments

Comments
 (0)