Commit af1a33917ad9aa2a6e5934fd125a53c320a12df5
1 parent
e8d1e827
Exists in
master
and in
4 other branches
Create a wiki when wiki_enabled:true
Change-Id: I7aaab4b1f54fd2719a8a63d9069ddd5c59868e34
Showing
1 changed file
with
9 additions
and
0 deletions
Show diff stats
app/contexts/projects/create_context.rb
| @@ -46,6 +46,15 @@ module Projects | @@ -46,6 +46,15 @@ module Projects | ||
| 46 | 46 | ||
| 47 | @project.creator = current_user | 47 | @project.creator = current_user |
| 48 | 48 | ||
| 49 | + if @project.valid? && @project.wiki_enabled? | ||
| 50 | + begin | ||
| 51 | + #force the creation of a wiki, | ||
| 52 | + GollumWiki.new(@project, current_user).wiki | ||
| 53 | + rescue => exception | ||
| 54 | + @project.errors.add(:wiki_enabled, 'cannot create wiki') | ||
| 55 | + end | ||
| 56 | + end | ||
| 57 | + | ||
| 49 | if @project.save | 58 | if @project.save |
| 50 | @project.discover_default_branch | 59 | @project.discover_default_branch |
| 51 | 60 |