Skip to content

Commit

Permalink
Merge branch 'main' into refactor-assets-fs
Browse files Browse the repository at this point in the history
  • Loading branch information
lunny authored Apr 12, 2023
2 parents 8980b13 + 42919cc commit d987efa
Show file tree
Hide file tree
Showing 44 changed files with 214 additions and 134 deletions.
33 changes: 20 additions & 13 deletions BSDmakefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# GNU makefile proxy script for BSD make
#
# Written and maintained by Mahmoud Al-Qudsi <[email protected]>
# Copyright NeoSmart Technologies <https://neosmart.net/> 2014-2018
# Copyright NeoSmart Technologies <https://neosmart.net/> 2014-2019
# Obtain updates from <https://github.com/neosmart/gmake-proxy>
#
# Redistribution and use in source and binary forms, with or without
Expand All @@ -26,26 +27,32 @@

JARG =
GMAKE = "gmake"
#When gmake is called from another make instance, -w is automatically added
#which causes extraneous messages about directory changes to be emitted.
#--no-print-directory silences these messages.
# When gmake is called from another make instance, -w is automatically added
# which causes extraneous messages about directory changes to be emitted.
# Running with --no-print-directory silences these messages.
GARGS = "--no-print-directory"

.if "$(.MAKE.JOBS)" != ""
JARG = -j$(.MAKE.JOBS)
JARG = -j$(.MAKE.JOBS)
.endif

#by default bmake will cd into ./obj first
# bmake prefers out-of-source builds and tries to cd into ./obj (among others)
# where possible. GNU Make doesn't, so override that value.
.OBJDIR: ./

# The GNU convention is to use the lowercased `prefix` variable/macro to
# specify the installation directory. Humor them.
GPREFIX = ""
.if defined(PREFIX) && ! defined(prefix)
GPREFIX = 'prefix = "$(PREFIX)"'
.endif

.BEGIN: .SILENT
which $(GMAKE) || printf "Error: GNU Make is required!\n\n" 1>&2 && false

.PHONY: FRC
$(.TARGETS): FRC
$(GMAKE) $(GARGS) $(.TARGETS:S,.DONE,,) $(JARG)
$(GMAKE) $(GPREFIX) $(GARGS) $(.TARGETS:S,.DONE,,) $(JARG)

.DONE .DEFAULT: .SILENT
$(GMAKE) $(GARGS) $(.TARGETS:S,.DONE,,) $(JARG)

.ERROR: .SILENT
if ! which $(GMAKE) > /dev/null; then \
echo "GNU Make is required!"; \
fi
$(GMAKE) $(GPREFIX) $(GARGS) $(.TARGETS:S,.DONE,,) $(JARG)
5 changes: 0 additions & 5 deletions models/issues/milestone.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"context"
"fmt"
"strings"
"time"

"code.gitea.io/gitea/models/db"
repo_model "code.gitea.io/gitea/models/repo"
Expand Down Expand Up @@ -65,7 +64,6 @@ type Milestone struct {
DeadlineString string `xorm:"-"`

TotalTrackedTime int64 `xorm:"-"`
TimeSinceUpdate int64 `xorm:"-"`
}

