@ -88,12 +88,13 @@ func canSoftDeleteContentHistory(ctx *context.Context, issue *models.Issue, comm
if ctx . Repo . IsOwner ( ) {
if ctx . Repo . IsOwner ( ) {
canSoftDelete = true
canSoftDelete = true
} else if ctx . Repo . CanWrite ( models . UnitTypeIssues ) {
} else if ctx . Repo . CanWrite ( models . UnitTypeIssues ) {
canSoftDelete = ctx . User . ID == history . PosterID
if comment == nil {
if comment == nil {
canSoftDelete = canSoftDelete && ( ctx . User . ID == issue . PosterID )
// the issue poster or the history poster can soft-delete
canSoftDelete = ctx . User . ID == issue . PosterID || ctx . User . ID == history . PosterID
canSoftDelete = canSoftDelete && ( history . IssueID == issue . ID )
canSoftDelete = canSoftDelete && ( history . IssueID == issue . ID )
} else {
} else {
canSoftDelete = canSoftDelete && ( ctx . User . ID == comment . PosterID )
// the comment poster or the history poster can soft-delete
canSoftDelete = ctx . User . ID == comment . PosterID || ctx . User . ID == history . PosterID
canSoftDelete = canSoftDelete && ( history . IssueID == issue . ID )
canSoftDelete = canSoftDelete && ( history . IssueID == issue . ID )
canSoftDelete = canSoftDelete && ( history . CommentID == comment . ID )
canSoftDelete = canSoftDelete && ( history . CommentID == comment . ID )
}
}
@ -137,7 +138,8 @@ func GetContentHistoryDetail(ctx *context.Context) {
// compare the current history revision with the previous one
// compare the current history revision with the previous one
dmp := diffmatchpatch . New ( )
dmp := diffmatchpatch . New ( )
diff := dmp . DiffMain ( prevHistoryContentText , history . ContentText , true )
// `checklines=false` makes better diff result
diff := dmp . DiffMain ( prevHistoryContentText , history . ContentText , false )
diff = dmp . DiffCleanupEfficiency ( diff )
diff = dmp . DiffCleanupEfficiency ( diff )
// use chroma to render the diff html
// use chroma to render the diff html