Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
les
gancio
Commits
1ccf0397
Verified
Commit
1ccf0397
authored
Apr 26, 2021
by
les
Browse files
return slug in next/prev calculation
parent
691684d9
Changes
1
Hide whitespace changes
Inline
Side-by-side
server/api/controller/event.js
View file @
1ccf0397
...
...
@@ -128,7 +128,7 @@ const eventController = {
// get prev and next event
const
next
=
await
Event
.
findOne
({
attributes
:
[
'
id
'
],
attributes
:
[
'
id
'
,
'
slug
'
],
where
:
{
is_visible
:
true
,
recurrent
:
null
,
...
...
@@ -138,7 +138,7 @@ const eventController = {
})
const
prev
=
await
Event
.
findOne
({
attributes
:
[
'
id
'
],
attributes
:
[
'
id
'
,
'
slug
'
],
where
:
{
is_visible
:
true
,
recurrent
:
null
,
...
...
@@ -149,8 +149,8 @@ const eventController = {
if
(
event
&&
(
event
.
is_visible
||
is_admin
))
{
event
=
event
.
get
()
event
.
next
=
next
&&
next
.
id
event
.
prev
=
prev
&&
prev
.
id
event
.
next
=
next
&&
(
next
.
slug
||
next
.
id
)
event
.
prev
=
prev
&&
(
prev
.
slug
||
prev
.
id
)
event
.
tags
=
event
.
tags
.
map
(
t
=>
t
.
tag
)
if
(
format
===
'
json
'
)
{
res
.
json
(
event
)
...
...
@@ -360,8 +360,8 @@ const eventController = {
const
old_path
=
path
.
resolve
(
config
.
upload_path
,
event
.
image_path
)
const
old_thumb_path
=
path
.
resolve
(
config
.
upload_path
,
'
thumb
'
,
event
.
image_path
)
try
{
await
fs
.
unlinkSync
(
old_path
)
await
fs
.
unlinkSync
(
old_thumb_path
)
fs
.
unlinkSync
(
old_path
)
fs
.
unlinkSync
(
old_thumb_path
)
}
catch
(
e
)
{
log
.
info
(
e
.
toString
())
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment