mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-03-05 12:01:17 +01:00
closes #1986
This commit is contained in:
@@ -80,6 +80,9 @@ var async = require('async'),
|
||||
break;
|
||||
}
|
||||
|
||||
return next(null, notification);
|
||||
} else {
|
||||
notification.image = meta.config['brand:logo'] || nconf.get('relative_path') + '/logo.png';
|
||||
return next(null, notification);
|
||||
}
|
||||
|
||||
|
||||
@@ -126,6 +126,8 @@
|
||||
|
||||
require('../socket.io').emitUserCount();
|
||||
|
||||
user.notifications.sendWelcomeNotification(uid);
|
||||
|
||||
plugins.fireHook('filter:register.complete', uid, req.body.referrer, function(err, uid, destination) {
|
||||
if (destination) {
|
||||
res.redirect(nconf.get('relative_path') + destination);
|
||||
|
||||
@@ -8,6 +8,7 @@ var async = require('async'),
|
||||
user = require('../user'),
|
||||
utils = require('../../public/src/utils'),
|
||||
db = require('../database'),
|
||||
meta = require('../meta'),
|
||||
notifications = require('../notifications'),
|
||||
posts = require('../posts'),
|
||||
postTools = require('../postTools'),
|
||||
@@ -295,6 +296,25 @@ var async = require('async'),
|
||||
});
|
||||
};
|
||||
|
||||
UserNotifications.sendWelcomeNotification = function(uid) {
|
||||
if (!meta.config.welcomeNotification) {
|
||||
return;
|
||||
}
|
||||
|
||||
var path = meta.config.welcomeLink ? meta.config.welcomeLink : '#';
|
||||
|
||||
notifications.create({
|
||||
bodyShort: meta.config.welcomeNotification,
|
||||
bodyLong: meta.config.welcomeNotification,
|
||||
path: path,
|
||||
nid: 'welcome_' + uid
|
||||
}, function(err, notification) {
|
||||
if (!err && notification) {
|
||||
notifications.push(notification, [uid]);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
UserNotifications.pushCount = function(uid) {
|
||||
var websockets = require('./../socket.io');
|
||||
UserNotifications.getUnreadCount(uid, function(err, count) {
|
||||
|
||||
@@ -115,6 +115,7 @@
|
||||
<li><a href="{relative_path}/admin/settings/post">Post</a></li>
|
||||
<li><a href="{relative_path}/admin/settings/pagination">Pagination</a></li>
|
||||
<li><a href="{relative_path}/admin/settings/tags">Tags</a></li>
|
||||
<li><a href="{relative_path}/admin/settings/notifications">Notifications</a></li>
|
||||
<li><a href="{relative_path}/admin/settings/web-crawler">Web Crawler</a></li>
|
||||
<li><a href="{relative_path}/admin/settings/sockets">Sockets</a></li>
|
||||
<li><a href="{relative_path}/admin/settings/advanced">Advanced</a></li>
|
||||
|
||||
13
src/views/admin/settings/notifications.tpl
Normal file
13
src/views/admin/settings/notifications.tpl
Normal file
@@ -0,0 +1,13 @@
|
||||
<!-- IMPORT admin/settings/header.tpl -->
|
||||
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">Notifications</div>
|
||||
<div class="panel-body">
|
||||
<form>
|
||||
<strong>Welcome Notification</strong><br /> <textarea class="form-control" data-field="welcomeNotification"></textarea><br />
|
||||
<strong>Welcome Notification Link</strong><br /> <input type="text" class="form-control" data-field="welcomeLink"><br />
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- IMPORT admin/settings/footer.tpl -->
|
||||
Reference in New Issue
Block a user