Skip to content

Commit 0c16fa7

Browse files
committed
Make entity_creator_id optional
1 parent a5db63b commit 0c16fa7

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

lib/stream-chat/moderation.rb

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,14 @@ def flag_message(message_id, reason, **options)
5252
#
5353
# @param [string] entity_type Entity type to be flagged
5454
# @param [string] entity_id Entity ID to be flagged
55-
# @param [string] entity_creator_id User ID of the entity creator
5655
# @param [string] reason Reason for flagging the entity
56+
# @param [string] entity_creator_id User ID of the entity creator (optional)
5757
# @param [Hash] options Additional options for flagging the entity
5858
# @option options [String] :user_id User ID of the user who is flagging the target entity
5959
# @option options [Hash] :moderation_payload Content to be flagged
6060
# @option options [Hash] :custom Additional data to be stored with the flag
61-
sig { params(entity_type: String, entity_id: String, entity_creator_id: String, reason: String, options: T.untyped).returns(StreamChat::StreamResponse) }
62-
def flag(entity_type, entity_id, entity_creator_id, reason, **options)
61+
sig { params(entity_type: String, entity_id: String, reason: String, entity_creator_id: String, options: T.untyped).returns(StreamChat::StreamResponse) }
62+
def flag(entity_type, entity_id, reason, entity_creator_id: '', **options)
6363
@client.post('api/v2/moderation/flag', data: {
6464
entity_type: entity_type,
6565
entity_id: entity_id,
@@ -199,13 +199,13 @@ def submit_action(action_type, item_id, **options)
199199
params(
200200
entity_type: String,
201201
entity_id: String,
202-
entity_creator_id: String,
203202
moderation_payload: T::Hash[Symbol, T.any(T::Array[String], T::Hash[String, T.untyped])],
204203
config_key: String,
204+
entity_creator_id: String,
205205
options: T::Hash[Symbol, T::Boolean]
206206
).returns(StreamChat::StreamResponse)
207207
end
208-
def check(entity_type, entity_id, entity_creator_id, moderation_payload, config_key, options = {})
208+
def check(entity_type, entity_id, moderation_payload, config_key, entity_creator_id: '', options: {})
209209
@client.post('api/v2/moderation/check', data: {
210210
entity_type: entity_type,
211211
entity_id: entity_id,
@@ -223,8 +223,8 @@ def check(entity_type, entity_id, entity_creator_id, moderation_payload, config_
223223
# @param [string] entity_creator_id ID of the entity creator
224224
# @param [Hash] moderation_payload Content to be checked for moderation
225225
# @param [Array] flags Array of custom flags to add
226-
sig { params(entity_type: String, entity_id: String, entity_creator_id: String, moderation_payload: T.untyped, flags: T::Array[T.untyped]).returns(StreamChat::StreamResponse) }
227-
def add_custom_flags(entity_type, entity_id, entity_creator_id, moderation_payload, flags)
226+
sig { params(entity_type: String, entity_id: String, moderation_payload: T.untyped, flags: T::Array[T.untyped], entity_creator_id: String).returns(StreamChat::StreamResponse) }
227+
def add_custom_flags(entity_type, entity_id, moderation_payload, flags, entity_creator_id: '')
228228
@client.post('api/v2/moderation/custom_check', data: {
229229
entity_type: entity_type,
230230
entity_id: entity_id,
@@ -240,7 +240,7 @@ def add_custom_flags(entity_type, entity_id, entity_creator_id, moderation_paylo
240240
# @param [Array] flags Array of custom flags to add
241241
sig { params(message_id: String, flags: T::Array[T.untyped]).returns(StreamChat::StreamResponse) }
242242
def add_custom_message_flags(message_id, flags)
243-
add_custom_flags(T.must(MODERATION_ENTITY_TYPES[:message]), message_id, '', {}, flags)
243+
add_custom_flags(T.must(MODERATION_ENTITY_TYPES[:message]), message_id, {}, flags)
244244
end
245245
end
246246
end

0 commit comments

Comments
 (0)