@@ -166,41 +166,36 @@ public async Task<bool> DeleteUpdateAsync(LiveUpdate update)
166
166
/// <summary>
167
167
/// Edit a live thread. Set parameters to empty string to clear those fields. Or null to ignore them on update.
168
168
/// </summary>
169
- /// <param name="title">New Title.</param>
169
+ /// <param name="title">New Title. Cannot be empty string. </param>
170
170
/// <param name="description">New Description</param>
171
171
/// <param name="resources">new Resources</param>
172
172
/// <param name="nsfw">NSFW flag</param>
173
173
public async Task < bool > EditAsync ( string title , string description , string resources , bool ? nsfw )
174
174
{
175
- var expando = ( IDictionary < string , object > ) new ExpandoObject ( ) ;
176
-
177
- if ( title != null )
178
- expando . Add ( new KeyValuePair < string , object > ( "title" , title ) ) ;
179
-
180
- if ( description != null )
181
- expando . Add ( new KeyValuePair < string , object > ( "description" , description ) ) ;
182
-
183
- if ( resources != null )
184
- expando . Add ( new KeyValuePair < string , object > ( "resources" , resources ) ) ;
185
-
186
- if ( nsfw . HasValue )
187
- expando . Add ( new KeyValuePair < string , object > ( "nsfw" , nsfw . Value ) ) ;
188
-
175
+ if ( title == null )
176
+ title = Title ;
177
+ if ( description == null )
178
+ description = Description ;
179
+ if ( resources == null )
180
+ resources = Resources ;
181
+ if ( ! nsfw . HasValue )
182
+ nsfw = NSFW ;
183
+
184
+ dynamic properties = new { title = title , description = description , resources = resources , nsfw = nsfw } ;
189
185
var request = WebAgent . CreateRequest ( EditUrl , "POST" ) ;
190
- WebAgent . WritePostBody ( request , expando ) ;
191
-
186
+ WebAgent . WritePostBody ( request , properties ) ;
192
187
var response = await WebAgent . GetResponseAsync ( request ) . ConfigureAwait ( false ) ;
193
188
194
189
if ( ! response . IsSuccessStatusCode )
195
190
return false ;
196
191
197
192
var data = await response . Content . ReadAsStringAsync ( ) . ConfigureAwait ( false ) ;
198
193
JToken json = JToken . Parse ( data ) ;
199
- if ( ! json [ "json" ] [ "errors" ] . Any ( ) )
194
+ if ( json [ "success" ] . Value < Boolean > ( ) )
200
195
{
201
- Title = title ?? "" ;
202
- Description = description ?? "" ;
203
- Resources = resources ?? "" ;
196
+ Title = title ?? Title ;
197
+ Description = description ?? Description ;
198
+ Resources = resources ?? Resources ;
204
199
205
200
if ( nsfw . HasValue )
206
201
NSFW = nsfw . Value ;
0 commit comments