replyGetAux returns topic's auxiliary set of key-value pairs.
(sess *Session, asUid types.Uid, msg *ClientComMessage)
| 3099 | |
| 3100 | // replyGetAux returns topic's auxiliary set of key-value pairs. |
| 3101 | func (t *Topic) replySetAux(sess *Session, asUid types.Uid, msg *ClientComMessage) error { |
| 3102 | now := types.TimeNow() |
| 3103 | |
| 3104 | if t.cat != types.TopicCatP2P && t.cat != types.TopicCatGrp && t.cat != types.TopicCatSlf { |
| 3105 | sess.queueOut(ErrOperationNotAllowedReply(msg, now)) |
| 3106 | return errors.New("invalid topic category to assign aux") |
| 3107 | } |
| 3108 | |
| 3109 | if userData := t.perUser[asUid]; !(userData.modeGiven & userData.modeWant).IsAdmin() { |
| 3110 | sess.queueOut(ErrPermissionDeniedReply(msg, now)) |
| 3111 | return errors.New("aux update by non-admin") |
| 3112 | } |
| 3113 | |
| 3114 | if aux, changed := mergeMaps(copyMap(t.aux), msg.Set.Aux); changed { |
| 3115 | err := store.Topics.Update(t.name, map[string]any{"Aux": aux, "UpdatedAt": now}) |
| 3116 | if err == nil { |
| 3117 | t.aux = aux |
| 3118 | t.presSubsOnline("aux", "", nilPresParams, nilPresFilters, sess.sid) |
| 3119 | } |
| 3120 | sess.queueOut(decodeStoreErrorExplicitTs(err, msg.Set.Id, t.original(asUid), now, msg.Timestamp, nil)) |
| 3121 | return err |
| 3122 | } |
| 3123 | |
| 3124 | sess.queueOut(InfoNotModifiedReply(msg, now)) |
| 3125 | return nil |
| 3126 | } |
| 3127 | |
| 3128 | // replyGetDel is a response to a get[what=del] request: load a list of deleted message ids, send them to |
| 3129 | // a session as {meta} |
no test coverage detected