Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: Like feature is not implemented properly. #92

Open
1 of 2 tasks
Sanchitbajaj02 opened this issue Dec 25, 2023 · 43 comments
Open
1 of 2 tasks

Feat: Like feature is not implemented properly. #92

Sanchitbajaj02 opened this issue Dec 25, 2023 · 43 comments
Labels
⭐ enhancement Feature enhancement 🛠 goal: fix The label is related to fixing a bug gssoc GSSOC'24 Required Label HARD Difficulty Level: Hard level3 45 points

Comments

@Sanchitbajaj02
Copy link
Owner

What feature?

The code for like feature is implemented but it is not working properly on the server. A PoC is required before going further.

Add screenshots

No response

Record

  • I agree to follow this project's Code of Conduct
  • I want to work on this issue
Copy link

Congratulations, @Sanchitbajaj02! 🎉 Thank you for creating the issue. Your contribution is greatly appreciated and we look forward to working with you to resolve the issue. Keep up the great work!

'We will promptly review your changes and offer feedback. Keep up the excellent work!
Kindly remember to check our Contributing Guidelines'

@Sanchitbajaj02 Sanchitbajaj02 added SWOC S4 Social Winter of Code (S4) 2024 contribution tag HARD Difficulty Level: Hard and removed 🚦status: awaiting triage labels Dec 25, 2023
@Archit5655
Copy link
Contributor

I would like to take on this issue

@Sanchitbajaj02
Copy link
Owner Author

Sure, please go ahead. If you need anything, just let me know. Also, we need to discuss about its performance. So, before implementing anything, just ask here or in discord

@sumanjeet0012
Copy link
Contributor

I want to work on this issue.
assign me

@Sanchitbajaj02
Copy link
Owner Author

@sumanjeet0012 assigned to you

@Sanchitbajaj02 Sanchitbajaj02 added IWOC2024 Innogeeks Winter of Code (S2) 2024 contribution tag 🛠 goal: fix The label is related to fixing a bug labels Jan 21, 2024
@Jenis07
Copy link

Jenis07 commented Jan 23, 2024

Can you assign me this issue under IWOC?

@Sanchitbajaj02
Copy link
Owner Author

@Jenis07 sure. Assigned this to you. Make sure to update your progress and if you have any doubt, just let me know.

@IrfanshaikH-7
Copy link
Contributor

Can I look into it ...@Sanchitbajaj02

@Jenis07
Copy link

Jenis07 commented Jan 24, 2024

is there any steps to setup the project in the localhost?

@IrfanshaikH-7
Copy link
Contributor

Yes checkout the readme - it explained everything

@IrfanshaikH-7
Copy link
Contributor

is there any steps to setup the project in the localhost?

And you have to setup appwrite instance too .. if you follow the readme doc , you shouldn't have any issues with seting up..

@Manishak798
Copy link

@Jenis07 have you started working on this ?

@Sanchitbajaj02
Copy link
Owner Author

@Jenis07 If you don't respond within 24 hours, I will unassign the issue

@Jenis07
Copy link

Jenis07 commented Jan 30, 2024 via email

@Sanchitbajaj02
Copy link
Owner Author

@Jenis07 any updates?

@Sanchitbajaj02 Sanchitbajaj02 added the gssoc GSSOC'24 Required Label label May 16, 2024
@ArtiGaund
Copy link

So, there are User, Post, and like collections. When the user clicks on the like button, => if like is already enabled (checking whether post id with user id is present in the Like collections), it will delete that entry from the like collection and decrease the count of post ids in Post collection. Else will increase the count of post IDs in Post Collection and add entry in Like collection with post IDs and user IDs.

@Sanchitbajaj02
Copy link
Owner Author

So, there are User, Post, and like collections. When the user clicks on the like button, => if like is already enabled (checking whether post id with user id is present in the Like collections), it will delete that entry from the like collection and decrease the count of post ids in Post collection. Else will increase the count of post IDs in Post Collection and add entry in Like collection with post IDs and user IDs.

Yes, that's the aim of this functionality

@ArtiGaund
Copy link

I will try to do it.

@ArtiGaund
Copy link

ArtiGaund commented May 18, 2024

Screenshot (307)
login feature is not working; yesterday it was working when I created account after setting up the project, but today when I am trying to login, it is showing this error. Even after I modified the password in the database, it still shows this error. I am not able to see the post page.

@ArtiGaund
Copy link

whats the timelimit for the assignment?

@Sanchitbajaj02
Copy link
Owner Author

whats the timelimit for the assignment?

There is no as such time limit, if you need time, you can take it. Just keep me updated with the progress. As for the login issue, what you can do is peek into the appwrite and see whether in the auth you are verified or not. If yes, go to db and see whether an entry is created with your username. Let me know here or on discord about your findings...

