( host: SlashCommandHost, )
| 169 | } |
| 170 | |
| 171 | async function resolveUndoAvailability( |
| 172 | host: SlashCommandHost, |
| 173 | ): Promise<UndoAvailability> { |
| 174 | const local = undoAvailabilityFromTranscript( |
| 175 | host.state.transcriptEntries, |
| 176 | host.state.transcriptContainer.children, |
| 177 | ); |
| 178 | const context = await getSessionContext(host.session); |
| 179 | if (context === undefined) return local; |
| 180 | |
| 181 | const activeContext = undoAvailabilityFromContext(context.history); |
| 182 | return { |
| 183 | maxCount: Math.min(local.maxCount, activeContext.maxCount), |
| 184 | stoppedAtCompaction: |
| 185 | local.stoppedAtCompaction || activeContext.stoppedAtCompaction, |
| 186 | }; |
| 187 | } |
| 188 | |
| 189 | async function getSessionContext( |
| 190 | session: SlashCommandHost['session'], |
no test coverage detected