MCPcopy Create free account
hub / github.com/diillson/chatcli / setSensitive

Method setSensitive

cli/workspace/memory/profile.go:221–242  ·  view source on GitHub ↗

setSensitive flips the privacy flag on the named fields (comma-separated; preference keys may be given bare or as "pref: ").

(value string, sensitive bool)

Source from the content-addressed store, hash-verified

219// setSensitive flips the privacy flag on the named fields (comma-separated;
220// preference keys may be given bare or as "pref:<key>").
221func (ps *UserProfileStore) setSensitive(value string, sensitive bool) bool {
222 if ps.profile.FieldMeta == nil {
223 ps.profile.FieldMeta = make(map[string]FieldMeta)
224 }
225 changed := false
226 for _, name := range splitListItems(value) {
227 key := strings.ToLower(strings.TrimSpace(name))
228 if key == "" {
229 continue
230 }
231 if _, isPref := ps.profile.Preferences[key]; isPref && !strings.HasPrefix(key, "pref:") {
232 key = "pref:" + key
233 }
234 m := ps.profile.FieldMeta[key]
235 if m.Sensitive != sensitive {
236 m.Sensitive = sensitive
237 ps.profile.FieldMeta[key] = m
238 changed = true
239 }
240 }
241 return changed
242}
243
244func (ps *UserProfileStore) setScalar(target *string, value string) bool {
245 if *target == value {

Callers 1

applyUpdateMethod · 0.95

Calls 1

splitListItemsFunction · 0.85

Tested by

no test coverage detected