From 8c909820a9fd1697bb690ec0451c4ead97b51505 Mon Sep 17 00:00:00 2001 From: blueworrybear Date: Tue, 15 Oct 2019 20:19:32 +0800 Subject: Enable Uploading/Removing Attachments When Editing an Issue/Comment (#8426) --- modules/util/compare.go | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'modules') 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) { -- cgit v1.2.3