##// END OF EJS Templates
integrations: email, fix plural/singular case and no pushed branches case....
marcink -
r2421:3ca1f08e default
parent child Browse files
Show More
@@ -208,6 +208,7 b" email_icon = '''"
208 208 </svg>
209 209 '''
210 210
211
211 212 class EmailSettingsSchema(colander.Schema):
212 213 @colander.instantiate(validator=colander.Length(min=1))
213 214 class recipients(colander.SequenceSchema):
@@ -251,8 +252,12 b' def repo_push_handler(data, settings):'
251 252 commit_num = len(data['push']['commits'])
252 253 server_url = data['server_url']
253 254
254 if commit_num == 0:
255 subject = '[{repo_name}] {author} pushed {commit_num} commit on branches: {branches}'.format(
255 if commit_num == 1:
256 if data['push']['branches']:
257 _subject = '[{repo_name}] {author} pushed {commit_num} commit on branches: {branches}'
258 else:
259 _subject = '[{repo_name}] {author} pushed {commit_num} commit'
260 subject = _subject.format(
256 261 author=data['actor']['username'],
257 262 repo_name=data['repo']['repo_name'],
258 263 commit_num=commit_num,
@@ -260,7 +265,11 b' def repo_push_handler(data, settings):'
260 265 branch['name'] for branch in data['push']['branches'])
261 266 )
262 267 else:
263 subject = '[{repo_name}] {author} pushed {commit_num} commits on branches: {branches}'.format(
268 if data['push']['branches']:
269 _subject = '[{repo_name}] {author} pushed {commit_num} commits on branches: {branches}'
270 else:
271 _subject = '[{repo_name}] {author} pushed {commit_num} commits'
272 subject = _subject.format(
264 273 author=data['actor']['username'],
265 274 repo_name=data['repo']['repo_name'],
266 275 commit_num=commit_num,
General Comments 0
You need to be logged in to leave comments. Login now