mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-01 05:29:20 +03:00
Changes for #796
This commit is contained in:
parent
228fefc121
commit
ad45bcf2cf
46 changed files with 97 additions and 81 deletions
|
|
@ -44,7 +44,7 @@ export class UserSettingsGeneral extends AbstractViewSettings {
|
|||
['layout', 'messageReadDelay', 'messagesPerPage',
|
||||
'editorDefaultType', 'requestReadReceipt', 'requestDsn', 'pgpSign', 'pgpEncrypt',
|
||||
'viewHTML', 'showImages', 'removeColors', 'hideDeleted', 'listInlineAttachments', 'simpleAttachmentsList',
|
||||
'useCheckboxesInList', 'listPerDay', 'useThreads', 'replySameFolder', 'msgDefaultAction', 'allowSpellcheck'
|
||||
'useCheckboxesInList', 'listGrouped', 'useThreads', 'replySameFolder', 'msgDefaultAction', 'allowSpellcheck'
|
||||
].forEach(name => this[name] = SettingsUserStore[name]);
|
||||
|
||||
this.allowLanguagesOnSettings = !!SettingsGet('AllowLanguagesOnSettings');
|
||||
|
|
@ -99,7 +99,7 @@ export class UserSettingsGeneral extends AbstractViewSettings {
|
|||
this.addSetting('Layout');
|
||||
|
||||
this.addSettings(['ViewHTML', 'ShowImages', 'HideDeleted', 'ListInlineAttachments', 'simpleAttachmentsList',
|
||||
'UseCheckboxesInList', 'listPerDay', 'ReplySameFolder',
|
||||
'UseCheckboxesInList', 'listGrouped', 'ReplySameFolder',
|
||||
'requestReadReceipt', 'requestDsn', 'pgpSign', 'pgpEncrypt', 'allowSpellcheck',
|
||||
'DesktopNotifications', 'SoundNotification']);
|
||||
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ export const SettingsUserStore = new class {
|
|||
listInlineAttachments: 0,
|
||||
simpleAttachmentsList: 0,
|
||||
useCheckboxesInList: 1,
|
||||
listPerDay: 0,
|
||||
listGrouped: 0,
|
||||
allowDraftAutosave: 1,
|
||||
useThreads: 0,
|
||||
replySameFolder: 0,
|
||||
|
|
@ -85,7 +85,7 @@ export const SettingsUserStore = new class {
|
|||
self.listInlineAttachments(SettingsGet('ListInlineAttachments'));
|
||||
self.simpleAttachmentsList(SettingsGet('simpleAttachmentsList'));
|
||||
self.useCheckboxesInList(SettingsGet('UseCheckboxesInList'));
|
||||
self.listPerDay(SettingsGet('listPerDay'));
|
||||
self.listGrouped(SettingsGet('listGrouped'));
|
||||
self.allowDraftAutosave(SettingsGet('AllowDraftAutosave'));
|
||||
self.useThreads(SettingsGet('UseThreads'));
|
||||
self.replySameFolder(SettingsGet('ReplySameFolder'));
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ html.rl-no-preview-pane {
|
|||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
.day {
|
||||
.groupLabel {
|
||||
background:rgba(128,128,128,0.2);
|
||||
font-size: 12px;
|
||||
line-height: 2;
|
||||
|
|
|
|||
|
|
@ -146,40 +146,56 @@ export class MailMessageList extends AbstractViewRight {
|
|||
|
||||
mobileCheckedStateHide: () => ThemeStore.isMobile() ? !MessagelistUserStore.hasChecked() : 1,
|
||||
|
||||
listPerDay: () => {
|
||||
listGrouped: () => {
|
||||
let uid = MessagelistUserStore.threadUid(),
|
||||
sort = FolderUserStore.sortMode() || 'DATE';
|
||||
return SettingsUserStore.listPerDay() && 'DATE' == sort && !uid;
|
||||
return SettingsUserStore.listGrouped() && (sort.includes('DATE') || sort.includes('FROM')) && !uid;
|
||||
},
|
||||
|
||||
listByDay: () => {
|
||||
let list = [], current, today = Ymd(new Date()),
|
||||
rtf = Intl.RelativeTimeFormat
|
||||
? new Intl.RelativeTimeFormat(doc.documentElement.lang, { numeric: "auto" }) : 0;
|
||||
MessagelistUserStore.forEach(msg => {
|
||||
let date = (new Date(msg.dateTimeStampInUTC() * 1000)),
|
||||
ymd = Ymd(date);
|
||||
if (!current || ymd != current.ymd) {
|
||||
if (rtf && today == ymd) {
|
||||
date = rtf.format(0, 'day');
|
||||
} else if (rtf && today - 1 == ymd) {
|
||||
date = rtf.format(-1, 'day');
|
||||
// } else if (today - 7 < ymd) {
|
||||
// date = date.format({weekday: 'long'});
|
||||
// date = date.format({dateStyle: 'full'},0,LanguageStore.hourCycle());
|
||||
} else {
|
||||
// date = date.format({dateStyle: 'medium'},0,LanguageStore.hourCycle());
|
||||
date = date.format({dateStyle: 'full'},0,LanguageStore.hourCycle());
|
||||
groupedList: () => {
|
||||
let list = [], current, sort = FolderUserStore.sortMode() || 'DATE';
|
||||
if (sort.includes('DATE')) {
|
||||
let today = Ymd(new Date()),
|
||||
rtf = Intl.RelativeTimeFormat
|
||||
? new Intl.RelativeTimeFormat(doc.documentElement.lang, { numeric: "auto" }) : 0;
|
||||
MessagelistUserStore.forEach(msg => {
|
||||
let date = (new Date(msg.dateTimeStampInUTC() * 1000)),
|
||||
ymd = Ymd(date);
|
||||
if (!current || ymd != current.id) {
|
||||
if (rtf && today == ymd) {
|
||||
date = rtf.format(0, 'day');
|
||||
} else if (rtf && today - 1 == ymd) {
|
||||
date = rtf.format(-1, 'day');
|
||||
// } else if (today - 7 < ymd) {
|
||||
// date = date.format({weekday: 'long'});
|
||||
// date = date.format({dateStyle: 'full'},0,LanguageStore.hourCycle());
|
||||
} else {
|
||||
// date = date.format({dateStyle: 'medium'},0,LanguageStore.hourCycle());
|
||||
date = date.format({dateStyle: 'full'},0,LanguageStore.hourCycle());
|
||||
}
|
||||
current = {
|
||||
id: ymd,
|
||||
label: date,
|
||||
messages: []
|
||||
};
|
||||
list.push(current);
|
||||
}
|
||||
current = {
|
||||
ymd: ymd,
|
||||
day: date,
|
||||
messages: []
|
||||
};
|
||||
list.push(current);
|
||||
}
|
||||
current.messages.push(msg);
|
||||
});
|
||||
current.messages.push(msg);
|
||||
});
|
||||
} else if (sort.includes('FROM')) {
|
||||
MessagelistUserStore.forEach(msg => {
|
||||
let email = msg.from[0].email;
|
||||
if (!current || email != current.id) {
|
||||
current = {
|
||||
id: email,
|
||||
label: msg.from[0].toLine(),
|
||||
messages: []
|
||||
};
|
||||
list.push(current);
|
||||
}
|
||||
current.messages.push(msg);
|
||||
});
|
||||
}
|
||||
return list;
|
||||
},
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue