Skip to content

Commit f50ef4f

Browse files
authored
FIX: Make DiscourseApi::SingleSignOn#groups return a better array (#243)
`DiscourseApi::SingleSignOn#groups` currently returns an array with a single string that contains all the user's groups comma-concatenated. This API is not very friendly to use, so this PR changes the method to make it return a proper array where each element/string is a group name.
1 parent 745fb58 commit f50ef4f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/discourse_api/single_sign_on.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def self.parse_hash(payload)
3838
if BOOLS.include? k
3939
val = ["true", "false"].include?(val) ? val == "true" : nil
4040
end
41-
val = Array(val) if ARRAYS.include?(k) && !val.nil?
41+
val = val.split(",") if ARRAYS.include?(k) && !val.nil?
4242
sso.send("#{k}=", val)
4343
end
4444

@@ -79,7 +79,7 @@ def self.parse(payload, sso_secret = nil)
7979
if BOOLS.include? k
8080
val = ["true", "false"].include?(val) ? val == "true" : nil
8181
end
82-
val = Array(val) if ARRAYS.include?(k) && !val.nil?
82+
val = val.split(",") if ARRAYS.include?(k) && !val.nil?
8383
sso.send("#{k}=", val)
8484
end
8585

0 commit comments

Comments
 (0)