@ArtiGaund
Copy link

For login, I am registering and deleting accounts daily, as I have appwriteDB in my appwrite console. Through registration, I am able to get a login automatically and can view the posts and work on them.

@Sanchitbajaj02
Copy link
Owner Author

For login, I am registering and deleting accounts daily, as I have appwriteDB in my appwrite console. Through registration, I am able to get a login automatically and can view the posts and work on them.

Actually, you don't need to delete daily. What you can do is find out what part is giving the error in the component.

@ArtiGaund
Copy link

I will try to find it.

@ArtiGaund
Copy link

ArtiGaund commented May 21, 2024

Resolved you registeration and login problem.

@Sanchitbajaj02
Copy link
Owner Author

Resolved you registeration and login problem.

Can you address the issue and your findings in #300

@ArtiGaund
Copy link

as the appwrite version is fixed in the project, I cannot use upgrade version methods? bz they will not work.

@Sanchitbajaj02
Copy link
Owner Author

as the appwrite version is fixed in the project, I cannot use upgrade version methods? bz they will not work.

Does your implementation require it to be on an upgraded version?

@ArtiGaund
Copy link

as the appwrite version is fixed in the project, I cannot use upgrade version methods? bz they will not work.

Does your implementation require it to be on an upgraded version?

For performing like and dislike, I need to check whether the user has liked the post or not. To check that entry, their is a query.and() method that checks multiple queries together. But Query.and() is in the upgraded version of AppWrite. The assignment is not yet complete, but bugs are there. That's why I am asking; I will change that and use a different method to do it.

@Sanchitbajaj02
Copy link
Owner Author

But Query.and() is in the upgraded version of AppWrite. The assignment is not yet complete, but bugs are there. That's why I am asking; I will change that and use a different method to do it.

There will be multiple changes like that login issue? if you want we can switch to higher variant but its just that we need to cater those changes

@ArtiGaund
Copy link

Login issue is resolved now?

@Sanchitbajaj02
Copy link
Owner Author

Login issue is resolved now?

That's not the issue. If it was working fine on version 13 then it isn't a bug. Since it is not recommended to upgrade the version when I provided the lock functionality

@ArtiGaund
Copy link

I will complete the like functionality first, which was assigned to me. Then we will pull upstream and check the error for login and registration.

@ArtiGaund
Copy link

Screenshot (332)
Screenshot (333)
Screenshot (334)

@Sanchitbajaj02
Copy link
Owner Author

Check whether the proper type is declared for onLikeClick. If you face any issue, please reach out to me on discord

@vinayak-vohra
Copy link
Contributor

@Sanchitbajaj02 may I work on this issue?

@Sanchitbajaj02
Copy link
Owner Author

@Sanchitbajaj02 may I work on this issue?

yeah sure

@vinayak-vohra
Copy link
Contributor

vinayak-vohra commented Jul 4, 2024

@Sanchitbajaj02 the posts collection has a likesCount attribute of integer type which would only tell the number of likes.
There is no way of knowing whether the current user has liked the post or not, which is needed to implement the like and unlike functionality. There is also a likes collection which is never used. I've thought of a few ways to tackle this issue:

  1. Change likesCount(integer) to likedBy(array of userIds):
    • Like count would be the size of likedBy array.
    • For Like/Unlike we can check the array for current userId. If present, splice the array and update document (unlike). Else push current userId into the array (like).
    • In this approach, userIds of all users who liked the post would be sent.
  2. Utilizing the likes collection:
    • We can fetch all the docs with userId as current user and convert it to an array of postIds (likedPosts) since userId will be same in all.
    • Liked status for UI can be checked using likedPosts.includes(postId).
    • Like/Unlike would be pushing/splicing from likedPost array.
    • This approach would require 2 API calls: updating count in document of posts collection and creating/deleting document in likes collection.

Please suggest which approach to implement, or if you'd like to suggest any other approach.

@vinayak-vohra
Copy link
Contributor

@Sanchitbajaj02 I've implemented the like feature, but it requires some changes in the structure of likes collection. So, I need to discuss a few things related to this. Please reply when you are available.

palettegram-like.mp4

@Sanchitbajaj02
Copy link
Owner Author

@Sanchitbajaj02 I've implemented the like feature, but it requires some changes in the structure of likes collection. So, I need to discuss a few things related to this. Please reply when you are available.

My availability is and will be a bit low. I know it needs to be structured. You can DM me on discord about your idea and we can discuss over there

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
⭐ enhancement Feature enhancement 🛠 goal: fix The label is related to fixing a bug gssoc GSSOC'24 Required Label HARD Difficulty Level: Hard level3 45 points
Projects
None yet
Development

No branches or pull requests

9 participants