更改获取通知的方式

master
落雨楓 10 months ago
parent 51c361300f
commit 9aad5ec459

@ -17,10 +17,11 @@ class ApiUserQuestsGetNotification extends ApiBase {
$this->dieWithError('apierror-mustbeloggedin-generic', 'login-required');
}
$sesssionManager = SessionManager::getGlobalSession();
if ($sesssionManager->exists(QuestsUtils::SESSION_KEY_QUEST_COMPLETE_NOTIFICATION)) {
$notificationData = $sesssionManager->get(QuestsUtils::SESSION_KEY_QUEST_COMPLETE_NOTIFICATION);
$sessionManager = SessionManager::getGlobalSession();
if ($sessionManager->exists(QuestsUtils::SESSION_KEY_QUEST_COMPLETE_NOTIFICATION)) {
$notificationData = $sessionManager->get(QuestsUtils::SESSION_KEY_QUEST_COMPLETE_NOTIFICATION);
$this->getResult()->addValue(['userquestsgetnotification'], 'notification', $notificationData);
$sessionManager->remove(QuestsUtils::SESSION_KEY_QUEST_COMPLETE_NOTIFICATION);
} else {
$this->getResult()->addValue(['userquestsgetnotification'], 'notification', null);
}

@ -67,5 +67,13 @@ class Hooks {
public static function onBeforePageDisplay(OutputPage $out, $skin) {
$out->addModules(['ext.isekai.userpoints.quests.notification']);
$sessionManager = SessionManager::getGlobalSession();
if ($sessionManager->exists(QuestsUtils::SESSION_KEY_QUEST_COMPLETE_NOTIFICATION)) {
$out->addJsConfigVars([
'wgIsekaiQuestsCompleteNotification' => $sessionManager->get(QuestsUtils::SESSION_KEY_QUEST_COMPLETE_NOTIFICATION),
]);
$sessionManager->remove(QuestsUtils::SESSION_KEY_QUEST_COMPLETE_NOTIFICATION);
}
}
}

Loading…
Cancel
Save