There is a bug in the notification system involving MoTD notifications. The MotDProvider:BuildNotificationList() function creates message tables that do not contain a secsSinceRequest key, which is the key that is used to sort the SortFilterList notifications:
Lua Code:
function ZO_GuildMotDProvider:BuildNotificationList()
...
table.insert(self.list,
{
dataType = NOTIFICATIONS_ALERT_DATA,
notificationType = NOTIFICATION_TYPE_GUILD_MOTD,
--=====================================================--
--== It should have this key, but it doesn't ==========--
--=====================================================--
--secsSinceRequest = ZO_NormalizeSecondsSince(0),
--=====================================================--
note = currentMotD,
message = message,
guildId = guildId,
shortDisplayText = guildName, })
end
end
end
end
Its the key used to sort the notification list:
Lua Code:
function ZO_NotificationList:CompareNotifications(listEntry1, listEntry2)
return ZO_TableOrderingFunction(listEntry1.data, listEntry2.data, "secsSinceRequest", ENTRY_SORT_KEYS, ZO_SORT_ORDER_DOWN)
end
While we are at it the table ordering function that gets called during the sort process should probably be updated to handle such mistakes
(it does not handle entries well when the sortKey does not exist). It could use some kind of check to ensure that the value1 & value2 are not nil & if so handle them properly.
Lua Code:
function ZO_TableOrderingFunction(entry1, entry2, sortKey, sortKeys, sortOrder)
-- If either of these values turn out nil because the sortKey does not exist
-- it messes up the entire sort.
local value1 = entry1[sortKey]
local value2 = entry2[sortKey]
local value1Type = type(value1)
local value2Type = type(value2)
-- Add a check to see if value2Type is nil
-- If value2Type and value1Type are both nil, use the tiebreaker
-- if only value2Type is nil, return true
if value2Type == "nil" then
if value1Type == value2Type then
local tiebreaker = sortKeys[sortKey].tiebreaker
return ZO_TableOrderingFunction(entry1, entry2, tiebreaker, sortKeys, nextSortOrder)
end
return true
end
-- if value2Type is not nil, but value1Type is, this check will handle that case:
if value1Type ~= value2Type or not validOrderingTypes[value1Type] then
return false
end
...
end