MCPcopy Create free account
hub / github.com/adcontextprotocol/adcp / notifyRegistryRollback

Function notifyRegistryRollback

server/src/notifications/registry.ts:155–193  ·  view source on GitHub ↗
(rollback: {
  entity_type: 'brand' | 'property';
  domain: string;
  rolled_back_to: number;
  revision_number: number;
  rolled_back_by_name?: string;
  rolled_back_by_email?: string;
})

Source from the content-addressed store, hash-verified

153 * Notify when a record is rolled back.
154 */
155export async function notifyRegistryRollback(rollback: {
156 entity_type: 'brand' | 'property';
157 domain: string;
158 rolled_back_to: number;
159 revision_number: number;
160 rolled_back_by_name?: string;
161 rolled_back_by_email?: string;
162}): Promise<void> {
163 const channelId = getChannelId();
164 if (!channelId || !isSlackConfigured()) return;
165
166 const typeLabel = rollback.entity_type === 'brand' ? 'Brand' : 'Property';
167 const editorDisplay = rollback.rolled_back_by_name || rollback.rolled_back_by_email || 'Admin';
168
169 const message: SlackBlockMessage = {
170 text: `Rollback: ${rollback.domain} restored to rev ${rollback.rolled_back_to}`,
171 blocks: [
172 {
173 type: 'section',
174 text: {
175 type: 'mrkdwn',
176 text: `⏪ *${typeLabel} rolled back:* \`${rollback.domain}\` restored to revision ${rollback.rolled_back_to} (now rev ${rollback.revision_number})`,
177 },
178 },
179 {
180 type: 'section',
181 fields: [
182 { type: 'mrkdwn', text: `*By:*\n${editorDisplay}` },
183 ],
184 },
185 ],
186 };
187
188 try {
189 await sendChannelMessage(channelId, message);
190 } catch (error) {
191 logger.error({ error, domain: rollback.domain }, 'Failed to send registry rollback notification');
192 }
193}
194
195/**
196 * Notify when a user is banned from editing.

Callers 1

setupRoutesMethod · 0.85

Calls 3

getChannelIdFunction · 0.85
isSlackConfiguredFunction · 0.85
sendChannelMessageFunction · 0.85

Tested by

no test coverage detected