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

Add discussions tab to community page #645

Merged
merged 28 commits into from
Feb 17, 2024

Conversation

Tguntenaar
Copy link
Collaborator

@Tguntenaar Tguntenaar commented Jan 23, 2024

Resolves #584

Right now the preview doesn't work since it needs to link a different contract first
PREVIEW

This issue is blocked on the contract side by PR: #88

Acceptance Criteria

DevHub community page requirements:

  • There is a new Discussions tab, which is the second tab that users see when they land on a given community
  • All users see a share update input text area field (e.g. What's happening)
  • The share update input text area field contains all the same elements from the near.org, including supporting markdown, image update, as well as the preview.
  • Users can type their update, preview it, upload image, and click post. Upon post, the update shows up in the discussions section with the user's profile/name.
  • The discussion feed is sorted by latest, but users can also filter by recent comments
  • Users can click Load More to load additional posts
  • Users can interact with discussions posts (like, add comment, copy link to post, or share).
  • Users can report posts (clicking the three dots). Note: @ailisp will handle this part in a separate ticket. Please check in with him.

near.org and near social requirements:

  • Any discussion posted on DevHub communities will also show up on near.org and near social gateways

Backend storage requirements:

  • Use Social DB and follow near.org conventions-

src="${REPL_DEVHUB}/widget/devhub.components.organism.Feed"
props={{
showFlagAccountFeature: true,
action: "repost",
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file is mostly a copy of the Announcements.jsx feed only difference is that it looks for repost instead of post. And the Compose component call createDiscussion in the devhub-contract.

ailisp pushed a commit to NEAR-DevHub/neardevhub-contract that referenced this pull request Feb 8, 2024
This issue is supporting PR
[#645](NEAR-DevHub/neardevhub-bos#645)

@frolvlad @ailisp  I would like to get some feedback on my approach.

I assumed that in order to create
`discussions.${handle}.community.devhub.near` the
`${handle}.community.devhub.near` account needs to be an factory in
itself.


I added this image help describe what I did with some common
terminology.
<img width="1072" alt="Screenshot 2024-01-23 at 17 31 22"
src="https://github.com/NEAR-DevHub/neardevhub-contract/assets/28901891/7b0b1145-0828-4e32-9a1d-cb0ba32354f9">

I added a `set_discussions_community_socialdb` function so the user can
post on socialdb from the devhub.near contract. This uses
`get_devhub_discussions_account` which retrieves
`discussions.<handle>.community.devhub.near`.

To support that I added a `create_discussions_account` function to the
community contract. So the community contract is in essence a
discussions factory. I copied most of what was the community contract to
the discussions contract with some minor tweaks since it is a level down
in subaccounts.

In file `community/src/lib.rs` line 9 and 70 a PUBkey from devhub.near
is used to give control to make posts on socialDB.
Should this be devhub.near?
let blockHeight = response[context.accountId]["post"][":block"];
repostOnDiscussions(blockHeight);
})
.catch(console.log);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good on processing user discussions!

@Tguntenaar Tguntenaar marked this pull request as ready for review February 12, 2024 17:27
@Tguntenaar
Copy link
Collaborator Author

For now we use mob.near/widget/MainPage.N.Feed. Pagoda team promised to push the updated Feed component that supports reshares next week, you can use Evgeny's (mob.near) feed for now and we will just swap it with the same (Pagoda's) as on the announcements page later

Copy link
Collaborator

@frol frol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bugs:

  • If posting to social.near does not require redirect, create_discussion is not triggerred
  • Postng to social.near is not visible (see transaction, see it not visible on the feed) - you have to include index update in the set call

@Tguntenaar
Copy link
Collaborator Author

@frol fixed them! It is ready to merge

Copy link
Collaborator

@frol frol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

telegram-cloud-photo-size-2-5366552544362485864-y

The compose block should show my avatar and account id instead of the discussions account avatar and account id. (in announcements we wanted to display the announcements account, but in discussions we want to display the user account since it will be posted on behalf of the user)

P.S. We need to set some avatar and meaningful bio with the reference to the announcements account and DevHub for the discussions accounts

src/devhub/entity/community/Discussions.jsx Outdated Show resolved Hide resolved
src/devhub/entity/community/Discussions.jsx Outdated Show resolved Hide resolved
src/devhub/entity/community/Discussions.jsx Outdated Show resolved Hide resolved
Copy link
Collaborator

@frol frol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉

@frol frol merged commit 2a7cc9e into NEAR-DevHub:main Feb 17, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement Discussions for communities using Social DB
3 participants