mirror of
https://github.com/RetroShare/RSNewWebUI.git
synced 2026-09-12 19:50:04 +05:00
accommodate API changes
This commit is contained in:
parent
c91bd393a7
commit
13d5cc0c0f
@ -161,10 +161,9 @@ const Layout = () => {
|
||||
}
|
||||
}
|
||||
}
|
||||
console.log(subject);
|
||||
const res = await rs.rsJsonApiRequest('/rsMsgs/sendMail', {
|
||||
from: identity,
|
||||
subject: subject,
|
||||
subject,
|
||||
mailBody: body,
|
||||
to: toList,
|
||||
cc: ccList,
|
||||
|
||||
@ -20,7 +20,7 @@ const Messages = {
|
||||
todo: [],
|
||||
later: [],
|
||||
load() {
|
||||
rs.rsJsonApiRequest('/rsMsgs/getMessageSummaries', {}, (data) => {
|
||||
rs.rsJsonApiRequest('/rsMsgs/getMessageSummaries', { box: util.BOX_ALL }, (data) => {
|
||||
Messages.all = data.msgList;
|
||||
Messages.inbox = Messages.all.filter(
|
||||
(msg) => (msg.msgflags & util.RS_MSG_BOXMASK) === util.RS_MSG_INBOX
|
||||
@ -34,33 +34,17 @@ const Messages = {
|
||||
Messages.drafts = Messages.all.filter(
|
||||
(msg) => (msg.msgflags & util.RS_MSG_BOXMASK) === util.RS_MSG_DRAFTBOX
|
||||
);
|
||||
Messages.trash = Messages.all.filter(
|
||||
(msg) => (msg.msgflags & util.RS_MSG_TRASH)
|
||||
);
|
||||
Messages.starred = Messages.all.filter(
|
||||
(msg) => (msg.msgflags & util.RS_MSG_STAR)
|
||||
);
|
||||
Messages.system = Messages.all.filter(
|
||||
(msg) => (msg.msgflags & util.RS_MSG_SYSTEM)
|
||||
);
|
||||
Messages.spam = Messages.all.filter(
|
||||
(msg) => (msg.msgflags & util.RS_MSG_SPAM)
|
||||
);
|
||||
Messages.trash = Messages.all.filter((msg) => msg.msgflags & util.RS_MSG_TRASH);
|
||||
Messages.starred = Messages.all.filter((msg) => msg.msgflags & util.RS_MSG_STAR);
|
||||
Messages.system = Messages.all.filter((msg) => msg.msgflags & util.RS_MSG_SYSTEM);
|
||||
Messages.spam = Messages.all.filter((msg) => msg.msgflags & util.RS_MSG_SPAM);
|
||||
Messages.important = Messages.all.filter(
|
||||
(msg) => (msg.msgflags & util.RS_MSGTAGTYPE_IMPORTANT)
|
||||
);
|
||||
Messages.work = Messages.all.filter(
|
||||
(msg) => (msg.msgflags & util.RS_MSGTAGTYPE_WORK)
|
||||
);
|
||||
Messages.personal = Messages.all.filter(
|
||||
(msg) => (msg.msgflags & util.RS_MSGTAGTYPE_PERSONAL)
|
||||
);
|
||||
Messages.todo = Messages.all.filter(
|
||||
(msg) => (msg.msgflags & util.RS_MSGTAGTYPE_TODO)
|
||||
);
|
||||
Messages.later = Messages.all.filter(
|
||||
(msg) => (msg.msgflags & util.RS_MSGTAGTYPE_LATER)
|
||||
);
|
||||
(msg) => msg.msgflags & util.RS_MSGTAGTYPE_IMPORTANT
|
||||
);
|
||||
Messages.work = Messages.all.filter((msg) => msg.msgflags & util.RS_MSGTAGTYPE_WORK);
|
||||
Messages.personal = Messages.all.filter((msg) => msg.msgflags & util.RS_MSGTAGTYPE_PERSONAL);
|
||||
Messages.todo = Messages.all.filter((msg) => msg.msgflags & util.RS_MSGTAGTYPE_TODO);
|
||||
Messages.later = Messages.all.filter((msg) => msg.msgflags & util.RS_MSGTAGTYPE_LATER);
|
||||
});
|
||||
},
|
||||
};
|
||||
@ -81,26 +65,34 @@ const sectionsquickview = {
|
||||
todo: require('mail/mail_todo'),
|
||||
later: require('mail/mail_later'),
|
||||
personal: require('mail/mail_personal'),
|
||||
|
||||
};
|
||||
const tagselect = {
|
||||
showval: 'Tags',
|
||||
opts: ['Tags', 'Important', 'Work', 'Personal']
|
||||
opts: ['Tags', 'Important', 'Work', 'Personal'],
|
||||
};
|
||||
const Layout = {
|
||||
oninit: Messages.load,
|
||||
view: (vnode) =>
|
||||
|
||||
m('.tab-page', [
|
||||
m('button[id=composebtn]', { onclick: () => { util.popupMessageCompose(m(compose)); } }, 'Compose'),
|
||||
m('select[id=tags]', {
|
||||
value: tagselect.showval,
|
||||
onchange: (e) => {
|
||||
tagselect.showval = tagselect.opts[e.target.selectedIndex];
|
||||
}
|
||||
}, [
|
||||
tagselect.opts.map((o) => m('option', { value: o }, o.toLocaleString()))
|
||||
]),
|
||||
m(
|
||||
'button[id=composebtn]',
|
||||
{
|
||||
onclick: () => {
|
||||
util.popupMessageCompose(m(compose));
|
||||
},
|
||||
},
|
||||
'Compose'
|
||||
),
|
||||
m(
|
||||
'select[id=tags]',
|
||||
{
|
||||
value: tagselect.showval,
|
||||
onchange: (e) => {
|
||||
tagselect.showval = tagselect.opts[e.target.selectedIndex];
|
||||
},
|
||||
},
|
||||
[tagselect.opts.map((o) => m('option', { value: o }, o.toLocaleString()))]
|
||||
),
|
||||
m(util.SearchBar, {
|
||||
list: {},
|
||||
}),
|
||||
@ -131,7 +123,7 @@ module.exports = {
|
||||
}
|
||||
return m(
|
||||
Layout,
|
||||
m((sections[tab]) || (sectionsquickview[tab]), {
|
||||
m(sections[tab] || sectionsquickview[tab], {
|
||||
list: Messages[tab].reverse(),
|
||||
})
|
||||
);
|
||||
|
||||
@ -2,6 +2,7 @@ const m = require('mithril');
|
||||
const rs = require('rswebui');
|
||||
const widget = require('widgets');
|
||||
|
||||
// rsmsgs.h
|
||||
const RS_MSG_BOXMASK = 0x000f;
|
||||
|
||||
const RS_MSG_INBOX = 0x00;
|
||||
@ -24,6 +25,8 @@ const RS_MSG_FRIEND_RECOMMENDATION = 0x000800;
|
||||
const RS_MSG_PUBLISH_KEY = 0x020000;
|
||||
const RS_MSG_SYSTEM = RS_MSG_USER_REQUEST | RS_MSG_FRIEND_RECOMMENDATION | RS_MSG_PUBLISH_KEY;
|
||||
|
||||
const BOX_ALL = 0x06;
|
||||
|
||||
const MessageSummary = () => {
|
||||
let details = {};
|
||||
let files = [];
|
||||
@ -48,11 +51,11 @@ const MessageSummary = () => {
|
||||
msgStatus = 'read';
|
||||
}
|
||||
}
|
||||
if (details && details.rsgxsid_srcId) {
|
||||
if (details && details.from && details.from._addr_string) {
|
||||
rs.rsJsonApiRequest(
|
||||
'/rsIdentity/getIdDetails',
|
||||
{
|
||||
id: details.rsgxsid_srcId,
|
||||
id: details.from._addr_string,
|
||||
},
|
||||
(data) => {
|
||||
fromUserInfo = data.details;
|
||||
@ -99,7 +102,8 @@ const MessageSummary = () => {
|
||||
),
|
||||
m('td', files.length),
|
||||
m('td', details.title),
|
||||
m('td', Number(details.rsgxsid_srcId) === 0 ? '[Unknown]' : fromUserInfo.mNickname),
|
||||
fromUserInfo &&
|
||||
m('td', Number(fromUserInfo.mId) === 0 ? '[Unknown]' : fromUserInfo.mNickname),
|
||||
m('td', new Date(details.ts * 1000).toLocaleString()),
|
||||
]
|
||||
),
|
||||
@ -292,4 +296,5 @@ module.exports = {
|
||||
RS_MSGTAGTYPE_PERSONAL,
|
||||
RS_MSGTAGTYPE_TODO,
|
||||
RS_MSGTAGTYPE_WORK,
|
||||
BOX_ALL,
|
||||
};
|
||||
|
||||
Loading…
Reference in New Issue
Block a user