##// 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 </svg>
208 </svg>
209 '''
209 '''
210
210
211
211 class EmailSettingsSchema(colander.Schema):
212 class EmailSettingsSchema(colander.Schema):
212 @colander.instantiate(validator=colander.Length(min=1))
213 @colander.instantiate(validator=colander.Length(min=1))
213 class recipients(colander.SequenceSchema):
214 class recipients(colander.SequenceSchema):
@@ -251,8 +252,12 b' def repo_push_handler(data, settings):'
251 commit_num = len(data['push']['commits'])
252 commit_num = len(data['push']['commits'])
252 server_url = data['server_url']
253 server_url = data['server_url']
253
254
254 if commit_num == 0:
255 if commit_num == 1:
255 subject = '[{repo_name}] {author} pushed {commit_num} commit on branches: {branches}'.format(
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 author=data['actor']['username'],
261 author=data['actor']['username'],
257 repo_name=data['repo']['repo_name'],
262 repo_name=data['repo']['repo_name'],
258 commit_num=commit_num,
263 commit_num=commit_num,
@@ -260,7 +265,11 b' def repo_push_handler(data, settings):'
260 branch['name'] for branch in data['push']['branches'])
265 branch['name'] for branch in data['push']['branches'])
261 )
266 )
262 else:
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 author=data['actor']['username'],
273 author=data['actor']['username'],
265 repo_name=data['repo']['repo_name'],
274 repo_name=data['repo']['repo_name'],
266 commit_num=commit_num,
275 commit_num=commit_num,
General Comments 0
You need to be logged in to leave comments. Login now