Community Notification Standard

From Lorekeeper Wiki
Jump to navigation Jump to search

Lorekeeper's notification system makes use of many notification types-- one for each type of notification a user can receive. These are hard-coded as constants in the Notification model, with messages and associated information defined in the Notifications config file. That is, each notification type has a unique ID number which is stored in the database alongside the notification's data and which helps structure the notification using information from the config file. Given this, it's understandably important that overlap not occur in these IDs.

To account for this, the community has created a standard wherein base LK, as well as individual extension creators, are allotted a block of 100 numbers each in which to define notification IDs to ensure that no overlap occurs. The currently assigned blocks are as follows:

ID Block Assigned To
xx (0-99) Core Lorekeeper
1xx (100-199) Uri/Preimpression
2xx Ne-wt
3xx TGI
4xx Juni
5xx Mercury/itinerare
6xx Draginraptor
7xx DeeP-ci
8xx Wormbie
9xx AW0005
10xx AnimatedCritter
11xx CH3RVB
12xx SpeedyD
13xx Cylunny
14xx sunnsetcadett
15xx MarskyMessier
16xx perappu

Request an ID Block

To request an ID block for use in developing extensions, please reply here.

Reassigning Notification Type ID in the Database

If you created an extension prior to this standard, after reassigning IDs in the notification model and config file you may wish to move existing notifications in a site's database so as to prevent errors. This can be done with the use of the extension service found in versions 2.0.0 and later. An example command making use of this service can be found here, made for Character Items.

The key part is this:

(new ExtensionService)->updateNotifications(39, 501);
(new ExtensionService)->updateNotifications(40, 502);

In short, it calls the updateNotification function from the Extension service, once each for each notification type that needs reassigning within the database. The first parameter is the notification type ID to be reassigned, and the second is the ID it should be reassigned to. In this case, 39 becomes 501 and 40 becomes 502.