MCPcopy Create free account
hub / github.com/decaporg/decap-cms / addNote

Method addNote

packages/decap-cms-backend-github/src/implementation.tsx:789–823  ·  view source on GitHub ↗
(
    collection: string,
    slug: string,
    noteData: Omit<Note, 'id'>,
    entryTitle?: string,
  )

Source from the content-addressed store, hash-verified

787 }
788
789 async addNote(
790 collection: string,
791 slug: string,
792 noteData: Omit<Note, 'id'>,
793 entryTitle?: string,
794 ): Promise<Note> {
795 const currentUser = await this.currentUser({ token: this.token! });
796 const identity = await this.noteAuthorIdentity();
797
798 const note: Note = {
799 ...noteData,
800 id: 'temp-' + Date.now(),
801 author: identity.author,
802 authorId: identity.authorId,
803 isOwn: true,
804 avatarUrl: currentUser.avatar_url,
805 entrySlug: slug,
806 timestamp: noteData.timestamp || new Date().toISOString(),
807 resolved: noteData.resolved || false,
808 issueUrl: undefined,
809 };
810
811 const { commentId, issueUrl } = await this.api!.addNoteToEntry(
812 collection,
813 slug,
814 note,
815 entryTitle,
816 );
817
818 return {
819 ...note,
820 id: commentId,
821 issueUrl,
822 };
823 }
824
825 async updateNote(
826 collection: string,

Callers 1

Calls 3

currentUserMethod · 0.95
noteAuthorIdentityMethod · 0.95
addNoteToEntryMethod · 0.45

Tested by

no test coverage detected