feat: push notifications on each device (Web Push)
- What reaches the bell also reaches the devices where the person turned «Avisos en este dispositivo» on, with TaskStream closed: the Notifier sends each new notification encrypted (aes128gcm) and signed with VAPID, and forgets subscriptions the push service dropped (404/410). A failure never blocks the event stream. - The API keeps one subscription per device (push_subscriptions) and exposes the VAPID public key in the notification settings; GraphQL subscribePush/unsubscribePush, REST /me/push-subscriptions. Without VAPID_PUBLIC_KEY and VAPID_PRIVATE_KEY push is off. - The web registers /push-sw.js, a service worker that only shows the notification and opens its ticket on a tap (no caching, served without cache by nginx), and a manifest that makes it installable, which iPhones need for push. - The bell's toggles show their text next to them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -236,6 +236,13 @@ export type ProjectSettingsInput = {
|
||||
transitions: Array<StatusTransitionsInput>;
|
||||
};
|
||||
|
||||
/** A browser's Web Push subscription (PushSubscription.toJSON()) */
|
||||
export type PushSubscriptionInput = {
|
||||
auth: string;
|
||||
endpoint: string;
|
||||
p256dh: string;
|
||||
};
|
||||
|
||||
export type RankIssueInput = {
|
||||
/** The ticket that ends up right above (null: the top) */
|
||||
aboveIssueId?: string | null | undefined;
|
||||
@@ -1366,7 +1373,11 @@ export type NotificationSettingsQueryVariables = Exact<{
|
||||
}>;
|
||||
|
||||
export type NotificationSettingsQuery = {
|
||||
notificationSettings: { email: boolean; emailAvailable: boolean };
|
||||
notificationSettings: {
|
||||
email: boolean;
|
||||
emailAvailable: boolean;
|
||||
pushPublicKey: string | null;
|
||||
};
|
||||
};
|
||||
|
||||
export type MarkNotificationsReadMutationVariables = Exact<{
|
||||
@@ -1380,9 +1391,25 @@ export type UpdateNotificationSettingsMutationVariables = Exact<{
|
||||
}>;
|
||||
|
||||
export type UpdateNotificationSettingsMutation = {
|
||||
updateNotificationSettings: { email: boolean; emailAvailable: boolean };
|
||||
updateNotificationSettings: {
|
||||
email: boolean;
|
||||
emailAvailable: boolean;
|
||||
pushPublicKey: string | null;
|
||||
};
|
||||
};
|
||||
|
||||
export type SubscribePushMutationVariables = Exact<{
|
||||
subscription: PushSubscriptionInput;
|
||||
}>;
|
||||
|
||||
export type SubscribePushMutation = { subscribePush: boolean };
|
||||
|
||||
export type UnsubscribePushMutationVariables = Exact<{
|
||||
endpoint: string;
|
||||
}>;
|
||||
|
||||
export type UnsubscribePushMutation = { unsubscribePush: boolean };
|
||||
|
||||
export type NotificationAddedSubscriptionVariables = Exact<{
|
||||
[key: string]: never;
|
||||
}>;
|
||||
@@ -8442,6 +8469,10 @@ export const NotificationSettingsDocument = {
|
||||
kind: 'Field',
|
||||
name: { kind: 'Name', value: 'emailAvailable' },
|
||||
},
|
||||
{
|
||||
kind: 'Field',
|
||||
name: { kind: 'Name', value: 'pushPublicKey' },
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
@@ -8545,6 +8576,10 @@ export const UpdateNotificationSettingsDocument = {
|
||||
kind: 'Field',
|
||||
name: { kind: 'Name', value: 'emailAvailable' },
|
||||
},
|
||||
{
|
||||
kind: 'Field',
|
||||
name: { kind: 'Name', value: 'pushPublicKey' },
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
@@ -8556,6 +8591,102 @@ export const UpdateNotificationSettingsDocument = {
|
||||
UpdateNotificationSettingsMutation,
|
||||
UpdateNotificationSettingsMutationVariables
|
||||
>;
|
||||
export const SubscribePushDocument = {
|
||||
kind: 'Document',
|
||||
definitions: [
|
||||
{
|
||||
kind: 'OperationDefinition',
|
||||
operation: 'mutation',
|
||||
name: { kind: 'Name', value: 'SubscribePush' },
|
||||
variableDefinitions: [
|
||||
{
|
||||
kind: 'VariableDefinition',
|
||||
variable: {
|
||||
kind: 'Variable',
|
||||
name: { kind: 'Name', value: 'subscription' },
|
||||
},
|
||||
type: {
|
||||
kind: 'NonNullType',
|
||||
type: {
|
||||
kind: 'NamedType',
|
||||
name: { kind: 'Name', value: 'PushSubscriptionInput' },
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
selectionSet: {
|
||||
kind: 'SelectionSet',
|
||||
selections: [
|
||||
{
|
||||
kind: 'Field',
|
||||
name: { kind: 'Name', value: 'subscribePush' },
|
||||
arguments: [
|
||||
{
|
||||
kind: 'Argument',
|
||||
name: { kind: 'Name', value: 'subscription' },
|
||||
value: {
|
||||
kind: 'Variable',
|
||||
name: { kind: 'Name', value: 'subscription' },
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
],
|
||||
} as unknown as DocumentNode<
|
||||
SubscribePushMutation,
|
||||
SubscribePushMutationVariables
|
||||
>;
|
||||
export const UnsubscribePushDocument = {
|
||||
kind: 'Document',
|
||||
definitions: [
|
||||
{
|
||||
kind: 'OperationDefinition',
|
||||
operation: 'mutation',
|
||||
name: { kind: 'Name', value: 'UnsubscribePush' },
|
||||
variableDefinitions: [
|
||||
{
|
||||
kind: 'VariableDefinition',
|
||||
variable: {
|
||||
kind: 'Variable',
|
||||
name: { kind: 'Name', value: 'endpoint' },
|
||||
},
|
||||
type: {
|
||||
kind: 'NonNullType',
|
||||
type: {
|
||||
kind: 'NamedType',
|
||||
name: { kind: 'Name', value: 'String' },
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
selectionSet: {
|
||||
kind: 'SelectionSet',
|
||||
selections: [
|
||||
{
|
||||
kind: 'Field',
|
||||
name: { kind: 'Name', value: 'unsubscribePush' },
|
||||
arguments: [
|
||||
{
|
||||
kind: 'Argument',
|
||||
name: { kind: 'Name', value: 'endpoint' },
|
||||
value: {
|
||||
kind: 'Variable',
|
||||
name: { kind: 'Name', value: 'endpoint' },
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
],
|
||||
} as unknown as DocumentNode<
|
||||
UnsubscribePushMutation,
|
||||
UnsubscribePushMutationVariables
|
||||
>;
|
||||
export const NotificationAddedDocument = {
|
||||
kind: 'Document',
|
||||
definitions: [
|
||||
|
||||
Reference in New Issue
Block a user