MCPcopy Index your code
hub / github.com/codecombat/codecombat / clearActivityStatusCache

Function clearActivityStatusCache

app/lib/user-utils.js:141–156  ·  view source on GitHub ↗
(userId, { prefix } = {})

Source from the content-addressed store, hash-verified

139}
140
141function clearActivityStatusCache (userId, { prefix } = {}) {
142 const key = getActivityStatusCacheKey(userId)
143 if (!prefix) {
144 localStorage.remove(key, false)
145 localStorage.remove(key)
146 return
147 }
148 const cache = readActivityStatusCache(userId)
149 const filtered = _.pick(cache, _.filter(_.keys(cache), k => !k.startsWith(prefix)))
150 if (_.isEmpty(filtered)) {
151 localStorage.remove(key, false)
152 localStorage.remove(key)
153 } else {
154 localStorage.save(key, filtered, 0)
155 }
156}
157
158async function levelChatCreditsString () {
159 const res = await usersApi.getUserCredits('LEVEL_CHAT_BOT')

Callers

nothing calls this directly

Calls 4

readActivityStatusCacheFunction · 0.85
filterMethod · 0.80
saveMethod · 0.45

Tested by

no test coverage detected