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
891
Issues
891
List
Boards
Labels
Service Desk
Milestones
Merge Requests
49
Merge Requests
49
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
Commits
f3b32b5c
Commit
f3b32b5c
authored
1 hour ago
by
Juan Manuel Solaro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(feat) date selector should validate date and adapt code as per review
parent
de6bc61c
epic/post-scheduler
1 merge request
!494
WIP: epic/post-scheduler
Pipeline
#79426898
failed with stages
in 8 minutes and 16 seconds
Changes
12
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
71 additions
and
3 deletions
+71
-3
common.module.ts
src/app/common/common.module.ts
+1
-1
selector.component.html
...n/components/poster-date-selector/selector.component.html
+0
-0
selector.component.scss
...n/components/poster-date-selector/selector.component.scss
+0
-0
selector.component.spec.ts
...omponents/poster-date-selector/selector.component.spec.ts
+1
-1
selector.component.ts
...mon/components/poster-date-selector/selector.component.ts
+53
-0
edit.html
src/app/modules/blogs/edit/edit.html
+1
-0
edit.ts
src/app/modules/blogs/edit/edit.ts
+4
-0
sorted.component.ts
src/app/modules/channels/sorted/sorted.component.ts
+1
-1
activity.html
...pp/modules/legacy/components/cards/activity/activity.html
+1
-0
activity.ts
src/app/modules/legacy/components/cards/activity/activity.ts
+4
-0
poster.component.html
src/app/modules/newsfeed/poster/poster.component.html
+1
-0
poster.component.ts
src/app/modules/newsfeed/poster/poster.component.ts
+4
-0
No files found.
src/app/common/common.module.ts
View file @
f3b32b5c
...
...
@@ -101,7 +101,7 @@ import { SettingsService } from '../modules/settings/settings.service';
import
{
ThemeService
}
from
'
./services/theme.service
'
;
import
{
HorizontalInfiniteScroll
}
from
'
./components/infinite-scroll/horizontal-infinite-scroll.component
'
;
import
{
ReferralsLinksComponent
}
from
'
../modules/wallet/tokens/referrals/links/links.component
'
;
import
{
PosterDateSelectorComponent
}
from
'
./components/poster-date-selector/
poster-date-
selector.component
'
;
import
{
PosterDateSelectorComponent
}
from
'
./components/poster-date-selector/selector.component
'
;
import
{
ShareModalComponent
}
from
'
../modules/modals/share/share
'
;
@
NgModule
({
...
...
This diff is collapsed.
Click to expand it.
src/app/common/components/poster-date-selector/
poster-date-
selector.component.html
→
src/app/common/components/poster-date-selector/selector.component.html
View file @
f3b32b5c
File moved
This diff is collapsed.
Click to expand it.
src/app/common/components/poster-date-selector/
poster-date-
selector.component.scss
→
src/app/common/components/poster-date-selector/selector.component.scss
View file @
f3b32b5c
File moved
This diff is collapsed.
Click to expand it.
src/app/common/components/poster-date-selector/
poster-date-
selector.component.spec.ts
→
src/app/common/components/poster-date-selector/selector.component.spec.ts
View file @
f3b32b5c
...
...
@@ -5,7 +5,7 @@ import {
fakeAsync
,
tick
,
}
from
'
@angular/core/testing
'
;
import
{
PosterDateSelectorComponent
}
from
'
./
poster-date-
selector.component
'
;
import
{
PosterDateSelectorComponent
}
from
'
./selector.component
'
;
import
{
MaterialDateTimePickerDirective
}
from
'
../../directives/material/datetimepicker.directive
'
;
import
{
FormsModule
}
from
'
@angular/forms
'
;
import
{
MockComponent
}
from
'
../../../utils/mock
'
;
...
...
This diff is collapsed.
Click to expand it.
src/app/common/components/poster-date-selector/
poster-date-
selector.component.ts
→
src/app/common/components/poster-date-selector/selector.component.ts
View file @
f3b32b5c
...
...
@@ -4,18 +4,25 @@ import { DatePipe } from '@angular/common';
@
Component
({
moduleId
:
module
.
id
,
selector
:
'
m-poster-date-selector
'
,
templateUrl
:
'
poster-date-
selector.component.html
'
,
templateUrl
:
'
selector.component.html
'
,
providers
:
[
DatePipe
],
})
export
class
PosterDateSelectorComponent
{
@
Input
()
date
:
string
;
@
Output
()
dateChange
:
EventEmitter
<
any
>
=
new
EventEmitter
<
any
>
();
@
Output
()
onError
:
EventEmitter
<
String
>
=
new
EventEmitter
<
String
>
();
@
Input
()
dateFormat
:
string
=
'
short
'
;
tooltipDate
:
string
;
onDateChange
(
newDate
)
{
const
validation
=
this
.
validate
(
newDate
);
if
(
validation
!==
true
)
{
this
.
onError
.
emit
(
validation
);
return
;
}
this
.
date
=
this
.
tooltipDate
=
newDate
;
newDate
=
new
Date
(
newDate
).
getTime
();
newDate
=
Math
.
floor
(
+
newDate
/
1000
);
...
...
@@ -25,4 +32,22 @@ export class PosterDateSelectorComponent {
hasDateSelected
()
{
return
this
.
tooltipDate
&&
this
.
tooltipDate
!==
''
;
}
validate
(
newDate
)
{
const
date
=
new
Date
(
newDate
);
const
threeMonths
=
new
Date
();
threeMonths
.
setMonth
(
threeMonths
.
getMonth
()
+
3
);
if
(
date
>=
threeMonths
)
{
return
"
Scheduled date can't be 3 months or more
"
;
}
const
fiveMinutes
=
new
Date
();
fiveMinutes
.
setMinutes
(
fiveMinutes
.
getMinutes
()
+
5
);
if
(
date
<
fiveMinutes
)
{
return
"
Scheduled date can't be less than 5 minutes
"
;
}
return
true
;
}
}
This diff is collapsed.
Click to expand it.
src/app/modules/blogs/edit/edit.html
View file @
f3b32b5c
...
...
@@ -173,6 +173,7 @@
<m-poster-date-selector
[date]=
"blog.time_created"
(dateChange)=
"onTimeCreatedChange($event)"
(onError)=
"posterDateSelectorError($event)"
></m-poster-date-selector>
</div>
...
...
This diff is collapsed.
Click to expand it.
src/app/modules/blogs/edit/edit.ts
View file @
f3b32b5c
...
...
@@ -239,6 +239,10 @@ export class BlogEdit {
return
true
;
}
posterDateSelectorError
(
msg
)
{
this
.
error
=
msg
;
}
save
()
{
if
(
!
this
.
canSave
)
return
;
...
...
This diff is collapsed.
Click to expand it.
src/app/modules/channels/sorted/sorted.component.ts
View file @
f3b32b5c
...
...
@@ -74,7 +74,7 @@ export class ChannelSortedComponent implements OnInit {
protected
clientMetaService
:
ClientMetaService
,
@
SkipSelf
()
injector
:
Injector
,
protected
cd
:
ChangeDetectorRef
,
public
client
:
Client
public
client
:
Client
,
)
{
this
.
clientMetaService
.
inherit
(
injector
)
...
...
This diff is collapsed.
Click to expand it.
src/app/modules/legacy/components/cards/activity/activity.html
View file @
f3b32b5c
...
...
@@ -183,6 +183,7 @@
<m-poster-date-selector
[date]=
"activity.time_created"
(dateChange)=
"onTimeCreatedChange($event)"
(onError)=
"posterDateSelectorError($event)"
></m-poster-date-selector>
<button
class=
"mdl-button mdl-button--raised mdl-color--blue-grey-100"
...
...
This diff is collapsed.
Click to expand it.
src/app/modules/legacy/components/cards/activity/activity.ts
View file @
f3b32b5c
...
...
@@ -569,4 +569,8 @@ export class Activity implements OnInit {
onTimeCreatedChange
(
newDate
)
{
this
.
activity
.
time_created
=
newDate
;
}
posterDateSelectorError
(
msg
)
{
throw
new
Error
(
msg
);
}
}
This diff is collapsed.
Click to expand it.
src/app/modules/newsfeed/poster/poster.component.html
View file @
f3b32b5c
...
...
@@ -99,6 +99,7 @@
<m-poster-date-selector
[date]=
"meta.time_created"
(dateChange)=
"onTimeCreatedChange($event)"
(onError)=
"posterDateSelectorError($event)"
></m-poster-date-selector>
<button
...
...
This diff is collapsed.
Click to expand it.
src/app/modules/newsfeed/poster/poster.component.ts
View file @
f3b32b5c
...
...
@@ -296,4 +296,8 @@ export class PosterComponent {
onTimeCreatedChange
(
newDate
)
{
this
.
meta
.
time_created
=
newDate
;
}
posterDateSelectorError
(
msg
)
{
this
.
errorMessage
=
msg
;
}
}
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
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