# build_comment
# user
# by_user
+# repository
#
EVENTS_VIEW = """
WITH events AS (
NULL::integer AS by_build,
NULL::integer AS build_comment,
NULL::integer AS user,
- builds.owner_id AS by_user
+ builds.owner_id AS by_user,
+ NULL::integer AS repository
FROM
builds
NULL AS by_build,
NULL AS build_comment,
NULL AS user,
- NULL AS by_user
+ NULL AS by_user,
+ NULL AS repository
FROM
builds
WHERE
NULL AS by_build,
NULL AS build_comment,
NULL AS user,
- builds.deleted_by AS by_user
+ builds.deleted_by AS by_user,
+ NULL AS repository
FROM
builds
WHERE
builds.deprecating_build_id AS by_build,
NULL AS build_comment,
NULL AS user,
- builds.deprecated_by AS by_user
+ builds.deprecated_by AS by_user,
+ NULL AS repository
FROM
builds
WHERE
NULL AS by_build,
build_comments.id AS build_comment,
NULL AS user,
- build_comments.user_id AS by_user
+ build_comments.user_id AS by_user,
+ NULL AS repository
FROM
build_comments
WHERE
NULL AS by_build,
NULL AS build_comment,
build_watchers.user_id AS user,
- NULL AS by_user
+ NULL AS by_user,
+ NULL AS repository
FROM
build_watchers
NULL AS by_build,
NULL AS build_comment,
build_watchers.user_id AS user,
- NULL AS by_user
+ NULL AS by_user,
+ NULL AS repository
FROM
build_watchers
WHERE
deleted_at IS NOT NULL
+
+ UNION ALL
+
+ -- Build added to repository
+ SELECT
+ 'repository-build-added' AS type,
+ repository_builds.added_at AS t,
+ 5 AS priority,
+ repository_builds.build_id AS build,
+ NULL AS by_build,
+ NULL AS build_comment,
+ NULL AS user,
+ repository_builds.added_by AS by_user,
+ repository_builds.repo_id AS repository
+ FROM
+ repository_builds
+
+ UNION ALL
+
+ -- Build removed from repository
+ SELECT
+ 'repository-build-removed' AS type,
+ repository_builds.removed_at AS t,
+ 5 AS priority,
+ repository_builds.build_id AS build,
+ NULL AS by_build,
+ NULL AS build_comment,
+ NULL AS user,
+ repository_builds.removed_by AS by_user,
+ repository_builds.repo_id AS repository
+ FROM
+ repository_builds
+ WHERE
+ removed_at IS NOT NULL
)
"""
# Build Comments
"build_comment" : self.backend.builds.comments.get_by_id,
+ # Repositories
+ "repository" : self.backend.repos.get_by_id,
+
# Users
"user" : self.backend.users.get_by_id,
"by_user" : self.backend.users.get_by_id,
{{ _("%s started watching this build") % event.user }}
{% elif event.type == "build-watcher-removed" %}
{{ _("%s stopped watching this build") % event.user }}
+ {% elif event.type == "repository-build-added" %}
+ {{ _("Build has been added to repository %s") % event.repository }}
+ {% elif event.type == "repository-build-removed" %}
+ {{ _("Build has been removed from repository %s") % event.repository }}
{% else %}
{{ _("- Unknown Event -") }}
{% end %}
</a>
{% end %}
+ {# Repository #}
+ {% if event.repository %}
+ <a class="level-item" href="{{ event.repository.url }}">
+ {{ event.repository }}
+ </a>
+ {% end %}
+
{# By User #}
{% if event.by_user %}
<a class="level-item" href="/users/{{ event.by_user.name }}">