File tree Expand file tree Collapse file tree 2 files changed +20
-2
lines changed Expand file tree Collapse file tree 2 files changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -28,10 +28,24 @@ class User extends JsonObject {
28
28
@override
29
29
Map <String , dynamic > toJson () => _$UserToJson (this );
30
30
31
+ static String getUserWikiTag (final String userId) =>
32
+ '${userId .substring (0 , 1 ).toUpperCase ()}${userId .substring (1 )}' ;
33
+
31
34
static String getUserWikiPage (final String userId) => Uri (
32
35
scheme: 'https' ,
33
36
host: 'wiki.openfoodfacts.org' ,
34
- path: 'User:'
35
- '${userId .substring (0 , 1 ).toUpperCase ()}${userId .substring (1 )}' ,
37
+ path: 'User:${getUserWikiTag (userId )}' ,
38
+ ).toString ();
39
+
40
+ /// Link to add a discussion topic on the OpenFoodFacts wiki page of a user.
41
+ static String getUserWikiDiscussionPage (final String userId) => Uri (
42
+ scheme: 'https' ,
43
+ host: 'wiki.openfoodfacts.org' ,
44
+ path: 'index.php' ,
45
+ queryParameters: {
46
+ 'title' : 'User_talk:${getUserWikiTag (userId )}' ,
47
+ 'action' : 'edit' ,
48
+ 'section' : 'new' ,
49
+ },
36
50
).toString ();
37
51
}
Original file line number Diff line number Diff line change @@ -192,6 +192,10 @@ void main() {
192
192
User .getUserWikiPage ('teolemon' ),
193
193
'https://wiki.openfoodfacts.org/User:Teolemon' ,
194
194
);
195
+ expect (
196
+ User .getUserWikiDiscussionPage ('tacinte' ),
197
+ 'https://wiki.openfoodfacts.org/index.php?title=User_talk%3ATacinte&action=edit§ion=new' ,
198
+ );
195
199
});
196
200
});
197
201
}
You can’t perform that action at this time.
0 commit comments