]> git.ipfire.org Git - pbs.git/commitdiff
builds: Drop old watcher handlers
authorMichael Tremer <michael.tremer@ipfire.org>
Mon, 17 Oct 2022 15:36:51 +0000 (15:36 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Mon, 17 Oct 2022 15:36:51 +0000 (15:36 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Makefile.am
src/templates/builds-watchers-add.html [deleted file]
src/templates/builds-watchers-list.html [deleted file]
src/web/__init__.py
src/web/builds.py

index e134d33e88ffe553e222fb934d552df60c419d08..20b3f04cf8e6342ea34d9c8d7c84633c0288772b 100644 (file)
@@ -160,8 +160,6 @@ dist_templates_DATA = \
        src/templates/build-manage.html \
        src/templates/build-schedule-test.html \
        src/templates/build-state.html \
-       src/templates/builds-watchers-add.html \
-       src/templates/builds-watchers-list.html \
        src/templates/distro-edit.html \
        src/templates/distro-source-commit-detail.html \
        src/templates/distro-source-commit-reset.html \
diff --git a/src/templates/builds-watchers-add.html b/src/templates/builds-watchers-add.html
deleted file mode 100644 (file)
index 1a04f53..0000000
+++ /dev/null
@@ -1,90 +0,0 @@
-{% extends "base.html" %}
-
-{% block title %}{{ _("Watch build %s") % build.name }}{% end block %}
-
-{% block body %}
-       <ul class="breadcrumb">
-               <li>
-                       <a href="/">{{ _("Home") }}</a>
-                       <span class="divider">/</span>
-               </li>
-               <li>
-                       <a href="/packages">{{ _("Packages") }}</a>
-                       <span class="divider">/</span>
-               </li>
-               <li>
-                       <a href="/package/{{ build.pkg.name }}">{{ build.pkg.name }}</a>
-                       <span class="divider">/</span>
-               </li>
-               <li>
-                       <a href="/build/{{ build.uuid }}">{{ build.pkg.friendly_version }}</a>
-                       <span class="divider">/</span>
-               </li>
-               <li class="active">
-                       <a href="/build/{{ build.uuid }}/watch">{{ _("Watch") }}</a>
-               </li>
-       </ul>
-
-       <div class="page-header">
-               <h1>{{ _("Watch build %s") % build.name }}</h1>
-       </div>
-
-       <div class="row">
-               <div class="span12">
-                       <p>
-                               {{ _("You may here add yourself to the list of watchers of this build.") }}
-                               {{ _("If you do so, you will receive messages about new comments and status updates.") }}
-                       </p>
-               </div>
-       </div>
-
-       {% if not current_user.is_admin() and current_user in watchers %}
-               <div class="alert alert-block">
-                       <h4 class="alert-heading">{{ _("Oops!") }}</h4>
-                       {{ _("You are already watching this build.") }}
-               </div>
-       {% end %}
-
-       <div class="row">
-               <div class="span6 offset3">
-                       <form class="form-horizontal" method="POST" action="">
-                               {% raw xsrf_form_html() %}
-
-                               <fieldset>
-                                       {% if current_user.is_admin() %}
-                                               <div class="control-group">
-                                                       <label class="control-label">{{ _("Choose user") }}</label>
-                                                       <div class="controls">
-                                                               <select name="user_id">
-                                                                       {% if not current_user in watchers %}
-                                                                               <option value="{{ current_user.id }}">{{ _("Myself") }}</option>
-                                                                               <option value="" disabled>--------</option>
-                                                                       {% end %}
-
-                                                                       {% for user in [u for u in users if not u in watchers] %}
-                                                                               <option value="{{ user.id }}">{{ user.realname }}</option>
-                                                                       {% end %}
-                                                               </select>
-                                                       
-                                                               <p class="help-block">
-                                                                       {{ _("Choose a user who should watch this build.") }}
-                                                               </p>
-                                                       </div>
-                                               </div>
-                                       {% else %}
-                                               <div class="control-group">
-                                                       <label class="control-label">{{ _("User") }}</label>
-                                                       <div class="controls">
-                                                               <span class="input-xlarge uneditable-input">{{ current_user.realname }}</span>
-                                                       </div>
-                                               </div>
-                                       {% end %}
-
-                                       <div class="form-actions">
-                                               <button type="submit" class="btn btn-primary">{{ _("Add watcher") }}</button>
-                                       </div>
-                               </fieldset>
-                       </form>
-               </div>
-       </div>
-{% end block %}
diff --git a/src/templates/builds-watchers-list.html b/src/templates/builds-watchers-list.html
deleted file mode 100644 (file)
index 8f89ec9..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-{% extends "base.html" %}
-
-<!-- XXX I THINK THIS IS UNUSED -->
-
-{% block title %}{{ _("Build") }}: {{ _("Watchers of %s") % build.name }}{% end block %}
-
-{% block body %}
-       <h1>{{ _("Build") }}: {{ _("Watchers of %s") % build.name }}</h1>
-
-       <p>
-               {{ _("This is a list of all users who watch this build.") }}
-               {{ _("If you write a comment or the status of the build is changed, they all will get a message.") }}
-       </p>
-
-       {% if current_user in watchers %}
-               <p>
-                       {{ _("You are already watching this build.") }}
-               </p>
-       {% elif build.owner and current_user == build.owner %}
-               <p>
-                       {{ _("You are the owner of this build. So you don't need to watch it.") }}
-               </p>
-       {% else %}
-               <p>
-                       <a href="/build/{{ build.uuid }}/watch">{{ _("Watch this build.") }}</a>
-               </p>
-       {% end %}
-
-       <table class="form form2">
-               <tr>
-                       <td class="col1">{{ _("Build") }}</td>
-                       <td class="col2">
-                               <a href="/build/{{ build.uuid }}">{{ build.name }}</a>
-                       </td>
-               </tr>
-       </table>
-       <div style="clear: both;">&nbsp;</div>
-
-       <h2>{{ _("List of all watchers") }}</h2>
-       <ul class="watchers">
-               {% for watcher in watchers %}
-                       <li class="user">
-                               <a class="{{ watcher.state }}" href="/user/{{ watcher.name }}">{{ watcher.realname }}</a>
-                       </li>
-               {% end %}
-       </ul>
-{% end block %}
-
-{% block sidebar %}
-       <h1>{{ _("Actions") }}</h1>
-       <ul>
-               <li>
-                       <a href="/build/{{ build.uuid }}">{{ _("Back to build") }}</a>
-               </li>
-       </ul>
-{% end %}
index b45309effe97c069c26d5d38f514c3279ff4ab99..67dd208ccd2eb7aae7275ba4ed8c8a1c103e1b0b 100644 (file)
@@ -138,8 +138,6 @@ class Application(tornado.web.Application):
                        (r"/build/([\w]{8}-[\w]{4}-[\w]{4}-[\w]{4}-[\w]{12})/manage", builds.BuildManageHandler),
                        (r"/build/([\w]{8}-[\w]{4}-[\w]{4}-[\w]{4}-[\w]{12})/comment", builds.BuildDetailCommentHandler),
                        (r"/build/([\w]{8}-[\w]{4}-[\w]{4}-[\w]{4}-[\w]{12})/state", builds.BuildStateHandler),
-                       (r"/build/([\w]{8}-[\w]{4}-[\w]{4}-[\w]{4}-[\w]{12})/watch", builds.BuildWatchersAddHandler),
-                       (r"/build/([\w]{8}-[\w]{4}-[\w]{4}-[\w]{4}-[\w]{12})/watchers", builds.BuildWatchersHandler),
                        (r"/build/([\w]{8}-[\w]{4}-[\w]{4}-[\w]{4}-[\w]{12})/delete", builds.BuildDeleteHandler),
 
                        (r"/queue", jobs.QueueHandler),
index f49d0c37d603f92604f56e5371ba51e69b014617..d209ca0015e4a2415a42eba0ed02e0c001c41897 100644 (file)
@@ -181,62 +181,6 @@ class BuildManageHandler(base.BaseHandler):
                self.redirect("/build/%s" % build.uuid)
 
 
-class BuildWatchersHandler(base.BaseHandler):
-       def get(self, uuid):
-               build = self.backend.builds.get_by_uuid(uuid)
-
-               if not build:
-                       raise tornado.web.HTTPError(404, "Build not found")
-
-               # Get a list of all watchers and sort them by their realname.
-               watchers = build.get_watchers()
-               watchers.sort(key=lambda watcher: watcher.realname)
-
-               self.render("builds-watchers-list.html", build=build, watchers=watchers)
-
-
-class BuildWatchersAddHandler(base.BaseHandler):
-       @tornado.web.authenticated
-       def get(self, uuid, error_msg=None):
-               build = self.backend.builds.get_by_uuid(uuid)
-
-               if not build:
-                       raise tornado.web.HTTPError(404, "Build not found")
-
-               # Get a list of all users that are currently watching this build.
-               watchers = build.get_watchers()
-
-               self.render("builds-watchers-add.html", error_msg=error_msg,
-                       build=build, users=self.backend.users, watchers=watchers)
-
-       @tornado.web.authenticated
-       def post(self, uuid):
-               build = self.backend.builds.get_by_uuid(uuid)
-
-               if not build:
-                       raise tornado.web.HTTPError(404, "Build not found")
-
-               # Get the user id of the new watcher.
-               user_id = self.current_user.id
-
-               if self.current_user.is_admin():
-                       user_id = self.get_argument("user_id", self.current_user.id)
-               assert user_id
-
-               user = self.backend.users.get_by_id(user_id)
-               if not user:
-                       _ = self.locale.translate
-                       error_msg = _("User not found.")
-
-                       return self.get(uuid, error_msg=error_msg)
-
-               # Actually add the user to the list of watchers.
-               build.add_watcher(user)
-
-               # Send user back to the build detail page.
-               self.redirect("/build/%s" % build.uuid)
-
-
 class ListModule(ui_modules.UIModule):
        def render(self, builds):
                return self.render_string("builds/modules/list.html", builds=builds)