config people done

This commit is contained in:
Sukhamjot Singh 2022-10-20 20:55:31 +05:30
parent 9d19627006
commit c91bd393a7

View File

@ -3,7 +3,11 @@ const rs = require('rswebui');
const Reputation = () => {
let addFriendIdAsContacts = undefined;
let usePositiveDefault = undefined;
let deleteBannedAfter = undefined;
let negativeThreshold = undefined;
let positiveThreshold = undefined;
return {
oninit: (vnode) => {
rs.rsJsonApiRequest(
@ -11,17 +15,46 @@ const Reputation = () => {
{},
(data) => (addFriendIdAsContacts = data.retval)
);
rs.rsJsonApiRequest(
'/rsreputations/autoPositiveOpinionForContacts',
{},
(data) => (usePositiveDefault = data.retval)
);
rs.rsJsonApiRequest(
'/rsIdentity/deleteBannedNodesThreshold',
{},
(data) => (deleteBannedAfter = data.retval)
);
rs.rsJsonApiRequest(
'/rsreputations/thresholdForRemotelyPositiveReputation',
{},
(data) => (positiveThreshold = data.retval)
);
rs.rsJsonApiRequest(
'/rsreputations/thresholdForRemotelyNegativeReputation',
{},
(data) => (negativeThreshold = data.retval)
);
},
view: (vnode) =>
m('.widget', [
m('h3', 'Reputation'),
m('hr'),
m('.grid-2col', [
m('p', 'Use "positive" as the default opinion for contacts(instead of neutral):'),
m('input[type=checkbox]', {
checked: usePositiveDefault,
oninput: (e) => {
usePositiveDefault = e.target.checked;
rs.rsJsonApiRequest(
'/rsreputations/setAutoPositiveOpinionForContacts',
{
b: usePositiveDefault,
},
() => {}
);
},
}),
m('p', 'Automatically add identities owned by friend nodes to my contacts:'),
m('input[type=checkbox]', {
checked: addFriendIdAsContacts,
@ -36,6 +69,32 @@ const Reputation = () => {
);
},
}),
m('p', 'Difference in votes (+/-) to rate an ID positively:'),
m('input[type=number]', {
oninput: (e) => (positiveThreshold = e.target.value),
value: positiveThreshold,
onchange: () =>
rs.rsJsonApiRequest(
'/rsreputations/setThresholdForRemotelyPositiveReputation',
{
thresh: positiveThreshold,
},
() => {}
),
}),
m('p', 'Difference in votes (+/-) to rate an ID negatively:'),
m('input[type=number]', {
oninput: (e) => (negativeThreshold = e.target.value),
value: negativeThreshold,
onchange: () =>
rs.rsJsonApiRequest(
'/rsreputations/setThresholdForRemotelyNegativeReputation',
{
thresh: negativeThreshold,
},
() => {}
),
}),
m('p', 'Delete banned identities after(in days, 0 means indefinitely):'),
m('input[type=number]', {
oninput: (e) => (deleteBannedAfter = e.target.value),