summaryrefslogtreecommitdiffstats
path: root/modules/util
diff options
context:
space:
mode:
authorblueworrybear <blueworrybear@gmail.com>2019-10-15 20:19:32 +0800
committerzeripath <art27@cantab.net>2019-10-15 13:19:32 +0100
commit8c909820a9fd1697bb690ec0451c4ead97b51505 (patch)
treebda76eca8361237fbd5bc59bda58b278a516ffd6 /modules/util
parentd7d348ea86bd8066aeb079ad121120095d5cba4d (diff)
downloadgitea-8c909820a9fd1697bb690ec0451c4ead97b51505.tar.gz
gitea-8c909820a9fd1697bb690ec0451c4ead97b51505.zip
Enable Uploading/Removing Attachments When Editing an Issue/Comment (#8426)
Diffstat (limited to 'modules/util')
-rw-r--r--modules/util/compare.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/modules/util/compare.go b/modules/util/compare.go
index c61e7965ae..f1d1e5718e 100644
--- a/modules/util/compare.go
+++ b/modules/util/compare.go
@@ -35,6 +35,16 @@ func ExistsInSlice(target string, slice []string) bool {
return i < len(slice)
}
+// IsStringInSlice sequential searches if string exists in slice.
+func IsStringInSlice(target string, slice []string) bool {
+ for i := 0; i < len(slice); i++ {
+ if slice[i] == target {
+ return true
+ }
+ }
+ return false
+}
+
// IsEqualSlice returns true if slices are equal.
func IsEqualSlice(target []string, source []string) bool {
if len(target) != len(source) {