Jump to content

Extension:Teahouse/Development

From mediawiki.org

This page serves as a public notebook for any kind of information (concepts, ideas, discussions,...) related to the further development.

Resourceloader Module dependencies

  • at init time
    • mediawiki.cookie, mediawiki.user (for mw.user.isAnon())
  • for the dialog
    • oojs-ui
  • for API calls of dialog
    • mediawiki.Title

Persistence Layer aka "The Board"

OOJS Class "Board":

  • publishQuestion( { title: "Why is ...", text: "I have ..." } )
    • API Call to create subpage of config.basePage, e.g. "Wikipedia:Teahouse/Board"
    • API Call to append/prepend config.basePage with config.template.wrapper
    • API Call to add subpage to watchlist (if registered user) or add title and publish timestamp to cookie (anon user)
    • returns jQuery Promise --> Dialog can loadmask itself, user can be notified on success/error
  • getPublishedQuestionsOfCurrentUser() (Bad function name! Find better!) - This is for the planned notification interface
    • Read-in cookie with list of questions / or find contributions of logged in user
    • API Call for each question (or as bulk) to determine current state (pending|answered)
    • returns array of questions (title, href) and their respective state
  • getSimilarQuestions - This is for the planned "similar questions" feature
    • API Call to search (fulltext)
    • Filtering by config.basePage-prefix
    • returns array of hits

Notifications

  • Stores a list of titles and timestamps
  • Checks the list entries timestamp against the current edit timestamp of the title (API Calls)
  • Notifies user if newer change
  • Resets the timestamp on visit
  • register( title, timestamp )
  • getNotificationList()
  • markAsRead( title )

Dialog

  • Subclass of OO.ui.ProcessDialog
  • Injection of data object in windowManager.openWindow
    • Info: Is user anon? --> display "IP will be saved"-Hint
    • "The Board": callback for save process OR OO.EventEmitter capabilities of OO.ui.ProcessDialog?

Issues

  • Dialog window is created at the foot of the page. On long pages this is bad.
  • API edit returns "DB error" when appending signature (--~~~~) to question text