Litmus:Extension/Notification

From MozillaWiki
Jump to: navigation, search

Overview

One of the QA Extension's major features is the ability to send notifications to users for testdays, bugdays, pre-release testing, qa news, special announcements, and other things we want to bring to the attention of our testing community. These notifications are displayed in a small notification box in the user's browser, similar to the way the Joga Companion displayed soccer match notifications. By default, few notifications will be enabled, but users may set their notification preferences from the settings tab.

Architecture

Hermes is the name of the notification server: a small web application that aggregates notification sources and generates an xml document to be sent to clients on request. This xml document contains all notifications from the last 10 days. From time to time (every 90 minutes currently), the client requests the notification document, converts the xml into Notification javascript objects, and stores the notifications in a mozstorage (sqlite) database.

The database is then read for any undisplayed notifications, and only one notification will be displayed each 90 minutes, with a maximum of two each day (except for news if the user has turned this setting on). Older notifications will be skipped as needed.

Dates and Times

All timestamps shall be in ISO 8601 form -- 'YYYY-MM-DDThh:mm:ssZ' -- or with a [+-]HH:MM time zone designation, as understood by MochiKit.DateTime.

Notification classes and types

Each notification has a class ('event' or 'announce') and a type:

  • 'event' class
    • testday
    • bugday
    • special
  • 'announce' class
    • news
    • prerelease
    • newbuilds
    • special

These types correspond to user settings to enable and disable various types of notifications.

Notification Display

Notifications will be displayed according to user preferences and the following rules:

  • Events -
    • eventAdvanceNotificationDays in advance of the event (5 days?)
    • When the event is begining
  • Announcements -
    • When a previously unseen notification id is received

Security

Does https need to be used? The extension obviously runs with chrome privs, so a malicious notification document could be used to compromise the browser unless sanitized properly by the client.


Example notification document

<notifications>
  <notification
      class="event"
      type="testday"
      id="3ad65570-bd22-4add-8e99-c7c329f84b19"> [can also be numeric, doesn't matter as long as it's unique]
    <headline>Firefox Alpha 6 Testday</headline>
    <eventinfo> [for class="event"]
      <datetime>2007-06-28T17:44:06Z</datetime>
      <place>irc.mozilla.org, #testday</place> [optional]
    </eventinfo>
    <infotext>Come join us for the...</infotext>
    <infolink href="http://example.com">Click here to learn more</infolink>
    <golink href="http://example.com/2">Click here to get started now</golink>
  </notification>
    [more notifications as needed...]
</notifications>