Notification: Set a new Friendship and Accepted Friendship
This commit is contained in:
@@ -378,15 +378,16 @@ router.patch('/:id', authenticate, (req, res) => {
|
||||
});
|
||||
|
||||
router.post('/profile', authenticate, (req, res) => {
|
||||
const usernameOrig = req.user.username;
|
||||
const username = req.body['username'];
|
||||
const idapp = req.body.idapp;
|
||||
const locale = req.body.locale;
|
||||
const idnotif = req.body['idnotif'] ? req.body['idnotif'] : '';
|
||||
|
||||
//++Todo: controlla che tipo di dati ha il permesso di leggere
|
||||
|
||||
// Check if ìs a Notif to read
|
||||
SendNotif.setNotifAsRead(idapp, username, idnotif);
|
||||
const idnotif = req.body['idnotif'] ? req.body['idnotif'] : '';
|
||||
SendNotif.setNotifAsRead(idapp, usernameOrig, idnotif);
|
||||
|
||||
try {
|
||||
return User.getUserProfileByUsername(idapp, username, req.user.username,
|
||||
@@ -457,8 +458,10 @@ router.post('/notifs', authenticate, async (req, res) => {
|
||||
if (tools.isArray(notifs) && notifs.length >= 0) {
|
||||
myuser.profile.notifs = notifs;
|
||||
myuser.save();
|
||||
return res.send({code: server_constants.RIS_CODE_OK, msg: ''});
|
||||
}
|
||||
}
|
||||
return res.send({code: server_constants.RIS_CODE_OK, msg: ''});
|
||||
} catch (e) {
|
||||
tools.mylogserr('Error profile: ', e);
|
||||
res.status(400).send();
|
||||
@@ -577,7 +580,7 @@ router.post('/setperm', authenticate, (req, res) => {
|
||||
const body = _.pick(req.body, ['idapp', 'username', 'perm']);
|
||||
tools.mylog('SETPERM = ' + req.token);
|
||||
|
||||
User.setPermissionsById(res.user._id, body).then(() => {
|
||||
User.setPermissionsById(req.user._id, body).then(() => {
|
||||
res.status(200).send();
|
||||
}, () => {
|
||||
res.status(400).send();
|
||||
|
||||
Reference in New Issue
Block a user