This commit is contained in:
Lhcfl 2024-04-25 08:55:18 +08:00
parent 44ad4bce32
commit 42f6a6e3b6
4 changed files with 26 additions and 14 deletions

View file

@ -2233,4 +2233,4 @@ autocorrectNoteLanguage: "Show a warning if the post language does not match the
incorrectLanguageWarning: "It looks like your post is in {detected}, but you selected
{current}.\nWould you like to set the language to {detected} instead?"
noteEditHistory: "Post edit history"
foldNotification: "Collapse notifications of the same type"
foldNotification: "Group similar notifications"

View file

@ -2060,4 +2060,4 @@ autocorrectNoteLanguage: 当帖子语言不符合自动检测的结果的时候
incorrectLanguageWarning: "看上去您帖子使用的语言是{detected},但您选择的语言是{current}。\n要改为以{detected}发帖吗?"
noteEditHistory: "帖子编辑历史"
media: 媒体
foldNotification: "折叠同类型通知"
foldNotification: "将通知按同类型分组"

View file

@ -75,18 +75,30 @@ const stream = useStream();
const pagingComponent = ref<MkPaginationType<"i/notifications"> | null>(null);
const shouldFold = defaultStore.state.foldNotification;
const FETCH_LIMIT = 90;
const pagination = {
endpoint: "i/notifications" as const,
limit: FETCH_LIMIT,
secondFetchLimit: FETCH_LIMIT,
params: computed(() => ({
includeTypes: props.includeTypes ?? undefined,
excludeTypes: props.includeTypes ? undefined : me?.mutingNotificationTypes,
unreadOnly: props.unreadOnly,
})),
};
const pagination = Object.assign(
{
endpoint: "i/notifications" as const,
params: computed(() => ({
includeTypes: props.includeTypes ?? undefined,
excludeTypes: props.includeTypes
? undefined
: me?.mutingNotificationTypes,
unreadOnly: props.unreadOnly,
})),
},
shouldFold
? {
limit: FETCH_LIMIT,
secondFetchLimit: FETCH_LIMIT,
}
: {
limit: 30,
},
);
function isNoteNotification(
n: entities.Notification,
@ -123,7 +135,7 @@ const onNotification = (notification: entities.Notification) => {
let connection: StreamTypes.ChannelOf<"main"> | undefined;
function convertNotification(n: entities.Notification[]) {
if (defaultStore.state.foldNotification) {
if (shouldFold) {
return foldNotifications(n, FETCH_LIMIT);
} else {
return n;

View file

@ -451,7 +451,7 @@ export const defaultStore = markRaw(
default: true,
},
foldNotification: {
where: "device",
where: "deviceAccount",
default: false,
},
}),