GetStream / stream-python

Python Client - Build Activity Feeds & Streams with GetStream.io
https://getstream.io
BSD 3-Clause "New" or "Revised" License
142 stars 40 forks source link

own reactions #92

Closed fahim-15 closed 5 years ago

fahim-15 commented 5 years ago

Problem explanation

I expect to see only user's own reactions, but instead I get all reactions, regardless of who they came from.

Steps to reproduce

feed = client.feed('user', 'alice');
response = feed.get(limit=30, enrich=True, reactions: {"counts": true, "recent": true, "own": true})

Environment info

Operating System: Python version: <!-- x.y.z (command: python --version) --> Library version:

Error traceback (if applicable)

[put traceback here]

Code snippet that causes the problem

feed = client.feed('user', 'alice');
response = feed.get(limit=30, enrich=True, reactions: {"counts": true, "recent": true, "own": true})

tbarbugli commented 5 years ago

this will return recent reactions + own reactions can you include more information about the output you receive?

fahim-15 commented 5 years ago

feed = client.feed('timeline', 'alice'); response = feed.get(limit=30, enrich=True, reactions: {"counts": true, "recent": true, "own": true})

I requested for alice's timeline feeds with own reactions "True". But in "own reactions" got reactions from other users.

User alice didn't reacted to any activity. So "own activity" supposed to be empty.

Output of a activity:

'activities': [
  {
    'actor': '45',
    'user': {
      'created_at': '2019-02-05T07:21:19.656132Z',
      'updated_at': '2019-06-19T06:04:56.019912Z',
      'id': '45''data': {
        'first_name': 'Priya',
        'last_name': 'Jadhav',
        'user_id': 45
      }
    },
    'event_id': 134,
    'event_name': 'test event',
    'foreign_id': '769attending_eventtest',
    'id': '09960ddc-9343-11e9-8080-80004cee6f7e',
    'object': 'event:134',
    'origin': 'user:45',
    'own_reactions': {
      'comment': [
        {
          'id': 'e654f92e-95b6-4fdf-819e-ba4f23fad512',
          'user_id': '12',
          'user': {
            'data': {
              'first_name': 'Test1',
              'last_name': 'User1',
              'user_id': 12
            }
          },
          'kind': 'comment',
          'activity_id': '785ee75c-933e-11e9-8080-8001532dde99',
          'data': {
            'text': 'helllllllooooooo'
          },
          'parent': '',
          'latest_children': {

          },
          'children_counts': {

          }
        },
        {
          'id': '6b7972b6-914c-4d65-a747-74930dab978e',
          'user_id': '12',
          'user': {
            'data': {
              'first_name': 'Test1',
              'last_name': 'User1',
              'user_id': 12
            }
          },
          'kind': 'comment',
          'activity_id': '785ee75c-933e-11e9-8080-8001532dde99',
          'data': {
            'text': 'Good afternoon!'
          },
          'parent': '',
          'latest_children': {

          },
          'children_counts': {

          }
        }
      ],
      'like': [
        {
          'id': 'fe845142-53c7-4453-9889-98e4fef05b1f',
          'user_id': '89',
          'user': {
            'data': {
              'first_name': 'Test2',
              'last_name': 'User2',
              'user_id': 89
            }
          },
          'kind': 'like',
          'activity_id': '785ee75c-933e-11e9-8080-8001532dde99',
          'data': {

          },
          'parent': '',
          'latest_children': {

          },
          'children_counts': {

          }
        },
        {
          'id': '1ff567ba-c8b0-4c94-a106-ce881c8bacb1',
          'user_id': '12',
          'user': {
            'created_at': '2018-12-26T06:00:17.904858Z',
            'updated_at': '2019-06-19T14:20:06.779968Z',
            'id': '12',
            'data': {
              'first_name': 'Test1',
              'last_name': 'User1',
              'user_id': 12
            }
          },
          'kind': 'like',
          'activity_id': '785ee75c-933e-11e9-8080-8001532dde99',
          'data': {

          },
          'parent': '',
          'latest_children': {

          },
          'children_counts': {

          }
        }
      ]
    },
    'latest_reactions': {

    },
    'latest_reactions_extra': {

    },
    'reaction_counts': {
      'comment': 2,
      'like': 2
    },
    'target': '',
    'verb': 'event'
  }
],
'activity_count': 1,
'actor_count': 1,
'group': '09960ddc-9343-11e9-8080-80004cee6f7e',
'id': '0a77f2d5-9343-11e9-8080-80011a5332c2',
'verb': 'event'
}
tbarbugli commented 5 years ago

you have to specify the user_id when you read the feed (ie. different users can read the same feed)

make sure to pass user_id="alice" to feed.get

fahim-15 commented 5 years ago

thank you @tbarbugli it worked!

fahim-15 commented 5 years ago

Thank you Tommaso Barbugli.

On Thu, Jun 20, 2019 at 6:53 PM Tommaso Barbugli notifications@github.com wrote:

you have to specify the user_id when you read the feed (ie. different users can read the same feed)

make sure to pass user_id="alice" to feed.get

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/GetStream/stream-python/issues/92?email_source=notifications&email_token=AHHOOIAUC6R3RIBWS3XUCNDP3OAFRA5CNFSM4HZR4F5KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODYFMYEA#issuecomment-504024080, or mute the thread https://github.com/notifications/unsubscribe-auth/AHHOOIB2JCWRFZTSEPHGSJTP3OAFRANCNFSM4HZR4F5A .

francescov1 commented 2 years ago

Hi, we are running into this same issue using the Node.js SDK (not the ORM, just barebones) but there doesn't seem to be a user_id field we can pass to feed.get.

ferhatelmas commented 2 years ago

@francescov1 could you create an issue for node sdk on its repo?

FYI, you can pass whatever you want into feed.get(options), only ts types might be missing.

MihaiNueleanu commented 2 years ago

@ferhatelmas - thank you! you saved me days of banging my head against the wall 👍