mirror of
https://github.com/bulwarkmail/webmail.git
synced 2026-10-31 00:12:39 +00:00
Merge pull request #685 from paulhenry46/contact-cryptokeys-slot
feat: add contact-cryptokeys plugin UI slot
This commit is contained in:
@@ -13,6 +13,8 @@ import { ContactActivity } from "./contact-activity";
|
||||
import { toast } from "@/stores/toast-store";
|
||||
import { exportContact } from "./contact-export";
|
||||
import { printContact } from "./contact-print";
|
||||
import { usePluginSlotOffers } from "@/hooks/use-plugin-slot-offers";
|
||||
import { PluginSlot } from "@/components/plugins/plugin-slot";
|
||||
|
||||
type MoreItem =
|
||||
| {
|
||||
@@ -119,6 +121,7 @@ export function ContactDetail({ contact, onEdit, onDelete, onAddToGroup, onDupli
|
||||
const t = useTranslations("contacts");
|
||||
|
||||
const cryptoKeys = contact?.cryptoKeys ? Object.values(contact.cryptoKeys) : [];
|
||||
const hasCryptoKeysSlotOffers = usePluginSlotOffers('contact-cryptokeys').length > 0;
|
||||
|
||||
if (!contact) {
|
||||
return (
|
||||
@@ -429,7 +432,12 @@ export function ContactDetail({ contact, onEdit, onDelete, onAddToGroup, onDupli
|
||||
{cryptoKeys.length > 0 && (
|
||||
<Section title={t("detail.crypto_keys")}>
|
||||
<div className="space-y-3">
|
||||
{cryptoKeys.map((key, i) => (
|
||||
|
||||
{hasCryptoKeysSlotOffers && (
|
||||
<PluginSlot name="contact-cryptokeys" extraProps={{ cryptoKeys }} />
|
||||
)}
|
||||
|
||||
{!hasCryptoKeysSlotOffers &&cryptoKeys.map((key, i) => (
|
||||
<div key={i} className="rounded-md border border-border/60 bg-muted/30 p-3 space-y-1">
|
||||
<div className="flex items-start gap-2 text-sm break-all">
|
||||
<KeyRound className="w-4 h-4 text-muted-foreground mt-0.5 flex-shrink-0" />
|
||||
|
||||
@@ -39,6 +39,7 @@ describe('plugin-types constants', () => {
|
||||
expect(ALL_PERMISSIONS).toContain('ui:toolbar');
|
||||
expect(ALL_PERMISSIONS).toContain('ui:email-banner');
|
||||
expect(ALL_PERMISSIONS).toContain('ui:email-footer');
|
||||
expect(ALL_PERMISSIONS).toContain('ui:contact-cryptokeys');
|
||||
expect(ALL_PERMISSIONS).toContain('ui:composer-toolbar');
|
||||
expect(ALL_PERMISSIONS).toContain('ui:sidebar-widget');
|
||||
expect(ALL_PERMISSIONS).toContain('ui:settings-section');
|
||||
|
||||
+3
-2
@@ -287,7 +287,8 @@ export type SlotName =
|
||||
| 'context-menu-email'
|
||||
| 'navigation-rail-bottom'
|
||||
| 'calendar-event-actions'
|
||||
| 'admin-plugin-page';
|
||||
| 'admin-plugin-page'
|
||||
| 'contact-cryptokeys';
|
||||
|
||||
export interface SlotRegistration {
|
||||
pluginId: string;
|
||||
@@ -1038,7 +1039,7 @@ export const ALL_PERMISSIONS = [
|
||||
'auth:emit',
|
||||
'account:read',
|
||||
'http:post', 'http:fetch',
|
||||
'ui:observe', 'ui:toolbar', 'ui:app-top-banner', 'ui:email-banner', 'ui:email-footer',
|
||||
'ui:observe', 'ui:toolbar', 'ui:app-top-banner', 'ui:email-banner', 'ui:email-footer', 'ui:contact-cryptokeys',
|
||||
'ui:email-details',
|
||||
'ui:download-file',
|
||||
// Register native message-list category tabs (Gmail-style inbox tabs).
|
||||
|
||||
Reference in New Issue
Block a user