Skip to content
Next
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in / Register
Toggle navigation
Minds Frontend
Project
Project
Details
Activity
Releases
Cycle Analytics
Insights
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Locked Files
Issues
842
Issues
842
List
Boards
Labels
Service Desk
Milestones
Merge Requests
46
Merge Requests
46
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Security & Compliance
Security & Compliance
Dependency List
Packages
Packages
List
Container Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Minds
Minds Frontend
Compare Revisions
c17a9876be38ed3b79b40589549b073886cb375e...5ae9506b887475024c4fa4ee8c87c0bb60376dd8
Source
5ae9506b887475024c4fa4ee8c87c0bb60376dd8
Select Git revision
...
Target
c17a9876be38ed3b79b40589549b073886cb375e
Select Git revision
Compare
Commits (2)
(fix) Datepicker returns correct time in boost campaign creator - Fixes
#1530
· 27023b5a
Guy Thouret
authored
1 hour ago
27023b5a
(chore) Date validation for boost campaigns -
#1607
· 5ae9506b
Guy Thouret
authored
1 hour ago
5ae9506b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
16 deletions
+19
-16
campaigns.service.ts
src/app/modules/boost/campaigns/campaigns.service.ts
+12
-7
creator.component.html
...pp/modules/boost/campaigns/creator/creator.component.html
+2
-7
creator.component.ts
src/app/modules/boost/campaigns/creator/creator.component.ts
+5
-2
No files found.
src/app/modules/boost/campaigns/campaigns.service.ts
View file @
5ae9506b
...
...
@@ -71,29 +71,34 @@ export class CampaignsService {
throw
new
Error
(
'
End date not defined
'
);
}
// start date should be before end date
if
(
campaign
.
start
>=
campaign
.
end
)
{
throw
new
Error
(
'
End date should be a after the start date
'
);
throw
new
Error
(
'
End date must be after start date
'
);
}
const
oneMonthFromStart
=
new
Date
(
campaign
.
start
);
oneMonthFromStart
.
setMonth
(
oneMonthFromStart
.
getMonth
()
+
1
);
if
(
campaign
.
end
>
oneMonthFromStart
.
getTime
())
{
throw
new
Error
(
'
Campaign end date can not be more than one month from start
'
);
}
// if we're editing, end date can't be modified to an earlier date
if
(
campaign
.
delivery_status
&&
campaign
.
delivery_status
==
'
created
'
&&
campaign
.
delivery_status
==
=
'
created
'
&&
campaign
.
original_campaign
&&
campaign
.
end
<
campaign
.
original_campaign
.
end
)
{
throw
new
Error
(
'
You can only change End date to a later one from the original
'
'
Changing end to an earlier date is not allowed while campaign is running
'
);
}
// budget should be bigger than zero integer
if
(
!
campaign
.
budget
||
campaign
.
budget
===
0
||
!
isInt
(
campaign
.
budget
))
{
throw
new
Error
(
'
Budget must be a bigger-than-zero integer
'
);
}
if
(
!
campaign
.
entity_urns
||
campaign
.
entity_urns
.
length
==
0
)
{
if
(
!
campaign
.
entity_urns
||
campaign
.
entity_urns
.
length
==
=
0
)
{
throw
new
Error
(
'
You must include something to boost
'
);
}
...
...
This diff is collapsed.
Click to expand it.
src/app/modules/boost/campaigns/creator/creator.component.html
View file @
5ae9506b
...
...
@@ -144,14 +144,11 @@
<div
class=
"m-form--field"
>
<label
for=
"boost-creator__start"
class=
"m-form--field-label"
>
<span
i18n
>
Start
</span>
<m-tooltip
icon=
"help"
i18n
>
TBD
</m-tooltip>
</label>
<div
class=
"m-date-selector--input"
mdl-datetime-picker
[dateFormat]=
"'MM/DD/YY, h:mm a Z'"
[useUTC]=
"true"
[date]=
"campaign.start"
(dateChange)=
"onStartDateChange($event); triggerPreview()"
>
...
...
@@ -160,7 +157,7 @@
type=
"text"
placeholder=
"Now"
i18n
[value]=
"campaign.start |
utcDate | date: 'MMM dd
'"
[value]=
"campaign.start |
date: 'MMM dd HH:mm
'"
readonly
/>
<i
class=
"material-icons"
>
keyboard_arrow_down
</i>
...
...
@@ -170,7 +167,6 @@
<div
class=
"m-form--field"
>
<label
for=
"boost-creator__end"
class=
"m-form--field-label"
>
<span
i18n
>
End
</span>
<m-tooltip
icon=
"help"
i18n
>
TBD
</m-tooltip>
</label>
<div
...
...
@@ -182,9 +178,8 @@
<input
id=
"boost-creator__end"
type=
"text"
placeholder=
"End of times"
i18n
[value]=
"campaign.end |
utcDate | date: 'MMM dd
'"
[value]=
"campaign.end |
date: 'MMM dd HH:mm
'"
readonly
/>
<i
class=
"material-icons"
>
keyboard_arrow_down
</i>
...
...
This diff is collapsed.
Click to expand it.
src/app/modules/boost/campaigns/creator/creator.component.ts
View file @
5ae9506b
...
...
@@ -120,6 +120,9 @@ export class BoostCampaignsCreatorComponent implements OnInit, OnDestroy {
}
reset
()
{
const
interval
=
1000
*
60
*
5
;
const
date
=
new
Date
();
const
start
=
new
Date
(
Math
.
ceil
(
date
.
getTime
()
/
interval
)
*
interval
);
this
.
campaign
=
{
name
:
''
,
type
:
'
newsfeed
'
,
...
...
@@ -128,8 +131,8 @@ export class BoostCampaignsCreatorComponent implements OnInit, OnDestroy {
entity_urns
:
[],
nsfw
:
[],
hashtags
:
[],
start
:
Date
.
now
(),
end
:
Date
.
now
()
+
5
*
24
*
60
*
60
*
1000
,
start
:
start
.
getTime
(),
end
:
start
.
getTime
()
+
5
*
24
*
60
*
60
*
1000
,
impressions
:
0
,
};
...
...
This diff is collapsed.
Click to expand it.