@@ -45,8 +45,10 @@ class Gitment {
45
45
}
46
46
47
47
constructor ( options = { } ) {
48
+ this . defaultTheme = defaultTheme
49
+ this . useTheme ( defaultTheme )
50
+
48
51
Object . assign ( this , {
49
- defaultTheme,
50
52
id : window . location . href ,
51
53
title : window . document . title ,
52
54
link : window . location . href ,
@@ -57,6 +59,8 @@ class Gitment {
57
59
perPage : 30 ,
58
60
} , options )
59
61
62
+ this . useTheme ( this . theme )
63
+
60
64
const user = { }
61
65
try {
62
66
const userInfo = localStorage . getItem ( LS_USER_KEY )
@@ -78,9 +82,6 @@ class Gitment {
78
82
currentPage : 1 ,
79
83
} )
80
84
81
- const renderers = Object . keys ( this . theme )
82
- renderers . forEach ( renderer => extendRenderer ( this , renderer ) )
83
-
84
85
const query = Query . parse ( )
85
86
if ( query . code ) {
86
87
const { client_id, client_secret } = this . oauth
@@ -123,6 +124,13 @@ class Gitment {
123
124
} )
124
125
}
125
126
127
+ useTheme ( theme = { } ) {
128
+ this . theme = theme
129
+
130
+ const renderers = Object . keys ( this . theme )
131
+ renderers . forEach ( renderer => extendRenderer ( this , renderer ) )
132
+ }
133
+
126
134
update ( ) {
127
135
return Promise . all ( [ this . loadMeta ( ) , this . loadUserInfo ( ) ] )
128
136
. then ( ( ) => Promise . all ( [ this . loadComments ( ) , this . loadReactions ( ) ] ) )
@@ -141,7 +149,7 @@ class Gitment {
141
149
142
150
return http . post ( `/repos/${ owner } /${ repo } /issues` , {
143
151
title,
144
- labels : labels . concat ( [ id ] ) ,
152
+ labels : labels . concat ( [ 'gitment' , id ] ) ,
145
153
body : `${ link } \n\n${ desc } ` ,
146
154
} )
147
155
. then ( ( meta ) => {
0 commit comments