File tree Expand file tree Collapse file tree 1 file changed +14
-4
lines changed Expand file tree Collapse file tree 1 file changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -102,14 +102,24 @@ public Listing<Post> GetPageDiscussions(string page)
102
102
public void EditPage ( string page , string content , string previous = null , string reason = null )
103
103
{
104
104
var request = WebAgent . CreatePost ( string . Format ( WikiPageEditUrl , Subreddit . Name ) ) ;
105
- WebAgent . WritePostBody ( request . GetRequestStream ( ) , new
105
+ dynamic param = new
106
106
{
107
107
content = content ,
108
- previous = previous ,
109
- reason = reason ,
110
108
page = page ,
111
109
uh = Reddit . User . Modhash
112
- } ) ;
110
+ } ;
111
+ List < string > addParams = new List < string > ( ) ;
112
+ if ( previous != null )
113
+ {
114
+ addParams . Add ( "previous" ) ;
115
+ addParams . Add ( previous ) ;
116
+ }
117
+ if ( reason != null )
118
+ {
119
+ addParams . Add ( "reason" ) ;
120
+ addParams . Add ( reason ) ;
121
+ }
122
+ WebAgent . WritePostBody ( request . GetRequestStream ( ) , param , addParams . ToArray ( ) ) ;
113
123
var response = request . GetResponse ( ) ;
114
124
}
115
125
You can’t perform that action at this time.
0 commit comments