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 the ability to create subspace sections #856

Closed
RiccardoM opened this issue May 5, 2022 · 2 comments · Fixed by #866
Closed

Add the ability to create subspace sections #856

RiccardoM opened this issue May 5, 2022 · 2 comments · Fixed by #866
Assignees
Labels
kind/new-feature Propose the addition of a new feature that does not yet exist x/subspaces Issue on the x/subspaces module

Comments

@RiccardoM
Copy link
Contributor

RiccardoM commented May 5, 2022

Feature description

Currently each subspace represents a single application within the Desmos ecosystem. As per ADR-010, each time a post is created it must be placed inside a subspace using its id as a reference. Although this works, it does not allow developers to create subspaces that need to represent complex systems just as forums. If a developer wanted to create a forum, they have to create different subspaces for each section, but this would result in having multiple user groups and permissions to be managed. Instead, I think it's worth introducing the idea of sections.

Implementation proposal

A subspace section defines a region within a subspace with its own rules. It can have its user groups and allows to store posts by referencing them though the section_id. A section can also have a parenting section so that sub-sections can be created to be able to build a forum or other complex social apps.

The basic idea of a section is the following:

// Section contains all the data of a subspace section
type Section struct {
  // Unique id of the section within the subspace (this is assigned upon the section creation)
  Id uint32 

  // Name of the section
  Name string

  // (optional) Description of the section
  Description string
  
  // (optional) Id of the parent section
  Parent uint32
}

Each subspace will have a default section with id 0 which represents the generic subspace itself.

Once sections are implemented, the following changes must be applied:

  • permissions need to be checked against the (subspace_id, section_id) tuple instead of relying only on the subspace_id
  • posts need to be stored within a specific section instead of a generic subspace

Note that by default sub-sections will inherit the permissions set on parent sections. Suppose the following sections are present within a subspace:

Section A ---> Section B (Parent: A)

Then, if a user has PermissionModerateContent on section A, they will have PermissionModerateContent on section B as well (permissions of section A are inherited within section B).

Please let me know what you think about this. If there's nothing against this feature I will take care of writing an ADR with better details. @bragaz @dadamu

@RiccardoM RiccardoM added the kind/new-feature Propose the addition of a new feature that does not yet exist label May 5, 2022
@RiccardoM RiccardoM self-assigned this May 5, 2022
@RiccardoM RiccardoM added the x/subspaces Issue on the x/subspaces module label May 5, 2022
@leobragaz
Copy link
Contributor

I have no doubt this is a must have inside subspaces. I was thinking the same some time ago and ended up thinking about using groups for this but it actually doesn't make sense like that. With this, anyone can leverage their app with the desired level of complexity.

@dadamu
Copy link
Contributor

dadamu commented May 9, 2022

Nice! I agree with it. Then, moderators can manage only one subspace instead of multiple subspaces.

RiccardoM added a commit that referenced this issue May 16, 2022
## Description

This PR introduces the concept of subspaces sections, as described inside #856. 

<!-- Add a description of the changes that this PR introduces and the files that
are the most critical to review. -->

---

### Author Checklist

*All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.*

I have...

- [x] included the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title
- [ ] added `!` to the type prefix if API or client breaking change
- [x] targeted the correct branch (see [PR Targeting](https://github.com/desmos-labs/desmos/blob/master/CONTRIBUTING.md#pr-targeting))
- [ ] provided a link to the relevant issue or specification
- [ ] followed the guidelines for [building modules](https://docs.cosmos.network/v0.44/building-modules/intro.html)
- [ ] included the necessary unit and integration [tests](https://github.com/desmos-labs/desmos/blob/master/CONTRIBUTING.md#testing)
- [ ] added a changelog entry to `CHANGELOG.md`
- [ ] included comments for [documenting Go code](https://blog.golang.org/godoc)
- [ ] updated the relevant documentation or specification
- [x] reviewed "Files changed" and left comments if necessary
- [x] confirmed all CI checks have passed

### Reviewers Checklist

*All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.*

I have...

- [ ] confirmed the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title
- [ ] confirmed `!` in the type prefix if API or client breaking change
- [ ] confirmed all author checklist items have been addressed
- [ ] reviewed state machine logic
- [ ] reviewed API design and naming
- [ ] reviewed documentation is accurate
- [ ] reviewed tests and test coverage
- [ ] manually tested (if applicable)
@mergify mergify bot closed this as completed in #866 Jun 1, 2022
mergify bot pushed a commit that referenced this issue Jun 1, 2022
## Description

This PR implements the subspaces sections as described inside [ADR-012](https://github.com/desmos-labs/desmos/blob/master/docs/architecture/adr-012-subspaces-sections.md).

Closes: #856

---

### Author Checklist

*All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.*

I have...

- [x] included the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title
- [ ] added `!` to the type prefix if API or client breaking change
- [x] targeted the correct branch (see [PR Targeting](https://github.com/desmos-labs/desmos/blob/master/CONTRIBUTING.md#pr-targeting))
- [x] provided a link to the relevant issue or specification
- [x] followed the guidelines for [building modules](https://docs.cosmos.network/v0.44/building-modules/intro.html)
- [x] included the necessary unit and integration [tests](https://github.com/desmos-labs/desmos/blob/master/CONTRIBUTING.md#testing)
- [x] added a changelog entry to `CHANGELOG.md`
- [ ] included comments for [documenting Go code](https://blog.golang.org/godoc)
- [ ] updated the relevant documentation or specification
- [ ] reviewed "Files changed" and left comments if necessary
- [x] confirmed all CI checks have passed

### Reviewers Checklist

*All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.*

I have...

- [ ] confirmed the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title
- [ ] confirmed `!` in the type prefix if API or client breaking change
- [ ] confirmed all author checklist items have been addressed
- [ ] reviewed state machine logic
- [ ] reviewed API design and naming
- [ ] reviewed documentation is accurate
- [ ] reviewed tests and test coverage
- [ ] manually tested (if applicable)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/new-feature Propose the addition of a new feature that does not yet exist x/subspaces Issue on the x/subspaces module
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants