Initialize 'fnd' topic
(t *Topic, sreg *ClientComMessage)
| 186 | |
| 187 | // Initialize 'fnd' topic |
| 188 | func initTopicFnd(t *Topic, sreg *ClientComMessage) error { |
| 189 | t.cat = types.TopicCatFnd |
| 190 | |
| 191 | uid := types.ParseUserId(sreg.AsUser) |
| 192 | if uid.IsZero() { |
| 193 | return types.ErrNotFound |
| 194 | } |
| 195 | |
| 196 | user, err := store.Users.Get(uid) |
| 197 | if err != nil { |
| 198 | return err |
| 199 | } else if user == nil { |
| 200 | if !sreg.sess.isMultiplex() { |
| 201 | sreg.sess.uid = types.ZeroUid |
| 202 | } |
| 203 | return types.ErrNotFound |
| 204 | } |
| 205 | |
| 206 | // Make sure no one can join the topic. |
| 207 | t.accessAuth = getDefaultAccess(t.cat, true, false) |
| 208 | t.accessAnon = getDefaultAccess(t.cat, false, false) |
| 209 | |
| 210 | if err = t.loadSubscribers(); err != nil { |
| 211 | return err |
| 212 | } |
| 213 | |
| 214 | t.created = user.CreatedAt |
| 215 | t.updated = user.UpdatedAt |
| 216 | |
| 217 | // 'fnd' has no owner, t.owner = nil |
| 218 | |
| 219 | // Publishing to fnd is not supported |
| 220 | // t.lastId = 0, t.delId = 0, t.touched = nil |
| 221 | |
| 222 | return nil |
| 223 | } |
| 224 | |
| 225 | // Load or create a P2P topic. |
| 226 | // There is a reace condition when two users try to create a p2p topic at the same time. |
no test coverage detected
searching dependent graphs…