تحديد ما إذا كان المستخدم الموثق في API قد أعجب بالمنشور في استجابة getTopic API

لقد عملتُ على إضافة تعليقات لـ WordPress خلال الأسبوع الماضي، وقد حققتُ نجاحًا كبيرًا في الاتصال بإنشاء المنشورات وتحديث البيانات عبر واجهة برمجة تطبيقات Discourse ونسختي المعدلة من إضافة discourse-php-API - Work through the createPost request to get it working by benbowler · Pull Request #14 · communiteq/discourse-api-php · GitHub

عند النظر إلى استجابة /posts، يمكنني رؤية ملخص الإجراءات لكل منشور والحصول على العدد الإجمالي للإعجابات.

actions_summary: Array(6)
0: {id: 2, count: 1, can_act: true}
1: {id: 3, can_act: true}
2: {id: 4, can_act: true}
3: {id: 8, can_act: true}
4: {id: 6, can_act: true}
5: {id: 7, can_act: true}
length: 6
__proto__: Array(0)

لكن الخاصية can_act تكون true بغض النظر عما إذا كان المستخدم قد أعجب بالمنشور أم لا. كيف يمكن عرض ذلك بشكل صحيح؟

If the user you’re using with the API (Api-Username) has liked a post, you should see acted: true

Hmm, let me take a look.

I’ve got it. The plugin wasn’t requesting based on the passed user. I’ll update the library to help anyone in future.

إعجابَين (2)