Skip to content

Commit d24fb48

Browse files
committed
Fix menu when gitlab is enabled
Signed-off-by: Cédric Couralet <[email protected]>
1 parent dbcb469 commit d24fb48

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

app.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,7 @@ app.locals.authProviders = {
198198
email: config.isEmailEnable,
199199
allowEmailRegister: config.allowEmailRegister
200200
}
201+
app.locals.enableGitlabSnippets = (!config.gitlab.scope || config.gitlab.scope === 'api')
201202

202203
app.use(require('./lib/web/baseRouter'))
203204
app.use(require('./lib/web/statusRouter'))

public/views/codimd/header.ejs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
</li>
3333
<li role="presentation"><a role="menuitem" class="ui-extra-slide" tabindex="-1" href="#" target="_blank" rel="noopener"><i class="fa fa-tv fa-fw"></i> <%= __('Slide Mode') %></a>
3434
</li>
35-
<% if((typeof github !== 'undefined' && github) || (typeof dropbox !== 'undefined' && dropbox) || (typeof gitlab !== 'undefined' && gitlab && (!gitlab.scope || gitlab.scope === 'api'))) { %>
35+
<% if((typeof github !== 'undefined' && github) || (typeof dropbox !== 'undefined' && dropbox) || enableGitlabSnippets) { %>
3636
<li class="divider"></li>
3737
<li class="dropdown-header"><%= __('Export') %></li>
3838
<li role="presentation"><a role="menuitem" class="ui-save-dropbox" tabindex="-1" href="#" target="_self"><i class="fa fa-dropbox fa-fw"></i> Dropbox</a>
@@ -41,7 +41,7 @@
4141
<li role="presentation"><a role="menuitem" class="ui-save-gist" tabindex="-1" href="#" target="_blank" rel="noopener"><i class="fa fa-github fa-fw"></i> Gist</a>
4242
</li>
4343
<% } %>
44-
<% if(typeof gitlab !== 'undefined' && gitlab && (!gitlab.scope || gitlab.scope === 'api')) { %>
44+
<% if(enableGitlabSnippets) { %>
4545
<li role="presentation"><a role="menuitem" class="ui-save-snippet" href="#"><i class="fa fa-gitlab fa-fw"></i> Snippet</a>
4646
</li>
4747
<% } %>
@@ -52,7 +52,7 @@
5252
</li>
5353
<li role="presentation"><a role="menuitem" class="ui-import-gist" href="#" data-toggle="modal" data-target="#gistImportModal"><i class="fa fa-github fa-fw"></i> Gist</a>
5454
</li>
55-
<% if(typeof gitlab !== 'undefined' && gitlab && (!gitlab.scope || gitlab.scope === 'api')) { %>
55+
<% if(enableGitlabSnippets) { %>
5656
<li role="presentation"><a role="menuitem" class="ui-import-snippet" href="#"><i class="fa fa-gitlab fa-fw"></i> Snippet</a>
5757
</li>
5858
<% } %>
@@ -134,7 +134,7 @@
134134
</li>
135135
<li role="presentation"><a role="menuitem" class="ui-extra-slide" tabindex="-1" href="#" target="_blank" rel="noopener"><i class="fa fa-tv fa-fw"></i> <%= __('Slide Mode') %></a>
136136
</li>
137-
<% if((typeof github !== 'undefined' && github) || (typeof dropbox !== 'undefined' && dropbox) || (typeof gitlab !== 'undefined' && gitlab && (!gitlab.scope || gitlab.scope === 'api'))) { %>
137+
<% if((typeof github !== 'undefined' && github) || (typeof dropbox !== 'undefined' && dropbox) || enableGitlabSnippets ) { %>
138138
<li class="divider"></li>
139139
<li class="dropdown-header"><%= __('Export') %></li>
140140
<li role="presentation"><a role="menuitem" class="ui-save-dropbox" tabindex="-1" href="#" target="_self"><i class="fa fa-dropbox fa-fw"></i> Dropbox</a>
@@ -143,7 +143,7 @@
143143
<li role="presentation"><a role="menuitem" class="ui-save-gist" tabindex="-1" href="#" target="_blank" rel="noopener"><i class="fa fa-github fa-fw"></i> Gist</a>
144144
</li>
145145
<% } %>
146-
<% if(typeof gitlab !== 'undefined' && gitlab && (!gitlab.scope || gitlab.scope === 'api')) { %>
146+
<% if(enableGitlabSnippets) { %>
147147
<li role="presentation"><a role="menuitem" class="ui-save-snippet" href="#"><i class="fa fa-gitlab fa-fw"></i> Snippet</a>
148148
</li>
149149
<% } %>
@@ -154,7 +154,7 @@
154154
</li>
155155
<li role="presentation"><a role="menuitem" class="ui-import-gist" href="#" data-toggle="modal" data-target="#gistImportModal"><i class="fa fa-github fa-fw"></i> Gist</a>
156156
</li>
157-
<% if(typeof gitlab !== 'undefined' && gitlab && (!gitlab.scope || gitlab.scope === 'api')) { %>
157+
<% if(enableGitlabSnippets) { %>
158158
<li role="presentation"><a role="menuitem" class="ui-import-snippet" href="#"><i class="fa fa-gitlab fa-fw"></i> Snippet</a>
159159
</li>
160160
<% } %>

0 commit comments

Comments
 (0)