Albirew/nyaa-pantsu
Archivé
1
0
Bifurcation 0
Cette révision appartient à :
akuma06 2017-05-23 04:12:02 +02:00
Parent 99f2092028
révision b75fc9ce53
2 fichiers modifiés avec 12 ajouts et 8 suppressions

Voir le fichier

@ -255,6 +255,10 @@ func (f *UploadForm) ExtractEditInfo(r *http.Request) error {
return ErrInvalidTorrentCategory
}
if !categories.CategoryExists(f.Category) {
return ErrInvalidTorrentCategory
}
f.CategoryID = CatID
f.SubCategoryID = SubCatID
} else {
@ -289,4 +293,4 @@ func NewUploadForm(params ...string) (uploadForm UploadForm) {
uploadForm.Description = "Description"
}
return
}
}

Voir le fichier

@ -134,13 +134,12 @@ func TorrentEditUserPanel(w http.ResponseWriter, r *http.Request) {
messages:= msg.GetMessages(r)
currentUser := GetUser(r)
if userPermission.CurrentOrAdmin(currentUser, torrent.UploaderID) {
torrentJson := torrent.ToJSON()
uploadForm := NewUploadForm()
uploadForm.Name = torrentJson.Name
uploadForm.Category = torrentJson.Category + "_" + torrentJson.SubCategory
uploadForm.Status = torrentJson.Status
uploadForm.WebsiteLink = string(torrentJson.WebsiteLink)
uploadForm.Description = string(torrentJson.Description)
uploadForm.Name = torrent.Name
uploadForm.Category = strconv.Itoa(torrent.Category) + "_" + strconv.Itoa(torrent.SubCategory)
uploadForm.Remake = torrent.Status == model.TorrentStatusRemake
uploadForm.WebsiteLink = string(torrent.WebsiteLink)
uploadForm.Description = string(torrent.Description)
htv := UserTorrentEdVbs{NewCommonVariables(r), uploadForm, messages.GetAllErrors(), messages.GetAllInfos()}
err := userTorrentEd.ExecuteTemplate(w, "index.html", htv)
log.CheckError(err)
@ -162,6 +161,7 @@ func TorrentPostEditUserPanel(w http.ResponseWriter, r *http.Request) {
}
if !messages.HasErrors() {
status := model.TorrentStatusNormal
uploadForm.Remake = r.FormValue(UploadFormRemake) == "on"
if uploadForm.Remake { // overrides trusted
status = model.TorrentStatusRemake
} else if currentUser.IsTrusted() {
@ -205,4 +205,4 @@ func TorrentDeleteUserPanel(w http.ResponseWriter, r *http.Request) {
} else {
NotFoundHandler(w, r)
}
}
}