From e1a6f0a669f56a8c2fffdc650a86dc06bd2db4b6 Mon Sep 17 00:00:00 2001 From: Ren Amamiya Date: Sun, 27 Sep 2026 08:37:39 +0700 Subject: [PATCH] remove cover note --- crates/signed_core/src/annotations.rs | 7 ------ crates/signed_core/src/filters.rs | 32 +++++---------------------- crates/signed_core/src/inbox.rs | 7 ++---- crates/signed_core/src/lib.rs | 2 -- crates/workspace/src/views/inbox.rs | 6 +---- 5 files changed, 9 insertions(+), 45 deletions(-) delete mode 100644 crates/signed_core/src/annotations.rs diff --git a/crates/signed_core/src/annotations.rs b/crates/signed_core/src/annotations.rs deleted file mode 100644 index 0a49935..0000000 --- a/crates/signed_core/src/annotations.rs +++ /dev/null @@ -1,7 +0,0 @@ -use nostr::prelude::*; - -/// GitWorkshop and `ngit` cover-note extension, kind 1624. -/// -/// A markdown note attached to an issue, patch or PR by its author or a maintainer, -/// not part of the NIP-34 draft, read support for interop. -pub const COVER_NOTE_KIND: Kind = Kind::Custom(1624); diff --git a/crates/signed_core/src/filters.rs b/crates/signed_core/src/filters.rs index 042a00b..c8180a0 100644 --- a/crates/signed_core/src/filters.rs +++ b/crates/signed_core/src/filters.rs @@ -2,7 +2,7 @@ use std::time::Duration; use nostr::prelude::*; -use crate::{COVER_NOTE_KIND, RepoAddr}; +use crate::RepoAddr; /// Kinds that make up the activity of a repository. pub const ACTIVITY_KINDS: [Kind; 9] = [ @@ -18,19 +18,18 @@ pub const ACTIVITY_KINDS: [Kind; 9] = [ ]; /// Kinds that notify a user when they tag them via their `p` tag. -pub const NOTIFICATION_KINDS: [Kind; 9] = [ +pub const NOTIFICATION_KINDS: [Kind; 8] = [ Kind::GitIssue, Kind::GitPullRequest, Kind::GitPatch, Kind::GitPullRequestUpdate, - COVER_NOTE_KIND, Kind::GitStatusOpen, Kind::GitStatusApplied, Kind::GitStatusClosed, Kind::GitStatusDraft, ]; -/// Git root kinds that make a comment or cover note count as git activity. +/// Git root kinds that make a comment count as git activity. const GIT_ROOT_KINDS: [Kind; 4] = [ Kind::GitIssue, Kind::GitPatch, @@ -44,7 +43,6 @@ pub fn is_repo_kind(kind: Kind) -> bool { || kind == Kind::RepoState || kind == Kind::EventDeletion || kind == Kind::RequestToVanish - || kind == COVER_NOTE_KIND || ACTIVITY_KINDS.contains(&kind) } @@ -150,13 +148,7 @@ pub fn notifications(me: PublicKey) -> Vec { /// A comment on an unrelated kind is matched too, so results must be filtered /// through [`is_git_activity`] before display. pub fn authored_activity(me: PublicKey) -> Filter { - Filter::new() - .kinds( - ACTIVITY_KINDS - .into_iter() - .chain(std::iter::once(COVER_NOTE_KIND)), - ) - .author(me) + Filter::new().kinds(ACTIVITY_KINDS).author(me) } /// Whether a kind-1111 comment targets a git root, checked via its `K` tag. @@ -165,12 +157,6 @@ fn is_git_comment(event: &Event) -> bool { && tag_kind(event, "K").is_some_and(|kind| GIT_ROOT_KINDS.contains(&kind)) } -/// Whether a kind-1624 cover note targets a git root, checked via its `k` tag. -fn is_git_cover_note(event: &Event) -> bool { - event.kind == COVER_NOTE_KIND - && tag_kind(event, "k").is_some_and(|kind| GIT_ROOT_KINDS.contains(&kind)) -} - /// Whether a status event references a git root, checked via its `k` tag. fn is_git_status(event: &Event) -> bool { tag_kind(event, "k").is_some_and(|kind| GIT_ROOT_KINDS.contains(&kind)) @@ -185,7 +171,7 @@ pub fn is_git_activity(event: &Event) -> bool { | Kind::GitStatusApplied | Kind::GitStatusClosed | Kind::GitStatusDraft => is_git_status(event), - kind => kind == COVER_NOTE_KIND && is_git_cover_note(event), + _ => false, } } @@ -277,17 +263,12 @@ mod tests { } #[test] - fn status_and_cover_note_activity_depend_on_the_lowercase_k_tag() { + fn status_activity_depends_on_the_lowercase_k_tag() { let status = signed( &keys(1), Kind::GitStatusClosed, vec![kind_tag("k", Kind::GitPullRequest)], ); - let cover = signed( - &keys(1), - COVER_NOTE_KIND, - vec![kind_tag("k", Kind::GitPatch)], - ); let unrelated = signed( &keys(1), Kind::GitStatusClosed, @@ -295,7 +276,6 @@ mod tests { ); assert!(is_git_activity(&status)); - assert!(is_git_activity(&cover)); assert!(!is_git_activity(&unrelated)); assert!(!is_git_activity(&signed( &keys(1), diff --git a/crates/signed_core/src/inbox.rs b/crates/signed_core/src/inbox.rs index 582e9b0..c848a29 100644 --- a/crates/signed_core/src/inbox.rs +++ b/crates/signed_core/src/inbox.rs @@ -4,7 +4,7 @@ use std::time::Duration; use nostr::prelude::*; use serde::{Deserialize, Serialize}; -use crate::{COVER_NOTE_KIND, RepoAddr, activity_subject}; +use crate::{RepoAddr, activity_subject}; /// Window before `now` that an advanced cutoff retreats to. const ADVANCE_WINDOW: Duration = Duration::from_secs(3 * 24 * 60 * 60); @@ -121,14 +121,11 @@ impl InboxItem { /// - patch (1617): its `e` parent patch, else itself /// - NIP-22 comment (1111): uppercase `E` root pointer /// - PR update (1619): uppercase `E` -/// - statuses (1630-1633) / cover note (1624): NIP-10 root `e` +/// - statuses (1630-1633): NIP-10 root `e` pub fn notification_root(event: &Event, lookup: &L) -> Option where L: Fn(EventId) -> Option, { - if event.kind == COVER_NOTE_KIND { - return nip10_root_id(event).map(|root| resolve_thread_root(root, lookup)); - } match event.kind { Kind::GitIssue | Kind::GitPullRequest => Some(event.id), Kind::GitPatch => Some(match first_e_id(event) { diff --git a/crates/signed_core/src/lib.rs b/crates/signed_core/src/lib.rs index 2bc3ca6..7232086 100644 --- a/crates/signed_core/src/lib.rs +++ b/crates/signed_core/src/lib.rs @@ -1,5 +1,4 @@ pub mod addr; -pub mod annotations; pub mod deletions; pub mod filters; pub mod inbox; @@ -8,7 +7,6 @@ pub mod state; pub mod status; pub use addr::{RepoAddr, identifier_from_name, repo_addr}; -pub use annotations::COVER_NOTE_KIND; pub use deletions::Deletions; pub use filters::{ NOTIFICATION_KINDS, authored_activity, is_git_activity, notification_comments, notifications, diff --git a/crates/workspace/src/views/inbox.rs b/crates/workspace/src/views/inbox.rs index 7de3cff..81d9301 100644 --- a/crates/workspace/src/views/inbox.rs +++ b/crates/workspace/src/views/inbox.rs @@ -11,7 +11,7 @@ use gpui::{ use gpui_component::button::{Button, ButtonVariants}; use gpui_component::{ActiveTheme, Icon, IconName, IconNamed, Sizable, StyledExt, h_flex, v_flex}; use nostr::prelude::{Event, EventId, Kind, PublicKey, Timestamp}; -use signed_core::{COVER_NOTE_KIND, InboxItem, InboxReadState, RepoAddr}; +use signed_core::{InboxItem, InboxReadState, RepoAddr}; use signed_state::{ Backend, BackendEvent, ProfileStore, RefreshGate, RefreshRequest, RepoListStore, query_inbox, }; @@ -557,10 +557,6 @@ fn sub_activity(event: &Event, me: Option, cx: &App) -> AnyElement { } fn activity_phrase(kind: Kind) -> &'static str { - if kind == COVER_NOTE_KIND { - return "added a note"; - } - match kind { Kind::GitIssue => "opened an issue", Kind::GitPullRequest => "opened a PR",