Example #1
0
def render_activity(item):
    if not item.group:
        # not implemented
        return

    action_str = ACTIVITY_ACTION_STRINGS[item.type]

    if item.type == Activity.CREATE_ISSUE:
        action_str = action_str.format(**item.data)

    output = ''

    if item.user:
        user = item.user
        name = user.first_name or user.email
        output += '<span class="avatar"><img src="%s"></span> ' % (get_gravatar_url(user.email, size=20),)
        output += '<strong>%s</strong> %s' % (escape(name), action_str)
    else:
        output += '<span class="avatar sentry"></span> '
        output += 'The system %s' % (action_str,)

    output += ' <span class="sep">&mdash;</span> <span class="time">%s</span>' % (timesince(item.datetime),)

    if item.type == Activity.NOTE:
        output += linebreaks(urlize(escape(item.data['text'])))

    return mark_safe(output)
def render_activity(item):
    if not item.group:
        # not implemented
        return

    try:
        action_str = ACTIVITY_ACTION_STRINGS[item.type]
    except KeyError:
        logging.warning('Unknown activity type present: %s', item.type)
        return

    if item.type == Activity.CREATE_ISSUE:
        action_str = action_str.format(**item.data)

    output = ''

    if item.user:
        user = item.user
        name = user.first_name or user.email
        output += '<span class="avatar"><img src="%s"></span> ' % (
            get_gravatar_url(user.email, size=20), )
        output += '<strong>%s</strong> %s' % (escape(name), action_str)
    else:
        output += '<span class="avatar sentry"></span> '
        output += 'The system %s' % (action_str, )

    output += ' <span class="sep">&mdash;</span> <span class="time">%s</span>' % (
        timesince(item.datetime), )

    if item.type == Activity.NOTE:
        output += linebreaks(urlize(escape(item.data['text'])))

    return mark_safe(output)
Example #3
0
def render_activity(item):
    if not item.group:
        # not implemented
        return

    action_str = ACTIVITY_ACTION_STRINGS[item.type]

    if item.type == Activity.CREATE_ISSUE:
        action_str = action_str.format(**item.data)

    output = ''

    if item.user:
        user = item.user
        name = user.first_name or user.email
        output += '<span class="avatar"><img src="%s"></span> ' % (
            get_gravatar_url(user.email, size=20), )
        output += '<strong>%s</strong> %s' % (escape(name), action_str)
    else:
        output += '<span class="avatar sentry"></span> '
        output += 'The system %s' % (action_str, )

    output += ' <span class="sep">&mdash;</span> <span class="time">%s</span>' % (
        timesince(item.datetime), )

    if item.type == Activity.COMMENT:
        output += linebreaks(item.data['body'])

    return mark_safe(output)
Example #4
0
def render_activity(item):
    if not item.group:
        # not implemented
        return

    try:
        action_str = ACTIVITY_ACTION_STRINGS[item.type]
    except KeyError:
        logging.warning('Unknown activity type present: %s', item.type)
        return

    if item.type == Activity.CREATE_ISSUE:
        action_str = action_str.format(**item.data)
    elif item.type == Activity.ASSIGNED:
        if item.data['assignee'] == item.user_id:
            assignee_name = 'themselves'
        else:
            try:
                assignee = User.objects.get(id=item.data['assignee'])
            except User.DoesNotExist:
                assignee_name = 'unknown'
            else:
                assignee_name = assignee.get_display_name()
        action_str = action_str.format(user=assignee_name)

    output = ''

    if item.user:
        user = item.user
        name = user.name or user.email
        output += '<span class="avatar"><img src="%s"></span> ' % (
            get_gravatar_url(user.email, size=20), )
        output += '<strong>%s</strong> %s' % (escape(name), action_str)
    else:
        output += '<span class="avatar sentry"></span> '
        output += 'The system %s' % (action_str, )

    output += ' <span class="sep">&mdash;</span> <span class="time">%s</span>' % (
        timesince(item.datetime), )

    if item.type == Activity.NOTE:
        output += linebreaks(urlize(escape(item.data['text'])))

    return mark_safe(output)
Example #5
0
def render_activity(item):
    if not item.group:
        # not implemented
        return

    try:
        action_str = ACTIVITY_ACTION_STRINGS[item.type]
    except KeyError:
        logging.warning('Unknown activity type present: %s', item.type)
        return

    if item.type == Activity.CREATE_ISSUE:
        action_str = action_str.format(**item.data)
    elif item.type == Activity.ASSIGNED:
        if item.data['assignee'] == item.user_id:
            assignee_name = 'themselves'
        else:
            try:
                assignee = User.objects.get(id=item.data['assignee'])
            except User.DoesNotExist:
                assignee_name = 'unknown'
            else:
                assignee_name = assignee.get_display_name()
        action_str = action_str.format(user=assignee_name)

    output = ''

    if item.user:
        user = item.user
        name = user.first_name or user.email
        output += '<span class="avatar"><img src="%s"></span> ' % (get_gravatar_url(user.email, size=20),)
        output += '<strong>%s</strong> %s' % (escape(name), action_str)
    else:
        output += '<span class="avatar sentry"></span> '
        output += 'The system %s' % (action_str,)

    output += ' <span class="sep">&mdash;</span> <span class="time">%s</span>' % (timesince(item.datetime),)

    if item.type == Activity.NOTE:
        output += linebreaks(urlize(escape(item.data['text'])))

    return mark_safe(output)
Example #6
0
def render_activity(item):
    if not item.group:
        # not implemented
        return

    action_str = ACTIVITY_ACTION_STRINGS[item.type]

    output = '<p>'

    if item.user:
        name = item.user.first_name or item.user.email
        output += '<strong>%s</strong> %s' % (escape(name), action_str)
    else:
        output += 'The system %s' % (action_str, )

    output += ' &mdash; %s</p>' % (timesince(item.datetime), )

    if item.type == Activity.COMMENT:
        output += linebreaks(item.data['body'])

    return mark_safe(output)
Example #7
0
def render_activity(item):
    if not item.group:
        # not implemented
        return

    action_str = ACTIVITY_ACTION_STRINGS[item.type]

    output = "<p>"

    if item.user:
        name = item.user.first_name or item.user.email
        output += "<strong>%s</strong> %s" % (escape(name), action_str)
    else:
        output += "The system %s" % (action_str,)

    output += " &mdash; %s</p>" % (timesince(item.datetime),)

    if item.type == Activity.COMMENT:
        output += linebreaks(item.data["body"])

    return mark_safe(output)
Example #8
0
def render_activity(item):
    if not item.group:
        # not implemented
        return

    action_str = ACTIVITY_ACTION_STRINGS[item.type]

    output = ""

    if item.user:
        user = item.user
        name = user.first_name or user.email
        output += '<span class="avatar"><img src="%s"></span> ' % (get_gravatar_url(user.email, size=20),)
        output += "<strong>%s</strong> %s" % (escape(name), action_str)
    else:
        output += '<span class="avatar sentry"></span> '
        output += "The system %s" % (action_str,)

    output += ' <span class="sep">&mdash;</span> <span class="time">%s</span>' % (timesince(item.datetime),)

    if item.type == Activity.COMMENT:
        output += linebreaks(item.data["body"])

    return mark_safe(output)