func init() {
Expand All @@ -84,9 +82,6 @@ func (m *Milestone) BeforeUpdate() {
// AfterLoad is invoked from XORM after setting the value of a field of
// this object.
func (m *Milestone) AfterLoad() {
if !m.UpdatedUnix.IsZero() {
m.TimeSinceUpdate = time.Now().Unix() - m.UpdatedUnix.AsTime().Unix()
}
m.NumOpenIssues = m.NumIssues - m.NumClosedIssues
if m.DeadlineUnix.Year() == 9999 {
return
Expand Down
27 changes: 16 additions & 11 deletions models/repo/attachment.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,18 @@ import (

// Attachment represent a attachment of issue/comment/release.
type Attachment struct {
ID int64 `xorm:"pk autoincr"`
UUID string `xorm:"uuid UNIQUE"`
RepoID int64 `xorm:"INDEX"` // this should not be zero
IssueID int64 `xorm:"INDEX"` // maybe zero when creating
ReleaseID int64 `xorm:"INDEX"` // maybe zero when creating
UploaderID int64 `xorm:"INDEX DEFAULT 0"` // Notice: will be zero before this column added
CommentID int64
Name string
DownloadCount int64 `xorm:"DEFAULT 0"`
Size int64 `xorm:"DEFAULT 0"`
CreatedUnix timeutil.TimeStamp `xorm:"created"`
ID int64 `xorm:"pk autoincr"`
UUID string `xorm:"uuid UNIQUE"`
RepoID int64 `xorm:"INDEX"` // this should not be zero
IssueID int64 `xorm:"INDEX"` // maybe zero when creating
ReleaseID int64 `xorm:"INDEX"` // maybe zero when creating
UploaderID int64 `xorm:"INDEX DEFAULT 0"` // Notice: will be zero before this column added
CommentID int64
Name string
DownloadCount int64 `xorm:"DEFAULT 0"`
Size int64 `xorm:"DEFAULT 0"`
CreatedUnix timeutil.TimeStamp `xorm:"created"`
CustomDownloadURL string `xorm:"-"`
}

func init() {
Expand Down Expand Up @@ -57,6 +58,10 @@ func (a *Attachment) RelativePath() string {

// DownloadURL returns the download url of the attached file
func (a *Attachment) DownloadURL() string {
if a.CustomDownloadURL != "" {
return a.CustomDownloadURL
}

return setting.AppURL + "attachments/" + url.PathEscape(a.UUID)
}

Expand Down
29 changes: 29 additions & 0 deletions models/repo/release.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ package repo
import (
"context"
"fmt"
"net/url"
"sort"
"strconv"
"strings"
Expand Down Expand Up @@ -372,6 +373,34 @@ func GetReleaseAttachments(ctx context.Context, rels ...*Release) (err error) {
sortedRels.Rel[currentIndex].Attachments = append(sortedRels.Rel[currentIndex].Attachments, attachment)
}

// Makes URL's predictable
for _, release := range rels {
// If we have no Repo, we don't need to execute this loop
if release.Repo == nil {
continue
}

// Check if there are two or more attachments with the same name
hasDuplicates := false
foundNames := make(map[string]bool)
for _, attachment := range release.Attachments {
_, found := foundNames[attachment.Name]
if found {
hasDuplicates = true
break
} else {
foundNames[attachment.Name] = true
}
}

// If the names unique, use the URL with the Name instead of the UUID
if !hasDuplicates {
for _, attachment := range release.Attachments {
attachment.CustomDownloadURL = release.Repo.HTMLURL() + "/releases/download/" + url.PathEscape(release.TagName) + "/" + url.PathEscape(attachment.Name)
}
}
}

return err
}

Expand Down
4 changes: 1 addition & 3 deletions options/locale/locale_cs-CZ.ini
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ never=Nikdy

rss_feed=RSS kanál


[aria]
navbar=Navigační lišta
footer=Patička
Expand Down Expand Up @@ -2247,8 +2248,6 @@ release.edit_subheader=Vydání organizuje verze projektu.
release.tag_name=Název značky
release.target=Cíl
release.tag_helper=Vyberte existující značku nebo vytvořte novou značku.
release.title=Název
release.content=Obsah
release.prerelease_desc=Označit jako předběžná verze
release.prerelease_helper=Označit vydání jako nevhodné pro produkční nasazení.
release.cancel=Zrušit
Expand Down Expand Up @@ -3109,7 +3108,6 @@ details.documentation_site=Stránka dokumentace
details.license=Licence
assets=Prostředky
versions=Verze
versions.on=
versions.view_all=Zobrazit všechny
dependency.id=ID
dependency.version=Verze
Expand Down
4 changes: 1 addition & 3 deletions options/locale/locale_de-DE.ini
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ never=Niemals

rss_feed=RSS Feed


[aria]

[filter]
Expand Down Expand Up @@ -2184,8 +2185,6 @@ release.edit_subheader=In Releases werden Projektversionen verwaltet.
release.tag_name=Tag-Name
release.target=Ziel
release.tag_helper=Wähle einen existierenden oder erstelle einen neuen Tag.
release.title=Titel
release.content=Inhalt
release.prerelease_desc=Als Pre-Release kennzeichnen
release.prerelease_helper=Dieses Release als „ungeeignet für den produktiven Einsatz“ markieren.
release.cancel=Abbrechen
Expand Down Expand Up @@ -3035,7 +3034,6 @@ details.project_site=Projektseite
details.license=Lizenz
assets=Dateien
versions=Versionen
versions.on=am
versions.view_all=Alle anzeigen
dependency.id=ID
dependency.version=Version
Expand Down
4 changes: 1 addition & 3 deletions options/locale/locale_el-GR.ini
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ never=Ποτέ

rss_feed=Ροή RSS


[aria]
navbar=Γραμμή Πλοήγησης
footer=Υποσέλιδο
Expand Down Expand Up @@ -2277,8 +2278,6 @@ release.target=Στόχος
release.tag_helper=Επιλέξτε μια υπάρχουσα ετικέτα ή δημιουργήστε μια νέα.
release.tag_helper_new=Νέα ετικέτα. Αυτή η ετικέτα θα δημιουργηθεί από τον προορισμό.
release.tag_helper_existing=Υπάρχουσα ετικέτα.
release.title=Τίτλος
release.content=Περιεχόμενο
release.prerelease_desc=Σήμανση ως Προ-Κυκλοφορία
release.prerelease_helper=Σημείωση αυτής της κυκλοφορίας ως ακατάλληλη για χρήση στη παραγωγή.
release.cancel=Ακύρωση
Expand Down Expand Up @@ -3148,7 +3147,6 @@ details.documentation_site=Ιστοσελίδα Τεκμηρίωσης
details.license=Άδεια
assets=Πόροι
versions=Εκδόσεις
versions.on=τη
versions.view_all=Προβολή όλων
dependency.id=ID
dependency.version=Έκδοση
Expand Down
2 changes: 1 addition & 1 deletion options/locale/locale_en-US.ini
Original file line number Diff line number Diff line change
Expand Up @@ -1710,7 +1710,7 @@ pulls.delete.text = Do you really want to delete this pull request? (This will p

milestones.new = New Milestone
milestones.closed = Closed %s
milestones.update_ago = Updated %s ago
milestones.updated = Updated
milestones.no_due_date = No due date
milestones.open = Open
milestones.close = Close
Expand Down
4 changes: 1 addition & 3 deletions options/locale/locale_es-ES.ini
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ never=Nunca

rss_feed=Fuentes RSS


[aria]

[filter]
Expand Down Expand Up @@ -2215,8 +2216,6 @@ release.edit_subheader=Los lanzamientos organizan las versiones de proyectos.
release.tag_name=Nombre de la etiqueta
release.target=Destino
release.tag_helper=Escoge una etiqueta existente o crea una nueva.
release.title=Título
release.content=Contenido
release.prerelease_desc=Marcar como Pre-Lanzamiento
release.prerelease_helper=Marcar este lanzamiento como no es adecuada para usar en producción.
release.cancel=Cancelar
Expand Down Expand Up @@ -3070,7 +3069,6 @@ details.project_site=Sitio del proyecto
details.license=Licencia
assets=Activos
versions=Versiones
versions.on=en
versions.view_all=Ver todo
dependency.id=Id.
dependency.version=Versión
Expand Down
3 changes: 1 addition & 2 deletions options/locale/locale_fa-IR.ini
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ error404=صفحه موردنظر شما یا <strong>وجود ندارد</strong
never=هرگز



[aria]

[filter]
Expand Down Expand Up @@ -2025,8 +2026,6 @@ release.edit_subheader=انتشارها نسخ پروژه را سازمانده
release.tag_name=نام برچسب
release.target=هدف/مقصد
release.tag_helper=از تگ های موجود استفاده کنید یا تگ جدیدی را هنگام انتشار ایجاد کنید.
release.title=عنوان
release.content=محتوا
release.prerelease_desc=علامت‌گذاری به عنوان پیش-انتشار
release.prerelease_helper=علامت گذاری این انتشار به عنوان نامناسب برای استفاده در محصول نهایی.
release.cancel=انصراف
Expand Down
3 changes: 1 addition & 2 deletions options/locale/locale_fi-FI.ini
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ never=Ei koskaan

rss_feed=RSS-syöte


[aria]

[filter]
Expand Down Expand Up @@ -1335,8 +1336,6 @@ release.edit_subheader=Julkaisut organisoivat projektien versioita.
release.tag_name=Taginimi
release.target=Kohde
release.tag_helper=Valitse olemassa oleva tagi tai luo uusi tagi.
release.title=Otsikko
release.content=Sisältö
release.prerelease_desc=Merkitse ensijulkaisuksi
release.prerelease_helper=Merkitse tämä julkaisu epäsopivaksi tuotantokäyttöön.
release.cancel=Peruuta
Expand Down
3 changes: 1 addition & 2 deletions options/locale/locale_fr-FR.ini
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ never=Jamais

rss_feed=Flux RSS


[aria]

[filter]
Expand Down Expand Up @@ -1864,8 +1865,6 @@ release.edit_subheader=Les versions organisent les versions publiées du projet.
release.tag_name=Nom du tag
release.target=Cible
release.tag_helper=Choisissez une étiquette existante ou créez une nouvelle étiquette.
release.title=Titre
release.content=Contenu
release.prerelease_desc=Marquer comme pré-version
release.prerelease_helper=Marquer cette version comme impropre à la production.
release.cancel=Annuler
Expand Down
3 changes: 1 addition & 2 deletions options/locale/locale_hu-HU.ini
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ error404=Az elérni kívánt oldal vagy <strong>nem létezik</strong>, vagy <str




[aria]

[filter]
Expand Down Expand Up @@ -1199,8 +1200,6 @@ release.edit=szerkesztés
release.source_code=Forráskód
release.tag_name=Címke neve
release.target=Cél
release.title=Cím
release.content=Tartalom
release.cancel=Mégse
release.publish=Kiadás közzététele
release.save_draft=Piszkozat mentése
Expand Down
3 changes: 1 addition & 2 deletions options/locale/locale_id-ID.ini
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ loading=Memuat…




[aria]

[filter]
Expand Down Expand Up @@ -972,8 +973,6 @@ release.edit=edit
release.source_code=Sumber kode
release.tag_name=Tag nama
release.target=Target
release.title=Judul
release.content=Konten
release.cancel=Membatalkan
release.publish=Mempublikasikan Rilis
release.save_draft=Simpan Draft
Expand Down
4 changes: 1 addition & 3 deletions options/locale/locale_is-IS.ini
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ error404=Síðan sem þú ert að reyna að fá annað hvort <strong>er ekki til
never=Aldrei



[aria]

[filter]
Expand Down Expand Up @@ -1124,8 +1125,6 @@ release.draft=Uppkast
release.compare=Bera saman
release.edit=breyta
release.tag_name=Merkisheiti
release.title=Heiti
release.content=Innihald
release.cancel=Hætta við
release.delete_tag=Eyða Merki
release.downloads=Niðurhöl
Expand Down Expand Up @@ -1360,7 +1359,6 @@ details=Nánar
details.author=Höfundur
details.license=Hugbúnaðarleyfi
versions=Útgáfur
versions.on
versions.view_all=Sjá allar
dependency.id=Auðkenni
dependency.version=Útgáfa
Expand Down
Loading

0 comments on commit d987efa

Please sign in to comment.