Commit 540f9c84 authored by Jonathan Porta's avatar Jonathan Porta
Browse files

Trying everything to get votes to work...

parent c8f6e94d
......@@ -24,7 +24,7 @@
"license": "MIT",
"dependencies": {
"@steem/crypto-session": "git+https://github.com/steemit/crypto-session.git#83a90b319ce5bc6a70362d52a15a815de7e729bb",
"@steemit/steem-js": "git+https://github.com/steemit/steem-js.git#791c7930a952415a0ee45855142e52ee0c657f8e",
"@steemit/steem-js": "git+https://github.com/steemit/steem-js.git#1615e280b3a6daab43a818ec2f47cd6d8bbaefd1",
"assert": "1.4.1",
"autoprefixer-loader": "3.2.0",
"babel-cli": "6.26.0",
......@@ -125,7 +125,7 @@
"sequelize": "3.33.0",
"sequelize-cli": "3.2.0",
"speakingurl": "9.0.0",
"sqlite3": "4.0.1",
"sqlite3": "4.0.9",
"statsd-client": "0.4.2",
"steemscript": "1.1.0",
"store": "1.3.20",
......@@ -192,6 +192,7 @@
]
},
"jest": {
"testURL": "http://localhost/",
"rootDir": "src",
"modulePaths": [
"<rootDir>/"
......
......@@ -41,14 +41,15 @@ class SteemProposalSystem extends React.Component {
listVoterProposals: PropTypes.func,
removeProposal: PropTypes.func,
updateProposalVotes: PropTypes.func,
createProposal: PropTypes.func,
};
constructor() {
super();
this.state = {
currentPage: 1,
last_id: null,
limit: 11,
limitPerPage: 10,
limit: 100,
limitPerPage: 100,
status: 'all',
selectedSorter: 'ascending',
};
......@@ -379,16 +380,28 @@ class SteemProposalSystem extends React.Component {
}
render() {
const { proposals } = this.props;
const { proposals, createProposal, currentUser } = this.props;
// this.props.createProposal()
// TODO: implement loading indicator
// if (loading) return <span>Loading...</span>;
console.log('render', currentUser);
return (
<div className="SteemProposalSystem">
<div className="row">
<div className="column">
<h2>{tt('steem_proposal_system_jsx.top_sps')}</h2>
<h2>
{tt('steem_proposal_system_jsx.top_sps')}
<button
className="UserWallet__buysp button hollow"
onClick={() =>
createProposal(currentUser, currentUser)
}
>
Create Proposal
</button>
</h2>
{this.renderProposalTable(proposals)}
</div>
</div>
......@@ -401,6 +414,7 @@ module.exports = {
path: 'steem_proposal_system',
component: connect(
state => {
console.log('state.proposal', state.proposal.toJS());
const user = state.user.get('current');
const currentUser = user && user.get('username');
const proposals = state.proposal.get('proposals', List());
......@@ -414,6 +428,7 @@ module.exports = {
`transaction_proposal_vote_active_${currentUser}`,
List()
);
return {
currentUser,
proposals: newProposals,
......@@ -422,66 +437,121 @@ module.exports = {
votesInProgress,
};
},
dispatch => ({
updateProposalVotes: (voter, proposal_ids, approve) => {
dispatch => {
const successCallback = () => {
console.log('successCallback', arguments);
dispatch(
transactionActions.broadcastOperation({
type: 'update_proposal_votes',
operation: { voter, proposal_ids, approve },
proposalActions.listProposals({
start: '',
limit: 1000,
order_by: 'by_creator',
order_direction: 'ascending',
status: 'all',
})
);
},
removeProposal: (proposal_owner, proposal_ids) => {
dispatch(
transactionActions.broadcastOperation({
type: 'remove_proposal',
operation: { proposal_owner, proposal_ids },
confirm: tt(
'steem_proposal_system_jsx.confirm_remove_proposal_description'
),
successCallback: () => {
dispatch(
proposalActions.listProposals({
start: '',
limit: 11,
order_by: 'by_creator',
order_direction: 'ascending',
status: 'all',
})
);
dispatch(
proposalActions.listVoterProposals({
start: proposal_owner,
limit: 1000,
order_by: 'by_creator',
order_direction: 'ascending',
status: 'all',
})
);
},
proposalActions.listVoterProposals({
start: proposal_owner,
limit: 1000,
order_by: 'by_creator',
order_direction: 'ascending',
status: 'all',
})
);
},
listProposals: payload =>
new Promise((resolve, reject) => {
};
const errorCallback = () => {
console.log('errorCallback', arguments);
// dispatch(
// proposalActions.listProposals({
// start: '',
// limit: 11,
// order_by: 'by_creator',
// order_direction: 'ascending',
// status: 'all',
// })
// );
// dispatch(
// proposalActions.listVoterProposals({
// start: proposal_owner,
// limit: 1000,
// order_by: 'by_creator',
// order_direction: 'ascending',
// status: 'all',
// })
// );
};
return {
updateProposalVotes: (voter, proposal_ids, approve) => {
dispatch(
proposalActions.listProposals({
...payload,
resolve,
reject,
transactionActions.broadcastOperation({
type: 'update_proposal_votes',
operation: { voter, proposal_ids, approve },
successCallback,
errorCallback: errorCallback,
})
);
}),
listVoterProposals: payload =>
new Promise((resolve, reject) => {
},
createProposal: (
creator,
receiver,
start_date,
end_date,
daily_pay,
subject,
permlink
) => {
console.log('create_proposal', arguments);
dispatch(
proposalActions.listVoterProposals({
...payload,
resolve,
reject,
transactionActions.broadcastOperation({
type: 'create_proposal',
operation: {
creator: creator,
receiver: receiver,
start_date: '2019-07-20T11:22:39',
end_date: '2019-08-30T11:22:39',
daily_pay: '3000.000 TBD',
subject: 'Test Proposal',
permlink: 'remove-delegations',
},
successCallback,
errorCallback: errorCallback,
})
);
}),
})
},
removeProposal: (proposal_owner, proposal_ids) => {
dispatch(
transactionActions.broadcastOperation({
type: 'remove_proposal',
operation: { proposal_owner, proposal_ids },
confirm: tt(
'steem_proposal_system_jsx.confirm_remove_proposal_description'
),
successCallback,
errorCallback: errorCallback,
})
);
},
listProposals: payload =>
new Promise((resolve, reject) => {
dispatch(
proposalActions.listProposals({
...payload,
resolve,
reject,
})
);
}),
listVoterProposals: payload =>
new Promise((resolve, reject) => {
dispatch(
proposalActions.listVoterProposals({
...payload,
resolve,
reject,
})
);
}),
};
}
)(SteemProposalSystem),
};
......@@ -3,11 +3,11 @@
module.exports = {
up: function(queryInterface, Sequelize) {
queryInterface.addColumn('users', 'waiting_list', Sequelize.BOOLEAN);
queryInterface.addColumn('users', 'remote_ip', Sequelize.STRING);
return queryInterface.addColumn('users', 'remote_ip', Sequelize.STRING);
},
down: function(queryInterface, Sequelize) {
queryInterface.removeColumn('users', 'waiting_list');
queryInterface.removeColumn('users', 'remote_ip');
return queryInterface.removeColumn('users', 'remote_ip');
},
};
......@@ -10,7 +10,7 @@ module.exports = {
queryInterface.addColumn('users', 'sign_up_meta', {
type: Sequelize.TEXT,
});
queryInterface.addColumn('accounts', 'created', {
return queryInterface.addColumn('accounts', 'created', {
type: Sequelize.BOOLEAN,
});
},
......
......@@ -3,7 +3,7 @@
module.exports = {
up: function(queryInterface, Sequelize) {
queryInterface.removeIndex('accounts', ['name']);
queryInterface.addIndex('accounts', ['name']);
return queryInterface.addIndex('accounts', ['name']);
},
down: function(queryInterface, Sequelize) {},
......
......@@ -2,10 +2,14 @@
module.exports = {
up: function(queryInterface, Sequelize) {
queryInterface.addColumn('users', 'creation_hash', Sequelize.STRING);
return queryInterface.addColumn(
'users',
'creation_hash',
Sequelize.STRING
);
},
down: function(queryInterface, Sequelize) {
queryInterface.removeColumn('users', 'creation_hash');
return queryInterface.removeColumn('users', 'creation_hash');
},
};
......@@ -33,7 +33,7 @@ db.Sequelize = Sequelize;
if (env === 'development') {
// in dev, sync all table schema automatically for convenience
// sequelize.sync();
sequelize.sync();
}
function esc(value, max_length = 256) {
......
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment