sort notes
This commit is contained in:
		
							parent
							
								
									9292d4f991
								
							
						
					
					
						commit
						b7130b68fd
					
				@ -405,9 +405,12 @@ async function getNotesWithLinks (userPubkeys, timeIntervalHours, relayUrls, ign
 | 
			
		||||
 * @returns {String} - Formatted string with note information
 | 
			
		||||
 */
 | 
			
		||||
function formatNoteOutput (notes) {
 | 
			
		||||
  // Sort notes by timestamp (newest first)
 | 
			
		||||
  const sortedNotes = [...notes].sort((a, b) => b.created_at - a.created_at)
 | 
			
		||||
 | 
			
		||||
  const output = []
 | 
			
		||||
 | 
			
		||||
  for (const note of notes) {
 | 
			
		||||
  for (const note of sortedNotes) {
 | 
			
		||||
    // Get note ID as npub
 | 
			
		||||
    const noteId = nip19.noteEncode(note.id)
 | 
			
		||||
    const pubkey = nip19.npubEncode(note.pubkey)
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user