Difference between revisions of "Community Notification Standard"

From Lorekeeper Wiki
Jump to navigation Jump to search
m (Protected "Community Notification Standard": High traffic page ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite)))
(No difference)

Revision as of 07:51, 27 March 2021

Lorekeeper's notification system makes use of myriad 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
2xx Newt
3xx TGI
4xx Juni
5xx Mercury
6xx Draginraptor

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 the modified-main version of Lorekeeper. An example command making use of this service can be found here, made for Extensions: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.