Document toolboxDocument toolbox

WikiPage Order Hints for Subpage Ordering

Problem

Users cannot choose the ordering of their wiki subpages. When a subpage is created, it is ordered alphabetically among its siblings in the wiki subpage tree. For example:

 

A                                                               A

     X                        ==>                                 X

     Z         (Y added with parent wiki A)          Y

B                                                                     Z

                                                                 B

 

Subsequently, some users have developed 'hacky' methods to fix the ordering of their subpages (e.g, prepending '0' to the title of a subpage that they want to be listed first).

Proposed Solution

Add an "order hint" column to the Wiki Owner table. This will store (as a comma separated list) the wiki IDs of a root wiki's children. More specifically, it would be used to capture the relative ordering of subpages in the wiki tree. A sub wiki with an ID that appears early in the order hint could be placed before a sibling sub wiki with an ID that appears later in the order hint. A few examples of how the above tree could be ordered with respect to their order hint:

(A, X, Y, Z, B)     (A, X, Z, Y, B)     (B, Z, X, A, Y)

   A                        A                          B

        X                        X                     A   

        Y                        Z                          Z

        Z                        Y                          X

   B                        B                               Y

Notice that only the relative order of siblings (not the parent-child relationships) are determined by the order hint.

Edge Cases

It is not the case that every wiki in a wiki tree needs to be in the order hint. If a wiki is in the tree and is not in the order hint, the default behavior will be to order them alphabetically after all wikis with position determined by the order hint. Here is an example of a succession of placements of sub wikis that are added to a tree without being placed in the order hint:

        (sub wikis added to root wiki)

(B, Z, X, A, Y)   (B, Z, X, A, Y)   (B, Z, X, A, Y)

B                       B                       B

A                       A                       A

   Z       ==>          Z       ==>          Z

   X       (D)           X       (C)           X

   Y                       Y                       Y

                         D                       C

                                                   D

The sub wikis that are not included in the order hint are (by default) ordered alphabetically after any sibling wikis that have position determined by the order hint. If a sub wiki is not in the tree but is in the order hint, then it simply will not need to be ordered. This allows sub wikis to be added/removed to the tree without having to update the order hint. Thus, the order hint would only need to be updated when the user wants to update the order of their sub wikis.

 

Implementation

DTO: The V2WikiOwner will have the following fields:

  • ownerId: The id of the wiki owner.
  • ownerTypeEnum: The owner object type.
  • etag: Because of the orderHint, the V2WikiOwner is now mutable.
  • rootWikiId: The ID of the root wiki.
  • orderHint: The order hint for this root wiki.

 

REST API

URLMethodRequest BodyResponse BodyDescriptionAuthority
/entity/{ownerId}/wiki2orderhintGETNoneStringGets the order hint for a specific wiki.Caller must be granted ACCESS_TYPE.READ permission on the owner.
/entity/{ownerId}/wiki2orderhintPUTStringStringUpdates the order hint for a specific wiki.Caller must be granted ACCESS_TYPE.UPDATE permission on the owner.