Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
plugin
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
link33
plugin
Commits
47540288
Commit
47540288
authored
Jul 30, 2019
by
liuyuhang
Committed by
33cn
Aug 14, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add comment reply hash
parent
3436c30f
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
56 additions
and
154 deletions
+56
-154
proposal_rule.go
plugin/dapp/autonomy/commands/proposal_rule.go
+3
-3
rule.go
plugin/dapp/autonomy/executor/rule.go
+2
-1
rule_test.go
plugin/dapp/autonomy/executor/rule_test.go
+3
-3
ruleaction.go
plugin/dapp/autonomy/executor/ruleaction.go
+3
-3
ruleaction_test.go
plugin/dapp/autonomy/executor/ruleaction_test.go
+2
-2
rule.proto
plugin/dapp/autonomy/proto/rule.proto
+7
-5
autonomy.pb.go
plugin/dapp/autonomy/types/autonomy.pb.go
+0
-0
board.pb.go
plugin/dapp/autonomy/types/board.pb.go
+0
-0
lcommon.pb.go
plugin/dapp/autonomy/types/lcommon.pb.go
+36
-137
project.pb.go
plugin/dapp/autonomy/types/project.pb.go
+0
-0
rule.pb.go
plugin/dapp/autonomy/types/rule.pb.go
+0
-0
No files found.
plugin/dapp/autonomy/commands/proposal_rule.go
View file @
47540288
...
...
@@ -273,7 +273,7 @@ func CommentProposalCmd() *cobra.Command {
func
addCommentProposalflags
(
cmd
*
cobra
.
Command
)
{
cmd
.
Flags
()
.
StringP
(
"proposalID"
,
"p"
,
""
,
"proposal ID"
)
cmd
.
MarkFlagRequired
(
"proposalID"
)
cmd
.
Flags
()
.
StringP
(
"rep
Cmt
Hash"
,
"r"
,
""
,
"reply Comment hash"
)
cmd
.
Flags
()
.
StringP
(
"repHash"
,
"r"
,
""
,
"reply Comment hash"
)
cmd
.
Flags
()
.
StringP
(
"comment"
,
"c"
,
""
,
"comment"
)
cmd
.
MarkFlagRequired
(
"comment"
)
}
...
...
@@ -281,12 +281,12 @@ func addCommentProposalflags(cmd *cobra.Command) {
func
commentProposal
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
rpcLaddr
,
_
:=
cmd
.
Flags
()
.
GetString
(
"rpc_laddr"
)
proposalID
,
_
:=
cmd
.
Flags
()
.
GetString
(
"proposalID"
)
rep
CmtHash
,
_
:=
cmd
.
Flags
()
.
GetString
(
"repCmt
Hash"
)
rep
Hash
,
_
:=
cmd
.
Flags
()
.
GetString
(
"rep
Hash"
)
comment
,
_
:=
cmd
.
Flags
()
.
GetString
(
"comment"
)
params
:=
&
auty
.
Comment
{
ProposalID
:
proposalID
,
Rep
CmtHash
:
repCmt
Hash
,
Rep
Hash
:
rep
Hash
,
Comment
:
comment
,
}
var
res
string
...
...
plugin/dapp/autonomy/executor/rule.go
View file @
47540288
...
...
@@ -174,10 +174,11 @@ func saveCommentHeightIndex(res *auty.ReceiptProposalComment) (kvs []*types.KeyV
kv
:=
&
types
.
KeyValue
{}
kv
.
Key
=
calcCommentHeight
(
res
.
Cmt
.
ProposalID
,
dapp
.
HeightIndexStr
(
res
.
Height
,
int64
(
res
.
Index
)))
kv
.
Value
=
types
.
Encode
(
&
auty
.
RelationCmt
{
Rep
CmtHash
:
res
.
Cmt
.
RepCmt
Hash
,
Rep
Hash
:
res
.
Cmt
.
Rep
Hash
,
Comment
:
res
.
Cmt
.
Comment
,
Height
:
res
.
Height
,
Index
:
res
.
Index
,
Hash
:
res
.
Hash
,
})
kvs
=
append
(
kvs
,
kv
)
return
kvs
...
...
plugin/dapp/autonomy/executor/rule_test.go
View file @
47540288
...
...
@@ -271,7 +271,7 @@ func TestExecLocalCommentProp(t *testing.T) {
receiptCmt
:=
&
auty
.
ReceiptProposalComment
{
Cmt
:
&
auty
.
Comment
{
ProposalID
:
propID
,
Rep
Cmt
Hash
:
Repcmt
,
RepHash
:
Repcmt
,
Comment
:
comment
,
},
Height
:
11
,
...
...
@@ -298,7 +298,7 @@ func TestExecDelLocalCommentProp(t *testing.T) {
receiptCmt
:=
&
auty
.
ReceiptProposalComment
{
Cmt
:
&
auty
.
Comment
{
ProposalID
:
propID
,
Rep
Cmt
Hash
:
Repcmt
,
RepHash
:
Repcmt
,
Comment
:
comment
,
},
Height
:
11
,
...
...
@@ -348,7 +348,7 @@ func TestListProposalComment(t *testing.T) {
testcase
=
append
(
testcase
,
testcase1
...
)
testcase
=
append
(
testcase
,
testcase2
...
)
cur
:=
&
auty
.
RelationCmt
{
Rep
Cmt
Hash
:
"aaaaaa"
,
RepHash
:
"aaaaaa"
,
Comment
:
"bbbbbbbbbb"
,
}
for
_
,
tcase
:=
range
testcase
{
...
...
plugin/dapp/autonomy/executor/ruleaction.go
View file @
47540288
...
...
@@ -331,15 +331,15 @@ func (a *action) commentProp(cm *auty.Comment) (*types.Receipt, error) {
var
logs
[]
*
types
.
ReceiptLog
var
kv
[]
*
types
.
KeyValue
receiptLog
:=
getCommentReceiptLog
(
cm
,
a
.
height
,
a
.
index
,
auty
.
TyLogCommentProp
)
receiptLog
:=
getCommentReceiptLog
(
cm
,
a
.
height
,
a
.
index
,
common
.
ToHex
(
a
.
txhash
),
auty
.
TyLogCommentProp
)
logs
=
append
(
logs
,
receiptLog
)
return
&
types
.
Receipt
{
Ty
:
types
.
ExecOk
,
KV
:
kv
,
Logs
:
logs
},
nil
}
func
getCommentReceiptLog
(
cur
*
auty
.
Comment
,
height
int64
,
index
int32
,
ty
int32
)
*
types
.
ReceiptLog
{
func
getCommentReceiptLog
(
cur
*
auty
.
Comment
,
height
int64
,
index
int32
,
hash
string
,
ty
int32
)
*
types
.
ReceiptLog
{
log
:=
&
types
.
ReceiptLog
{}
log
.
Ty
=
ty
r
:=
&
auty
.
ReceiptProposalComment
{
Cmt
:
cur
,
Height
:
height
,
Index
:
index
}
r
:=
&
auty
.
ReceiptProposalComment
{
Cmt
:
cur
,
Height
:
height
,
Index
:
index
,
Hash
:
hash
}
log
.
Log
=
types
.
Encode
(
r
)
return
log
}
...
...
plugin/dapp/autonomy/executor/ruleaction_test.go
View file @
47540288
...
...
@@ -537,7 +537,7 @@ func TestComment(t *testing.T) {
comment
:=
"3333333333"
opt1
:=
&
auty
.
Comment
{
ProposalID
:
propID
,
Rep
Cmt
Hash
:
Repcmt
,
RepHash
:
Repcmt
,
Comment
:
comment
,
}
pbtx
,
err
:=
commentPropTx
(
opt1
)
...
...
@@ -569,7 +569,7 @@ func TestComment(t *testing.T) {
err
=
types
.
Decode
(
value
,
cmt
)
require
.
NoError
(
t
,
err
)
require
.
Equal
(
t
,
cmt
.
Comment
,
comment
)
require
.
Equal
(
t
,
cmt
.
Rep
Cmt
Hash
,
Repcmt
)
require
.
Equal
(
t
,
cmt
.
RepHash
,
Repcmt
)
}
func
commentPropTx
(
parm
*
auty
.
Comment
)
(
*
types
.
Transaction
,
error
)
{
...
...
plugin/dapp/autonomy/proto/rule.proto
View file @
47540288
...
...
@@ -81,7 +81,7 @@ message TransferFund {
// Comment action
message
Comment
{
string
proposalID
=
1
;
string
rep
CmtHash
=
2
;
string
rep
Hash
=
2
;
string
comment
=
3
;
}
...
...
@@ -89,6 +89,7 @@ message ReceiptProposalComment {
Comment
cmt
=
1
;
int64
height
=
2
;
int32
index
=
3
;
string
hash
=
4
;
}
// query
...
...
@@ -100,10 +101,11 @@ message ReqQueryProposalComment {
}
message
RelationCmt
{
string
repCmtHash
=
1
;
string
comment
=
2
;
int64
height
=
3
;
int32
index
=
4
;
string
repHash
=
1
;
string
comment
=
2
;
int64
height
=
3
;
int32
index
=
4
;
string
hash
=
5
;
}
message
ReplyQueryProposalComment
{
...
...
plugin/dapp/autonomy/types/autonomy.pb.go
View file @
47540288
This diff is collapsed.
Click to expand it.
plugin/dapp/autonomy/types/board.pb.go
View file @
47540288
This diff is collapsed.
Click to expand it.
plugin/dapp/autonomy/types/lcommon.pb.go
View file @
47540288
This diff is collapsed.
Click to expand it.
plugin/dapp/autonomy/types/project.pb.go
View file @
47540288
This diff is collapsed.
Click to expand it.
plugin/dapp/autonomy/types/rule.pb.go
View file @
47540288
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment