Share edit location and check protected names in full segments
This commit is contained in:
@@ -2,6 +2,8 @@ package proposals
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"gitea.maximumdirect.net/eric/audita/v3/internal/core/schema"
|
||||
)
|
||||
|
||||
// CorrectionProposal is the base proposal emitted by correction modules.
|
||||
@@ -39,3 +41,12 @@ func (p CorrectionProposal) Validate() error {
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// SegmentIDAtReference maps a one-based model reference in the supplied
|
||||
// section to the transcript's segment ID. Zero represents an invalid reference.
|
||||
func SegmentIDAtReference(section *schema.Transcript, reference int) int {
|
||||
if section == nil || reference <= 0 || reference > len(section.Segments) {
|
||||
return 0
|
||||
}
|
||||
return section.Segments[reference-1].ID
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user