def secondary_icon(self, msg, **config): if '.git.receive' in msg['topic']: if 'username' in msg['msg']['commit']: username = msg['msg']['commit']['username'] return avatar_url(username) email = msg['msg']['commit']['email'] return avatar_url_from_email(email) elif '.git.lookaside' in msg['topic']: username = msg['msg']['agent'] return avatar_url(username) elif 'agent' in msg['msg']: username = msg['msg']['agent'] return avatar_url(username)
def secondary_icon(self, msg, **config): if '.git.receive' in msg['topic']: if 'username' in msg['msg']['commit']: username = msg['msg']['commit']['username'] return avatar_url(username) email = msg['msg']['commit']['email'] return avatar_url_from_email(email) elif '.git.lookaside' in msg['topic']: username = msg['msg']['agent'] return avatar_url(username) elif 'agent' in msg['msg']: username = msg['msg']['agent'] return avatar_url(username)
def secondary_icon(self, msg, **config): username = '' if 'bodhi.update.comment' in msg['topic']: username = msg['msg']['comment']['author'] elif 'bodhi.buildroot_override' in msg['topic']: username = msg['msg']['override']['submitter'] elif 'bodhi.stack' in msg['topic']: username = msg['msg']['agent'] elif 'update' in msg['msg'] and 'submitter' in msg['msg']['update']: username = msg['msg']['update']['submitter'] else: username = msg['msg'].get('agent') if isinstance(username, dict): username = username['name'] avatar = self.__icon__ if username: avatar = avatar_url(username) else: # If we don't have a user, then try with a package if 'update' in msg['msg']: packages = self._u2p(msg['msg']['update']['title']) tmpl = 'https://apps.fedoraproject.org/packages/' + \ 'images/icons/%s.png' if packages: avatar = tmpl % packages[0] return avatar
def secondary_icon(self, msg, **config): owner = msg['msg'].get('owner') if owner: return avatar_url(owner) return self.__icon__
def secondary_icon(self, msg, **config): username = "" if "bodhi.update.comment" in msg["topic"]: username = msg["msg"]["comment"]["author"] elif "bodhi.buildroot_override" in msg["topic"]: username = msg["msg"]["override"]["submitter"] elif "bodhi.stack" in msg["topic"]: username = msg["msg"]["agent"] elif "update" in msg["msg"] and "submitter" in msg["msg"]["update"]: username = msg["msg"]["update"]["submitter"] else: username = msg["msg"].get("agent") if isinstance(username, dict): username = username["name"] avatar = self.__icon__ if username: avatar = avatar_url(username) else: # If we don't have a user, then try with a package if "update" in msg["msg"]: packages = self._u2p(msg["msg"]["update"]["title"]) tmpl = "https://apps.fedoraproject.org/packages/" + "images/icons/%s.png" if packages: avatar = tmpl % packages[0] return avatar
def merge(self, constituents, subject, **config): ms = constituents # shorthand count = sum([m['msg']['total_commits'] for m in ms]) agents = set([m['msg']['agent'] for m in ms]) branches = [m['msg']['branch'].replace('refs/heads/', '') for m in ms] repo = ms[0]['msg']['repo']['name'] subtitle = '{agents} pushed {count} commits to {repo} ({branches})' agents = self.list_to_series(agents) branches = self.list_to_series(branches) tmpl = self.produce_template(constituents, subject, **config) tmpl['subtitle'] = subtitle.format( agents=agents, repo=repo, count=count, branches=branches, ) tmpl['subjective'] = tmpl['subtitle'] tmpl['secondary_icon'] = avatar_url(ms[0]['msg']['agent']) link_template = 'https://pagure.io/{repo}/commits' tmpl['link'] = link_template.format(repo=repo) return tmpl
def merge(self, constituents, subject, **config): ms = constituents # shorthand count = len(ms) agents = set([m['msg']['agent'] for m in ms]) idx = ms[0]['msg'][self.entity_key]['id'] repo = self.get_repo(ms[0]) subtitle = '{agents} interacted with {entity_name} #{idx} of project "{repo}" {count} times' agents = self.list_to_series(agents) tmpl = self.produce_template(constituents, subject, **config) tmpl['subtitle'] = subtitle.format( agents=agents, entity_name=self.entity_name, repo=repo, idx=idx, count=count, ) tmpl['subjective'] = tmpl['subtitle'] tmpl['secondary_icon'] = avatar_url(ms[0]['msg']['agent']) link_template = 'https://pagure.io/{repo}/{entity_name}/{idx}' tmpl['link'] = link_template.format( repo=repo, entity_name=self.entity_name, idx=idx, ) return tmpl
def secondary_icon(self, msg, **config): username = '' if 'bodhi.update.comment' in msg['topic']: username = msg['msg']['comment']['author'] elif 'bodhi.buildroot_override' in msg['topic']: username = msg['msg']['override']['submitter'] elif 'bodhi.stack' in msg['topic']: username = msg['msg']['agent'] elif 'update' in msg['msg'] and 'submitter' in msg['msg']['update']: username = msg['msg']['update']['submitter'] else: username = msg['msg'].get('agent') if isinstance(username, dict): username = username['name'] avatar = self.__icon__ if username: avatar = avatar_url(username) else: # If we don't have a user, then try with a package if 'update' in msg['msg']: packages = self._u2p(msg['msg']['update']['title']) tmpl = 'https://apps.fedoraproject.org/packages/' + \ 'images/icons/%s.png' if packages: avatar = tmpl % packages[0] return avatar
def secondary_icon(self, msg, **config): username = '' if 'bodhi.update.comment' in msg['topic']: username = self._comment_author(msg) elif 'bodhi.buildroot_override' in msg['topic']: username = self._override_author(msg) elif 'bodhi.stack' in msg['topic']: username = msg['msg']['agent'] elif self._update_author(msg): username = self._update_author(msg) else: username = msg['msg'].get('agent') avatar = self.__icon__ if username: avatar = avatar_url(username) else: # If we don't have a user, then try with a package if titlestring(msg): packages = self._u2p(titlestring(msg)) tmpl = 'https://apps.fedoraproject.org/packages/' + \ 'images/icons/%s.png' if packages: avatar = tmpl % packages[0] return avatar
def get_secondary_icon(self, constituents, default): agents = set([m['msg']['user'] for m in constituents]) if len(agents) == 1: user = constituents[0]['msg']['user'] return avatar_url(user) else: return 'https://apps.fedoraproject.org/img/icons/copr.png'
def secondary_icon(self, msg, **config): owner = msg['msg'].get('owner') if owner: return avatar_url(owner) return self.__icon__
def merge(self, constituents, subject, **config): ms = constituents # shorthand count = len(ms) agents = set([m['msg']['agent'] for m in ms]) idx = ms[0]['msg'][self.entity_key]['id'] repo = self.get_repo(ms[0]) subtitle = '{agents} interacted with {entity_name} #{idx} of project "{repo}" {count} times' agents = self.list_to_series(agents) tmpl = self.produce_template(constituents, subject, **config) tmpl['subtitle'] = subtitle.format( agents=agents, entity_name=self.entity_name, repo=repo, idx=idx, count=count, ) tmpl['subjective'] = tmpl['subtitle'] tmpl['secondary_icon'] = avatar_url(ms[0]['msg']['agent']) link_template = 'https://pagure.io/{repo}/{entity_name}/{idx}' tmpl['link'] = link_template.format( repo=repo, entity_name=self.entity_name, idx=idx, ) return tmpl
def merge(self, constituents, subject, **config): ms = constituents # shorthand count = sum([m['msg']['total_commits'] for m in ms]) agents = set([m['msg']['agent'] for m in ms]) branches = [m['msg']['branch'].replace('refs/heads/', '') for m in ms] repo = ms[0]['msg']['repo']['name'] subtitle = '{agents} pushed {count} commits to {repo} ({branches})' agents = self.list_to_series(agents) branches = self.list_to_series(branches) tmpl = self.produce_template(constituents, subject, **config) tmpl['subtitle'] = subtitle.format( agents=agents, repo=repo, count=count, branches=branches, ) tmpl['subjective'] = tmpl['subtitle'] tmpl['secondary_icon'] = avatar_url(ms[0]['msg']['agent']) link_template = 'https://pagure.io/{repo}/commits' tmpl['link'] = link_template.format(repo=repo) return tmpl
def merge(self, constituents, **config): tmpl = self.produce_template(constituents, **config) msg = constituents[0] agent = msg['msg']['agent'] updates = self.list_to_series([ msg['msg']['comment']['update_title'] for msg in constituents]) subtitle = '{agent} commented on {updates}' tmpl['subtitle'] = subtitle.format(agent=agent, updates=updates) tmpl['secondary_icon'] = avatar_url(agent) base = 'https://admin.fedoraproject.org/updates/user/%s/' tmpl['link'] = base % agent return tmpl
def secondary_icon(self, msg, **config): user = None try: user = msg["msg"]["agent"] except KeyError: pass if not user: return "" return avatar_url(username=user)
def secondary_icon(self, msg, **config): user = None try: user = msg['msg']['agent'] except KeyError: pass if not user: return "" return avatar_url(username=user)
def secondary_icon(self, msg, **config): user = None try: user = msg['msg']['username'] except KeyError: pass if not user: return "" return avatar_url(username=user)
def merge(self, constituents, **config): tmpl = self.produce_template(constituents, **config) msg = constituents[0] agent = msg['msg']['agent'] updates = self.list_to_series( [msg['msg']['comment']['update_title'] for msg in constituents]) subtitle = '{agent} commented on {updates}' tmpl['subtitle'] = subtitle.format(agent=agent, updates=updates) tmpl['secondary_icon'] = avatar_url(agent) base = 'https://admin.fedoraproject.org/updates/user/%s/' tmpl['link'] = base % agent return tmpl
def secondary_icon(self, msg, **config): username = self._get_user(msg, **config) packages = self.packages(msg, **config) if username: if "@" in username: return avatar_url_from_email(username) else: return avatar_url(username) elif packages: tmpl = "https://apps.fedoraproject.org/packages/" + "images/icons/%s.png" return tmpl % list(packages)[0] else: return None
def secondary_icon(self, msg, **config): username = self._get_user(msg, **config) packages = self.packages(msg, **config) if username: if '@' in username: return avatar_url_from_email(username) else: return avatar_url(username) elif packages: tmpl = 'https://apps.fedoraproject.org/packages/' + \ 'images/icons/%s.png' return tmpl % list(packages)[0] else: return None
def merge(self, constituents, **config): N = len(constituents) msg = constituents[0]['msg'] agent = msg['agent'] branches = self.list_to_series([ constituent['msg']['update']['release']['name'] for constituent in constituents]) tmpl = self.produce_template(constituents, **config) packages = self.list_to_series(list(tmpl['packages'])) subtitle = '{agent} submitted {packages} ' + \ 'updates for {branches}' tmpl['subtitle'] = subtitle.format( agent=agent, packages=packages, N=N, branches=branches) tmpl['secondary_icon'] = avatar_url(msg['agent']) base = 'https://admin.fedoraproject.org/updates/user/%s/' tmpl['link'] = base % agent return tmpl
def merge(self, constituents, **config): N = len(constituents) msg = constituents[0]['msg'] agent = msg['agent'] package = self.processor._u2p(msg['update']['title'])[0] branches = self.list_to_series([ constituent['msg']['update']['release']['name'] for constituent in constituents]) tmpl = self.produce_template(constituents, **config) subtitle = '{agent} requested {N} {package} ' + \ 'stable updates for {branches}' tmpl['subtitle'] = subtitle.format( agent=agent, package=package, N=N, branches=branches) tmpl['secondary_icon'] = avatar_url(msg['agent']) base = 'https://admin.fedoraproject.org/updates/%s/' tmpl['link'] = base % package return tmpl
def merge(self, constituents, subject, **config): N = len(constituents) msg = constituents[0]['msg'] agent = msg['agent'] package = self.processor._u2p(msg['update']['title'])[0] branches = self.list_to_series([ constituent['msg']['update']['release']['name'] for constituent in constituents]) tmpl = self.produce_template(constituents, subject, **config) subtitle = '{agent} requested {N} {package} ' + \ 'stable updates for {branches}' tmpl['subtitle'] = subtitle.format( agent=agent, package=package, N=N, branches=branches) tmpl['subjective'] = tmpl['subtitle'] tmpl['secondary_icon'] = avatar_url(msg['agent']) base = 'https://bodhi.fedoraproject.org/updates/%s' tmpl['link'] = base % package return tmpl
def merge(self, constituents, subject, **config): N = len(constituents) msg = constituents[0]['msg'] agent = msg['agent'] branches = self.list_to_series([ constituent['msg']['update']['release']['name'] for constituent in constituents]) tmpl = self.produce_template(constituents, subject, **config) packages = self.list_to_series(list(tmpl['packages'])) subtitle = '{agent} submitted {packages} ' + \ 'updates for {branches}' tmpl['subtitle'] = subtitle.format( agent=agent, packages=packages, N=N, branches=branches) tmpl['subjective'] = tmpl['subtitle'] tmpl['secondary_icon'] = avatar_url(msg['agent']) base = 'https://bodhi.fedoraproject.org/users/%s' tmpl['link'] = base % agent return tmpl
def merge(self, constituents, subject, **config): N = len(constituents) msg = constituents[0]['msg'] agent = msg['override']['submitter']['name'] branches = self.list_to_series([ constituent['msg']['override']['nvr'].split('.')[-1] for constituent in constituents]) tmpl = self.produce_template(constituents, subject, **config) packages = self.list_to_series(list(tmpl['packages'])) subtitle = '{agent} expired {N} overrides for {packages} ' + \ 'on {branches}' tmpl['subtitle'] = subtitle.format( agent=agent, packages=packages, N=N, branches=branches) tmpl['subjective'] = tmpl['subtitle'] tmpl['secondary_icon'] = avatar_url(agent) base = 'https://bodhi.fedoraproject.org/overrides/?user=%s' tmpl['link'] = base % agent return tmpl
def merge(self, constituents, subject, **config): N = len(constituents) msg = constituents[0]['msg'] agent = msg['override']['submitter']['name'] branches = self.list_to_series([ constituent['msg']['override']['nvr'].split('.')[-1] for constituent in constituents ]) tmpl = self.produce_template(constituents, subject, **config) packages = self.list_to_series(list(tmpl['packages'])) subtitle = '{agent} expired {N} overrides for {packages} ' + \ 'on {branches}' tmpl['subtitle'] = subtitle.format(agent=agent, packages=packages, N=N, branches=branches) tmpl['subjective'] = tmpl['subtitle'] tmpl['secondary_icon'] = avatar_url(agent) base = 'https://bodhi.fedoraproject.org/overrides/?user=%s' tmpl['link'] = base % agent return tmpl
def merge(self, constituents, subject, **config): ms = constituents # shorthand count = len(ms) agents = set( [email2fas(m['msg']['commit']['email'], **config) for m in ms]) repo = ms[0]['msg']['commit']['repo']['name'] subtitle = '{agents} pushed {count} commits to the {repo} project' agents = self.list_to_series(agents) tmpl = self.produce_template(constituents, subject, **config) tmpl['subtitle'] = subtitle.format( agents=agents, repo=repo, count=count, ) tmpl['subjective'] = tmpl['subtitle'] tmpl['secondary_icon'] = avatar_url(list(agents)[0]) link_template = 'https://pagure.io/{repo}/commits' tmpl['link'] = link_template.format(repo=repo) return tmpl
def merge(self, constituents, subject, **config): ms = constituents # shorthand count = len(ms) agents = set([ email2fas(m['msg']['commit']['email'], **config) for m in ms ]) repo = ms[0]['msg']['commit']['repo']['name'] subtitle = '{agents} pushed {count} commits to the {repo} project' agents = self.list_to_series(agents) tmpl = self.produce_template(constituents, subject, **config) tmpl['subtitle'] = subtitle.format( agents=agents, repo=repo, count=count, ) tmpl['subjective'] = tmpl['subtitle'] tmpl['secondary_icon'] = avatar_url(list(agents)[0]) link_template = 'https://pagure.io/{repo}/commits' tmpl['link'] = link_template.format(repo=repo) return tmpl
def secondary_icon(self, msg, **config): if 'details' in msg['msg']: user = nick2fas(msg['msg']['details']['nick'], **config) else: user = nick2fas(msg['msg']['owner'], **config) return avatar_url(user)
def get_secondary_icon(self, constituents, default): user = constituents[0]['msg']['user'] return avatar_url(user)
def secondary_icon(self, msg, **config): user, is_fas = self._get_user(msg, **config) if is_fas: return avatar_url(user) else: return avatar_url_from_email(user)
def secondary_icon(self, msg, **config): user = msg['msg'].get('user', msg['msg'].get('user_text', '')) return avatar_url(user.lower())
def secondary_icon(self, msg, **config): if 'details' in msg['msg']: user = nick2fas(msg['msg']['details']['nick'], **config) else: user = nick2fas(msg['msg']['owner'], **config) return avatar_url(user)
def secondary_icon(self, msg, **config): try: user = msg['msg']['username'] return avatar_url(user) except KeyError: return None
def secondary_icon(self, msg, **config): username = msg['msg'].get('agent') if username: return avatar_url(username) else: return None
def secondary_icon(self, msg, **config): usernames = self.usernames(msg, **config) if usernames: return avatar_url(list(usernames)[0]) else: return self.__icon__
def secondary_icon(self, msg, **config): username = msg['msg'].get('agent') if username: return avatar_url(username) else: return None
def secondary_icon(self, msg, **config): # Every fas fedmsg message has an "agent" field.. "whodunnit" return avatar_url(username=string_or_dict(msg['msg'], 'agent'))
def secondary_icon(self, msg, **config): if "user" in msg["msg"]: return avatar_url(msg["msg"]["user"])
def secondary_icon(self, msg, **config): user = msg['msg']['compose']['owner'] return avatar_url(user)
def secondary_icon(self, msg, **config): return avatar_url(msg['msg']['agent'])
def secondary_icon(self, msg, **config): if 'github.webhook' in msg['topic']: return self.icon(msg, **config) # Otherwise return avatar_url(self._get_user(msg))
def secondary_icon(self, msg, **config): if 'user' in msg['msg']: return avatar_url(msg['msg']['user'])
def secondary_icon(self, msg, **config): return avatar_url(self._get_user(msg))
def secondary_icon(self, msg, **config): if 'agent' in msg['msg']: agent = msg['msg']['agent'] # Old style else: agent = msg['msg']['fas_user'] # New style return avatar_url(agent)
def get_secondary_icon(self, constituents, default): userid = constituents[0]['msg']['user']['username'] return avatar_url(userid)
def secondary_icon(self, msg, **config): user = msg['msg'].get('userid') if user: return avatar_url(user)
def secondary_icon(self, msg, **config): return avatar_url(self.username(msg))
def secondary_icon(self, msg, **config): if 'github.webhook' in msg['topic']: return self.icon(msg, **config) # Otherwise return avatar_url(self._get_user(msg))
def secondary_icon(self, msg, **config): return avatar_url(username=self.agent(msg, **config))
def secondary_icon(self, msg, **config): try: user = msg['msg']['username'] return avatar_url(user) except KeyError: return None
def secondary_icon(self, msg, **config): if 'user' in msg['msg']: return avatar_url(msg['msg']['user'])
def secondary_icon(self, msg, **config): if 'agent' in msg['msg']: agent = msg['msg']['agent'] # Old style else: agent = msg['msg']['fas_user'] # New style return avatar_url(agent)