Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Feature Request: Add option to enrich reaction object withOwnReactions, withReactionCounts, etc.

Aperta
#592 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
30/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
javascript
Ambito
api

Direzione di ricerca

Inizia dalla chiamata client.feed(...).get e dalle opzioni esistenti enrich, withOwnReactions e withReactionCounts; esamina come reactions.add e updateActivityToTargets espongono le attività arricchite. Il lavoro è completato quando gli oggetti attività annidati possono restituire reaction_counts e own_reactions tramite le due opzioni richieste, con il comportamento correlato coperto dai test esistenti del repository.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Please add the option to enrich a reaction's activity object with the activity's reactions so clients can display the original activity's reaction counts and current user's own reactions. This is necessary to implement common features in popular social media platforms like Twitter, such as "reposts" (displaying the original activity's reaction counts) and similar features.

Currently, the code below allows reposting but does not allow client.feed('user_likes', userId).get({}) to retrieve the original activity's reaction counts or the current user's own reactions to the original activity. Enrichment only returns the original activity's basic information (via object) without it's reactions.

await client.reactions.add('like', activityId, {}, {
    userId,
    targetFeeds: ['user_likes:' + userId],
  }
)

client.feed('user_likes', userId).get({
  user_id: currentUserId || undefined,
  id_lte: cursor2?.fromId,
  limit: 20,
  enrich: true,
  withOwnReactions: true,
  withReactionCounts: true,
  withOwnChildren: true,
})

/**
Returns: 
{
   foreign_id: 'reaction:...',
   id: '...',
   actor: {
     //reaction's actor
   },
   object: {
    //original activity info
    actor: '...',
    foreign_id: '...',
    id: '...',
    object: '...',
    origin: null,
    target: '',
    time: '...',
    verb: 'post'
   },
   origin: null,
   own_reactions: {},
   reaction: {
    //reaction's info
    created_at: '...',
    updated_at: '...',
    id: '...',
    user_id: '...',
    kind: 'like',
    activity_id: '...',
    data: {},
    target_feeds: [..],
    parent: '',
    latest_children: {},
    children_counts: {}
   },
  //child reaction count of current reaction
  reaction_counts: {},
  verb: 'like'
}
**/

The code below also allows for a reposting type feature with the original's reactions but does not maintain the order of when the activity was added to the additional feed. Rather, it orders based on the activity's original create date. (ie. liking post2 and then post1, will return post1 before post2 when fetched).

client.feed('user', authorId).updateActivityToTargets(postId, createdAt.toISOString(), undefined, [`user_likes:${userId}`])

Please add the option to enrich reactions with activity objects with that activity objects reactions such as with the following options:

client.feed('user', id).get({
  user_id: currentUserId || undefined,
  id_lte: cursor2?.fromId,
  limit: 20,
  enrich: true,

  //EXISTING: For current activity
  withOwnReactions: true,
  withReactionCounts: true,
  withOwnChildren: true,

  //NEW: for nested activity
  withActivityObjectReactions: true,
  withOwnActivityObjectReactions: true
})

/**
Returns: same as previous code snippet but adding the following:
{
  object: {
   //NEW: for nested activity (original activity reacted to)
   reaction_counts: {},
   own_reactions: {}
  }
}
**/
Lingua principale
JavaScript
Stelle
337
Fork
114
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di GetStream/stream-js

Tutte le issue di GetStream/stream-js

Issue simili

Altre issue su JavaScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.