mirror of
https://github.com/misskey-dev/misskey.git
synced 2024-12-11 08:32:47 +01:00
parent
a8cf67198f
commit
5d09b7e38b
6 changed files with 33 additions and 33 deletions
|
@ -24,7 +24,7 @@ export default Vue.extend({
|
||||||
const ok = window.confirm('%i18n:@read-all%');
|
const ok = window.confirm('%i18n:@read-all%');
|
||||||
if (!ok) return;
|
if (!ok) return;
|
||||||
|
|
||||||
(this as any).api('notifications/mark_as_read_all');
|
(this as any).api('notifications/mark_all_as_read');
|
||||||
},
|
},
|
||||||
onFetched() {
|
onFetched() {
|
||||||
Progress.done();
|
Progress.done();
|
||||||
|
|
|
@ -7,7 +7,7 @@ import { publishMessagingIndexStream } from '../../../stream';
|
||||||
import User from '../../../models/user';
|
import User from '../../../models/user';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mark as read message(s)
|
* Mark messages as read
|
||||||
*/
|
*/
|
||||||
export default (
|
export default (
|
||||||
user: string | mongo.ObjectID,
|
user: string | mongo.ObjectID,
|
||||||
|
@ -42,12 +42,12 @@ export default (
|
||||||
recipientId: userId,
|
recipientId: userId,
|
||||||
isRead: false
|
isRead: false
|
||||||
}, {
|
}, {
|
||||||
$set: {
|
$set: {
|
||||||
isRead: true
|
isRead: true
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
multi: true
|
multi: true
|
||||||
});
|
});
|
||||||
|
|
||||||
// Publish event
|
// Publish event
|
||||||
publishMessagingStream(otherpartyId, userId, 'read', ids.map(id => id.toString()));
|
publishMessagingStream(otherpartyId, userId, 'read', ids.map(id => id.toString()));
|
||||||
|
@ -59,8 +59,8 @@ export default (
|
||||||
recipientId: userId,
|
recipientId: userId,
|
||||||
isRead: false
|
isRead: false
|
||||||
}, {
|
}, {
|
||||||
limit: 1
|
limit: 1
|
||||||
});
|
});
|
||||||
|
|
||||||
if (count == 0) {
|
if (count == 0) {
|
||||||
// Update flag
|
// Update flag
|
||||||
|
|
|
@ -5,7 +5,7 @@ import Mute from '../../../models/mute';
|
||||||
import User from '../../../models/user';
|
import User from '../../../models/user';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mark as read notification(s)
|
* Mark notifications as read
|
||||||
*/
|
*/
|
||||||
export default (
|
export default (
|
||||||
user: string | mongo.ObjectID,
|
user: string | mongo.ObjectID,
|
||||||
|
@ -38,12 +38,12 @@ export default (
|
||||||
_id: { $in: ids },
|
_id: { $in: ids },
|
||||||
isRead: false
|
isRead: false
|
||||||
}, {
|
}, {
|
||||||
$set: {
|
$set: {
|
||||||
isRead: true
|
isRead: true
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
multi: true
|
multi: true
|
||||||
});
|
});
|
||||||
|
|
||||||
// Calc count of my unread notifications
|
// Calc count of my unread notifications
|
||||||
const count = await Notification
|
const count = await Notification
|
||||||
|
@ -54,8 +54,8 @@ export default (
|
||||||
},
|
},
|
||||||
isRead: false
|
isRead: false
|
||||||
}, {
|
}, {
|
||||||
limit: 1
|
limit: 1
|
||||||
});
|
});
|
||||||
|
|
||||||
if (count == 0) {
|
if (count == 0) {
|
||||||
// Update flag
|
// Update flag
|
||||||
|
|
|
@ -96,7 +96,7 @@ export default (params: any, user: ILocalUser) => new Promise(async (res, rej) =
|
||||||
// Serialize
|
// Serialize
|
||||||
res(await Promise.all(notifications.map(notification => pack(notification))));
|
res(await Promise.all(notifications.map(notification => pack(notification))));
|
||||||
|
|
||||||
// Mark as read all
|
// Mark all as read
|
||||||
if (notifications.length > 0 && markAsRead) {
|
if (notifications.length > 0 && markAsRead) {
|
||||||
read(user._id, notifications);
|
read(user._id, notifications);
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,10 +24,10 @@ export default (params: any, user: ILocalUser) => new Promise(async (res, rej) =
|
||||||
const recipient = await User.findOne({
|
const recipient = await User.findOne({
|
||||||
_id: recipientId
|
_id: recipientId
|
||||||
}, {
|
}, {
|
||||||
fields: {
|
fields: {
|
||||||
_id: true
|
_id: true
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (recipient === null) {
|
if (recipient === null) {
|
||||||
return rej('user not found');
|
return rej('user not found');
|
||||||
|
@ -96,7 +96,7 @@ export default (params: any, user: ILocalUser) => new Promise(async (res, rej) =
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mark as read all
|
// Mark all as read
|
||||||
if (markAsRead) {
|
if (markAsRead) {
|
||||||
read(user._id, recipient._id, messages);
|
read(user._id, recipient._id, messages);
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ import User, { ILocalUser } from '../../../../models/user';
|
||||||
export const meta = {
|
export const meta = {
|
||||||
desc: {
|
desc: {
|
||||||
ja: '全ての通知を既読にします。',
|
ja: '全ての通知を既読にします。',
|
||||||
en: 'Mark as read all notifications.'
|
en: 'Mark all notifications as read.'
|
||||||
},
|
},
|
||||||
|
|
||||||
requireCredential: true,
|
requireCredential: true,
|
||||||
|
@ -14,7 +14,7 @@ export const meta = {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mark as read all notifications
|
* Mark all notifications as read
|
||||||
*/
|
*/
|
||||||
export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
|
export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
|
||||||
// Update documents
|
// Update documents
|
||||||
|
@ -22,12 +22,12 @@ export default (params: any, user: ILocalUser) => new Promise(async (res, rej) =
|
||||||
notifieeId: user._id,
|
notifieeId: user._id,
|
||||||
isRead: false
|
isRead: false
|
||||||
}, {
|
}, {
|
||||||
$set: {
|
$set: {
|
||||||
isRead: true
|
isRead: true
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
multi: true
|
multi: true
|
||||||
});
|
});
|
||||||
|
|
||||||
// Response
|
// Response
|
||||||
res();
|
res();
|
Loading…
Reference in a new issue