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: simplify boards2 implementation #3115

Merged

Conversation

jeronimoalbi
Copy link
Member

Refactors the code copied from gno.land/r/demo/boards to simplify it and to have it ready before introducing the new features.

Also changed the expression to validate board names to check that the
name starts with three letters and ends with three numbers.

This has been defined this way to match `users` realm implementation.
See: gnolang#2827

In a next iteration we can support vanity names for boards, once vanity
names are supported for the `users` realm.
This change simplifies the code and allow removing some private
functions.

The changeset also have minor semantic changes to the existing code.
Asserts were moved to specific functions which also removes duplication.
@jeronimoalbi jeronimoalbi requested a review from ilgooz November 12, 2024 14:08
@jeronimoalbi jeronimoalbi self-assigned this Nov 12, 2024
@github-actions github-actions bot added the 🧾 package/realm Tag used for new Realms or Packages. label Nov 12, 2024
Copy link

codecov bot commented Nov 12, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 63.39%. Comparing base (1510a6f) to head (8c02d71).
Report is 1 commits behind head on devx/feature/boardsv2.

Additional details and impacted files
@@                  Coverage Diff                   @@
##           devx/feature/boardsv2    #3115   +/-   ##
======================================================
  Coverage                  63.39%   63.39%           
======================================================
  Files                        548      548           
  Lines                      81329    81329           
======================================================
+ Hits                       51555    51561    +6     
+ Misses                     26320    26316    -4     
+ Partials                    3454     3452    -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Board getter and ID incrementer were moved to `boards.gno` file.
Done to simplify realm code and remove redundancy.
The `DeletePost()` public function was confusing and in case of thread
it required an argument to be zero. The generic post concept should not
be exposed to users to keep the public realm API easy to understand.
This allows removing a lot of redundant code.
Returning "found" encourages users to check to avoid invalid memory
access and also follows a pattern already stablished in Gno packages
which is a good practice.
THis changeset removes the board url field and uses standard library
functions to generate the relative board URL instead of using a
hard-coded one.
@jeronimoalbi jeronimoalbi marked this pull request as ready for review November 13, 2024 14:45
@jeronimoalbi jeronimoalbi merged commit 4c7d16b into gnolang:devx/feature/boardsv2 Nov 13, 2024
40 of 55 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🧾 package/realm Tag used for new Realms or Packages.
Projects
Development

Successfully merging this pull request may close these issues.

1 participant