]> git.ipfire.org Git - pbs.git/commitdiff
releases: "Publish" instead of "Release"
authorMichael Tremer <michael.tremer@ipfire.org>
Wed, 14 Jun 2023 14:12:42 +0000 (14:12 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Wed, 14 Jun 2023 14:12:42 +0000 (14:12 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/buildservice/distribution.py
src/buildservice/events.py
src/database.sql
src/templates/distros/releases/modules/list.html
src/templates/events/modules/system-message.html

index 102a4bcead50137c5d5a0d728cdc99704c63b0ba..e269e543f42db8dcf4dc3456977c6d7c531085e9 100644 (file)
@@ -1,5 +1,6 @@
 #!/usr/bin/python
 
+import datetime
 import logging
 
 from . import base
@@ -418,7 +419,7 @@ class Distribution(base.DataObject):
        @lazy_property
        def latest_release(self):
                """
-                       Returns the latest (released) release
+                       Returns the latest and published release
                """
                return self.backend.distros.releases._get_release("""
                        SELECT
@@ -430,9 +431,9 @@ class Distribution(base.DataObject):
                        AND
                                deleted_at IS NULL
                        AND
-                               released_at IS NOT NULL
+                               published_at IS NOT NULL
                        AND
-                               released_at <= CURRENT_TIMESTAMP
+                               published_at <= CURRENT_TIMESTAMP
                        """, self.id,
                )
 
@@ -579,26 +580,26 @@ class Release(base.DataObject):
        def url(self):
                return "/distros/%s/releases/%s" % (self.distro.slug, self.slug)
 
-       # Release
+       # Publish
 
-       def is_released(self):
-               if self.released_at:
+       def is_published(self):
+               if self.published_at and self.published_at <= datetime.datetime.utcnow():
                        return True
 
                return False
 
        @property
-       def released_at(self):
-               return self.data.released_at
+       def published_at(self):
+               return self.data.published_at
 
-       async def release(self, when=None):
+       async def publish(self, when=None):
                """
-                       Called to prepare releasing the release
+                       Called to publish the release
                """
                if when:
-                       self._set_attribute("released_at", when)
+                       self._set_attribute("published_at", when)
                else:
-                       self._set_attribute_now("released_at")
+                       self._set_attribute_now("published_at")
 
                # XXX TODO
 
index e5028adc8979f21845858dad770063ff161f980d..e4438c0c13aa21516f1ae6599e25768b49b94caa 100644 (file)
@@ -705,10 +705,10 @@ class Events(base.Object):
 
                                UNION ALL
 
-                               -- Releases Released
+                               -- Releases Published
                                SELECT
-                                       'release-released' AS type,
-                                       releases.released_at AS t,
+                                       'release-published' AS type,
+                                       releases.published_at AS t,
                                        CASE WHEN releases.stable IS TRUE
                                                THEN 5 ELSE 4 END AS priority,
                                        NULL AS build,
@@ -729,9 +729,9 @@ class Events(base.Object):
                                FROM
                                        releases
                                WHERE
-                                       released_at IS NOT NULL
+                                       published_at IS NOT NULL
                                AND
-                                       released_at <= CURRENT_TIMESTAMP
+                                       published_at <= CURRENT_TIMESTAMP
 
                                UNION ALL
 
index 823c35bf5c5c450472c522806f8616f42329ea51..cd53604ca48ad19589d567a069f585b4b5dad62b 100644 (file)
@@ -241,6 +241,25 @@ CREATE TABLE public.release_monitorings (
 );
 
 
+--
+-- Name: releases; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.releases (
+    id integer NOT NULL,
+    distro_id integer NOT NULL,
+    name text NOT NULL,
+    slug text NOT NULL,
+    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
+    created_by integer NOT NULL,
+    deleted_at timestamp without time zone,
+    deleted_by integer,
+    published_at timestamp without time zone,
+    stable boolean DEFAULT false NOT NULL,
+    announcement text
+);
+
+
 --
 -- Name: repository_builds; Type: TABLE; Schema: public; Owner: -
 --
@@ -794,25 +813,6 @@ CREATE SEQUENCE public.release_monitorings_id_seq
 ALTER SEQUENCE public.release_monitorings_id_seq OWNED BY public.release_monitorings.id;
 
 
---
--- Name: releases; Type: TABLE; Schema: public; Owner: -
---
-
-CREATE TABLE public.releases (
-    id integer NOT NULL,
-    distro_id integer NOT NULL,
-    name text NOT NULL,
-    slug text NOT NULL,
-    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
-    created_by integer NOT NULL,
-    deleted_at timestamp without time zone,
-    deleted_by integer,
-    released_at timestamp without time zone,
-    stable boolean DEFAULT false NOT NULL,
-    announcement text
-);
-
-
 --
 -- Name: releases_id_seq; Type: SEQUENCE; Schema: public; Owner: -
 --
index ed0ac800520d445da3a7b62cf07ddebc89d8a2ec..bae760571dda50affb84f090878a6b30b21fa1db 100644 (file)
 
                                                {# Release Date #}
                                                <div class="level-item">
-                                                       {% if release.is_released() %}
-                                                               {{ locale.format_date(release.released_at) }}
+                                                       {% if release.is_published() %}
+                                                               {{ locale.format_date(release.published_at) }}
                                                        {% else %}
                                                                <span class="has-text-warning">
-                                                                       {{ _("Not released, yet") }}
+                                                                       {{ _("Not published, yet") }}
                                                                </span>
                                                        {% end %}
                                                </div>
index a4670e75a0c6754b07bcdf049c776d4b42aee50d..014f9b331c23c166e9e44906e2ea3350e41c7bb2 100644 (file)
@@ -97,7 +97,7 @@
                                <p class="icon is-large has-text-danger">
                                        <i class="fa-solid fa-2x fa-box"></i>
                                </p>
-                       {% elif event.type == "release-released" %}
+                       {% elif event.type == "release-published" %}
                                <p class="icon is-large has-text-info">
                                        <i class="fa-solid fa-2x fa-cake-candles"></i>
                                </p>
                                        {{ _("Release Created")}}
                                {% elif event.type == "release-deleted" %}
                                        {{ _("Release Deleted") }}
-                               {% elif event.type == "release-released" %}
+                               {% elif event.type == "release-published" %}
                                        {{ _("Release of %s") % event.release }}
                                {% else %}
                                        {{ _("- Unknown Event %s -") % event.type }}