Skip to content

Addtional content when linking notes #44

@Fooooooooooox

Description

@Fooooooooooox

Right now, linkNote can be served to link notes for different purposes by assigning different linkTypes, but it's quite limited, cuz the linkType is bytes32 and can only be used to store a small amount of information. Imagine a scenario when you liked a bunch of posts on Xlog but you want to tag them with different bookmarks and organize them into different lists, the linkTypes alone won't be enough.
We got 2 options to improve this:

  1. add a linkNoteWithUri method in Web3Entry.sol.
  /**
   * @notice  linkNoteWithUri creates a link between a character and a note, and at the same 
              time attaches a uri to the link.
   * @param   vars The linkNoteData struct containing the following parameters:
   *      * fromCharacterId: The character id of the linker.
   *      * toCharacterId: The character id of the note owner.
   *      * toNoteId: The note id of the note to link.
   *      * linkType: The link type to use, for example, `LikeLinkType`.
   *      * data: The data input for link module, if any.
   * @param   uri The uri attached to the link, which can contain anything depending on how 
              you want to use it.
   */
function linkNoteWithUri(struct DataTypes.linkNoteData vars, string uri) external {}

This uri can be anything, we can put the tags we want in it.

  1. leave the existing interfaces unchanged, but upgrade Web3Entry.sol to distinguish between the Events of link and `linkTag'.
    When you want to link notes with tags, your linkNoteData might be like this:
{
  "fromCharacterId": ,
  "toCharacterId": ,
  "toNoteId": ,
  "linkType": "tag: bc's reading list",
  "data":
}

In order to make some differences with the emitted events so that indexer can easily tell if this is a normal link or a linkTag, Web3Entry would process the input data and when the linkType starts with "tag: " the linklistId in the emitted LinkNote event would be 0(normally the linklistId should be linker's linklist ID).

What do you think, Which one is better? 🤖

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions