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
829
Issues
829
List
Boards
Labels
Service Desk
Milestones
Merge Requests
43
Merge Requests
43
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
5018532bfa84001f6aaf4c287e736283402af2d0...b2be500fc0dcbf196b64e07bbb94a8a5c5408078
Source
b2be500fc0dcbf196b64e07bbb94a8a5c5408078
Select Git revision
...
Target
5018532bfa84001f6aaf4c287e736283402af2d0
Select Git revision
Compare
Commits (2)
epic/post-scheduler
· c5f4ac63
Juan Manuel Solaro
authored
16 minutes ago
c5f4ac63
Merge branch 'epic/post-scheduler' into 'master'
· b2be500f
Mark Harding
authored
16 minutes ago
epic/post-scheduler See merge request
!494
b2be500f
Hide whitespace changes
Inline
Side-by-side
Showing
28 changed files
with
630 additions
and
25 deletions
+630
-25
.gitignore
.gitignore
+1
-0
blogs.spec.js
cypress/integration/blogs.spec.js
+102
-1
newsfeed.spec.js
cypress/integration/newsfeed.spec.js
+87
-0
common.module.ts
src/app/common/common.module.ts
+4
-0
selector.component.html
...n/components/poster-date-selector/selector.component.html
+18
-0
selector.component.scss
...n/components/poster-date-selector/selector.component.scss
+40
-0
selector.component.spec.ts
...omponents/poster-date-selector/selector.component.spec.ts
+86
-0
selector.component.ts
...mon/components/poster-date-selector/selector.component.ts
+59
-0
datetimepicker.directive.scss
.../common/directives/material/datetimepicker.directive.scss
+1
-0
datetimepicker.directive.ts
...pp/common/directives/material/datetimepicker.directive.ts
+5
-1
blog.scss
src/app/modules/blogs/blog.scss
+1
-1
edit.html
src/app/modules/blogs/edit/edit.html
+9
-0
edit.spec.ts
src/app/modules/blogs/edit/edit.spec.ts
+10
-1
edit.ts
src/app/modules/blogs/edit/edit.ts
+30
-1
page.component.html
src/app/modules/canary/page.component.html
+11
-4
sorted.component.html
src/app/modules/channels/sorted/sorted.component.html
+19
-8
sorted.component.scss
src/app/modules/channels/sorted/sorted.component.scss
+25
-2
sorted.component.ts
src/app/modules/channels/sorted/sorted.component.ts
+27
-2
activity.component.scss
.../legacy/components/cards/activity/activity.component.scss
+2
-1
activity.component.spec.ts
...gacy/components/cards/activity/activity.component.spec.ts
+5
-0
activity.html
...pp/modules/legacy/components/cards/activity/activity.html
+15
-0
activity.ts
src/app/modules/legacy/components/cards/activity/activity.ts
+31
-0
preview.ts
src/app/modules/legacy/components/cards/activity/preview.ts
+4
-0
remind.ts
src/app/modules/legacy/components/cards/remind/remind.ts
+4
-0
poster.component.html
src/app/modules/newsfeed/poster/poster.component.html
+7
-0
poster.component.scss
src/app/modules/newsfeed/poster/poster.component.scss
+10
-3
poster.component.spec.ts
src/app/modules/newsfeed/poster/poster.component.spec.ts
+5
-0
poster.component.ts
src/app/modules/newsfeed/poster/poster.component.ts
+12
-0
No files found.
.gitignore
View file @
b2be500f
...
...
@@ -38,3 +38,4 @@ cypress/videos
!/.drone.yml
!/.gitlab
!/.githooks
!/.prettierrc
This diff is collapsed.
Click to expand it.
cypress/integration/blogs.spec.js
View file @
b2be500f
...
...
@@ -120,6 +120,107 @@ context('Blogs', () => {
cy
.
get
(
'
m-post-menu button.minds-more
'
).
click
();
cy
.
get
(
'
m-post-menu ul.minds-dropdown-menu li
'
).
contains
(
'
Delete
'
).
click
();
cy
.
get
(
'
m-post-menu m-modal-confirm .mdl-button--colored
'
).
click
();
});
})
it
(
'
should be able to create a new scheduled blog
'
,
()
=>
{
// upload avatar first
cy
.
visit
(
`/
${
Cypress
.
env
().
username
}
`
);
cy
.
get
(
'
.m-channel--name .minds-button-edit button:first-child
'
).
click
();
cy
.
wait
(
100
);
cy
.
uploadFile
(
'
.minds-avatar input[type=file]
'
,
'
../fixtures/avatar.jpeg
'
,
'
image/jpg
'
);
cy
.
get
(
'
.m-channel--name .minds-button-edit button:last-child
'
).
click
();
// create blog
cy
.
visit
(
'
/blog/edit/new
'
);
cy
.
uploadFile
(
'
minds-banner #file
'
,
'
../fixtures/international-space-station-1776401_1920.jpg
'
,
'
image/jpg
'
);
cy
.
get
(
'
minds-textarea .m-editor
'
).
type
(
'
Title
'
);
cy
.
get
(
'
m-inline-editor .medium-editor-element
'
).
type
(
'
Content
\n
'
);
// click on plus button
cy
.
get
(
'
.medium-editor-element > .medium-insert-buttons > button.medium-insert-buttons-show
'
).
click
();
// click on camera
cy
.
get
(
'
ul.medium-insert-buttons-addons > li > button.medium-insert-action:first-child
'
).
contains
(
'
photo_camera
'
).
click
();
// upload the image
cy
.
uploadFile
(
'
.medium-media-file-input
'
,
'
../fixtures/international-space-station-1776401_1920.jpg
'
,
'
image/jpg
'
);
// open license dropdown & select first license
cy
.
get
(
'
.m-license-info select
'
).
select
(
'
All rights reserved
'
);
// click on hashtags dropdown
cy
.
get
(
'
.m-category-info m-hashtags-selector .m-dropdown--label-container
'
).
click
();
// select #ART
cy
.
get
(
'
.m-category-info m-dropdown m-form-tags-input > div > span
'
).
contains
(
'
#art
'
).
click
();
// type in another hashtag manually
cy
.
get
(
'
.m-category-info m-hashtags-selector m-form-tags-input input
'
).
type
(
'
hashtag{enter}
'
).
click
();
// click away
cy
.
get
(
'
.m-category-info m-hashtags-selector .minds-bg-overlay
'
).
click
();
// select visibility
cy
.
get
(
'
.m-visibility-info select
'
).
select
(
'
Loggedin
'
);
// open metadata form
cy
.
get
(
'
.m-blog-edit--toggle-wrapper .m-blog-edit--toggle
'
).
contains
(
'
Metadata
'
).
click
();
// set url slug
cy
.
get
(
'
.m-blog-edit--field input[name=slug]
'
).
type
(
'
123
'
);
// set meta title
cy
.
get
(
'
.m-blog-edit--field input[name=custom_meta_title]
'
).
type
(
'
Test
'
);
// set meta description
cy
.
get
(
'
.m-blog-edit--field textarea[name=custom_meta_description]
'
).
type
(
'
This is a test blog
'
);
// set meta author
cy
.
get
(
'
.m-blog-edit--field input[name=custom_meta_author]
'
).
type
(
'
Minds Test
'
);
// set as nsfw
cy
.
get
(
'
.m-mature-info a
'
).
click
();
cy
.
get
(
'
.m-mature-info a span
'
).
contains
(
'
Mature content
'
);
// set scheduled date
cy
.
get
(
'
.m-poster-date-selector__input
'
).
click
();
cy
.
get
(
'
td.c-datepicker__day-body.c-datepicker__day--selected + td
'
).
click
();
cy
.
get
(
'
a.c-btn.c-btn--flat.js-ok
'
).
click
();
// get setted date to compare
let
scheduledDate
;
cy
.
get
(
'
div.m-poster-date-selector__input div.m-tooltip--bubble
'
)
.
invoke
(
'
text
'
).
then
((
text
)
=>
{
scheduledDate
=
text
;
});
cy
.
wait
(
1000
);
cy
.
get
(
'
.m-button--submit
'
).
click
({
force
:
true
});
// TODO: Investigate why disabled flag is being detected
cy
.
location
(
'
pathname
'
,
{
timeout
:
30000
})
.
should
(
'
contains
'
,
`/
${
Cypress
.
env
().
username
}
/blog`
);
cy
.
get
(
'
.m-blog--title
'
).
contains
(
'
Title
'
);
cy
.
get
(
'
.minds-blog-body p
'
).
contains
(
'
Content
'
);
cy
.
get
(
'
.m-license-info span
'
).
contains
(
'
all-rights-reserved
'
);
cy
.
wait
(
1000
);
// compare setted date with time_created
cy
.
get
(
'
div.m-blog-container div.mdl-grid div.minds-body span
'
)
.
invoke
(
'
text
'
).
then
((
text
)
=>
{
const
time_created
=
new
Date
(
text
).
getTime
();
scheduledDate
=
new
Date
(
scheduledDate
).
getTime
();
expect
(
scheduledDate
).
to
.
equal
(
time_created
);
});
// cleanup
//open dropdown
cy
.
get
(
'
m-post-menu button.minds-more
'
).
click
();
cy
.
get
(
'
m-post-menu ul.minds-dropdown-menu li
'
).
contains
(
'
Delete
'
).
click
();
cy
.
get
(
'
m-post-menu m-modal-confirm .mdl-button--colored
'
).
click
();
});
})
This diff is collapsed.
Click to expand it.
cypress/integration/newsfeed.spec.js
View file @
b2be500f
...
...
@@ -51,6 +51,93 @@ context('Newsfeed', () => {
cy
.
get
(
'
.minds-list > minds-activity:first-child m-post-menu m-modal-confirm .mdl-button--colored
'
).
click
();
})
it
(
'
should be able to post an activity picking a scheduled date and the edit it
'
,
()
=>
{
cy
.
get
(
'
minds-newsfeed-poster
'
).
should
(
'
be.visible
'
);
cy
.
get
(
'
minds-newsfeed-poster textarea
'
).
type
(
'
This is a post
'
);
// set scheduled date
cy
.
get
(
'
.m-poster-date-selector__input
'
).
click
();
cy
.
get
(
'
button.c-datepicker__next
'
).
click
();
cy
.
get
(
'
tr.c-datepicker__days-row:nth-child(2) td.c-datepicker__day-body:first-child
'
).
click
();
cy
.
get
(
'
a.c-btn.c-btn--flat.js-ok
'
).
click
();
// get setted date to compare
let
scheduledDate
;
cy
.
get
(
'
div.m-poster-date-selector__input div.m-tooltip--bubble
'
)
.
invoke
(
'
text
'
).
then
((
text
)
=>
{
scheduledDate
=
text
;
});
cy
.
get
(
'
.m-posterActionBar__PostButton
'
).
click
();
cy
.
wait
(
100
);
// compare setted date with time_created
cy
.
get
(
'
.minds-list > minds-activity:first-child div.mdl-card__supporting-text > div.body > a.permalink > span
'
)
.
invoke
(
'
text
'
).
then
((
text
)
=>
{
const
time_created
=
new
Date
(
text
).
getTime
();
scheduledDate
=
new
Date
(
scheduledDate
).
getTime
();
expect
(
scheduledDate
).
to
.
equal
(
time_created
);
});
// prepare to listen
cy
.
server
();
cy
.
route
(
"
POST
"
,
'
**/api/v1/newsfeed/**
'
).
as
(
"
saveEdited
"
);
// edit the activity
cy
.
get
(
'
.minds-list > minds-activity:first-child m-post-menu > button.minds-more
'
).
click
();
cy
.
get
(
'
.minds-list > minds-activity:first-child li.mdl-menu__item:first-child
'
).
click
();
cy
.
get
(
'
.minds-list > minds-activity:first-child .m-poster-date-selector__input
'
).
click
();
cy
.
get
(
'
button.c-datepicker__next
'
).
click
();
cy
.
get
(
'
tr.c-datepicker__days-row:nth-child(3) td.c-datepicker__day-body:first-child
'
).
click
();
cy
.
get
(
'
a.c-btn.c-btn--flat.js-ok
'
).
click
();
// get setted date to compare
cy
.
get
(
'
.minds-list > minds-activity:first-child div.m-poster-date-selector__input div.m-tooltip--bubble
'
)
.
invoke
(
'
text
'
).
then
((
text
)
=>
{
scheduledDate
=
text
;
});
// compare setted date with time_created
cy
.
get
(
'
.minds-list > minds-activity:first-child div.mdl-card__supporting-text > div.body > a.permalink > span
'
)
.
invoke
(
'
text
'
).
then
((
text
)
=>
{
const
time_created
=
new
Date
(
text
).
getTime
();
scheduledDate
=
new
Date
(
scheduledDate
).
getTime
();
expect
(
scheduledDate
).
to
.
equal
(
time_created
);
});
// Save
cy
.
get
(
'
.minds-list > minds-activity:first-child button.mdl-button.mdl-button--colored
'
).
click
();
cy
.
wait
(
'
@saveEdited
'
,
{
requestTimeout
:
5000
}).
then
((
xhr
)
=>
{
expect
(
xhr
.
status
).
to
.
equal
(
200
,
'
**/api/v1/newsfeed/** request status
'
);
});
// cleanup
cy
.
get
(
'
.minds-list > minds-activity:first-child m-post-menu .minds-more
'
).
click
();
cy
.
get
(
'
.minds-list > minds-activity:first-child m-post-menu .minds-dropdown-menu .mdl-menu__item:nth-child(4)
'
).
click
();
cy
.
get
(
'
.minds-list > minds-activity:first-child m-post-menu m-modal-confirm .mdl-button--colored
'
).
click
();
})
it
(
'
should list scheduled activies
'
,
()
=>
{
cy
.
server
();
cy
.
route
(
"
GET
"
,
'
**/api/v2/feeds/scheduled/**/count?
'
).
as
(
"
scheduledCount
"
);
cy
.
route
(
"
GET
"
,
'
**/api/v2/feeds/scheduled/**/activities?**
'
).
as
(
"
scheduledActivities
"
);
cy
.
visit
(
`/
${
Cypress
.
env
().
username
}
`
);
cy
.
wait
(
'
@scheduledCount
'
,
{
requestTimeout
:
2000
}).
then
((
xhr
)
=>
{
expect
(
xhr
.
status
).
to
.
equal
(
200
,
'
feeds/scheduled/**/count request status
'
);
});
cy
.
get
(
'
div.m-mindsListTools__scheduled
'
).
click
();
cy
.
wait
(
'
@scheduledActivities
'
,
{
requestTimeout
:
2000
}).
then
((
xhr
)
=>
{
expect
(
xhr
.
status
).
to
.
equal
(
200
,
'
feeds/scheduled/**/activities request status
'
);
});
})
it
(
'
should post an activity with an image attachment
'
,
()
=>
{
cy
.
get
(
'
minds-newsfeed-poster
'
).
should
(
'
be.visible
'
);
...
...
This diff is collapsed.
Click to expand it.
src/app/common/common.module.ts
View file @
b2be500f
...
...
@@ -102,6 +102,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/selector.component
'
;
import
{
ChannelModeSelectorComponent
}
from
'
./components/channel-mode-selector/channel-mode-selector.component
'
;
import
{
ShareModalComponent
}
from
'
../modules/modals/share/share
'
;
...
...
@@ -194,6 +195,8 @@ import { ShareModalComponent } from '../modules/modals/share/share';
SwitchComponent
,
FeaturedContentComponent
,
PosterDateSelectorComponent
,
],
exports
:
[
MINDS_PIPES
,
...
...
@@ -278,6 +281,7 @@ import { ShareModalComponent } from '../modules/modals/share/share';
SwitchComponent
,
NSFWSelectorComponent
,
FeaturedContentComponent
,
PosterDateSelectorComponent
,
ChannelModeSelectorComponent
,
],
providers
:
[
...
...
This diff is collapsed.
Click to expand it.
src/app/common/components/poster-date-selector/selector.component.html
0 → 100644
View file @
b2be500f
<div
class=
"m-poster-date-selector__input"
[class.selected]=
"hasDateSelected()"
mdl-datetime-picker
[date]=
"getDate()"
(dateChange)=
"onDateChange($event)"
>
<input
type=
"text"
[ngModel]=
"date | date: dateFormat"
(ngModelChange)=
"onDateChange($event)"
[hidden]=
"true"
/>
<m-tooltip
icon=
"date_range"
>
{{ getDate() || 'Post Immediately' }}
</m-tooltip>
<span></span>
</div>
This diff is collapsed.
Click to expand it.
src/app/common/components/poster-date-selector/selector.component.scss
0 → 100644
View file @
b2be500f
m-poster-date-selector
{
.m-poster-date-selector__label
{
text-transform
:
uppercase
;
letter-spacing
:
2
.5px
;
align-self
:
center
;
font-size
:
12px
;
}
.m-poster-date-selector__input
{
align-items
:
center
;
margin-right
:
-4px
;
input
{
font-size
:
12px
;
text-transform
:
uppercase
;
background-color
:
transparent
;
padding
:
8px
0
;
border
:
none
;
text-align
:
center
;
width
:
auto
;
height
:
auto
;
align-self
:
center
;
}
i
{
vertical-align
:
middle
;
cursor
:
pointer
;
}
}
m-tooltip
.m-tooltip--bubble
{
width
:
125px
;
}
}
@media
screen
and
(
max-height
:
570px
)
{
div
.c-datepicker
{
min-height
:
560px
;
}
}
This diff is collapsed.
Click to expand it.
src/app/common/components/poster-date-selector/selector.component.spec.ts
0 → 100644
View file @
b2be500f
import
{
async
,
ComponentFixture
,
TestBed
,
fakeAsync
,
tick
,
}
from
'
@angular/core/testing
'
;
import
{
PosterDateSelectorComponent
}
from
'
./selector.component
'
;
import
{
MaterialDateTimePickerDirective
}
from
'
../../directives/material/datetimepicker.directive
'
;
import
{
FormsModule
}
from
'
@angular/forms
'
;
import
{
MockComponent
}
from
'
../../../utils/mock
'
;
describe
(
'
PosterDateSelectorComponent
'
,
()
=>
{
let
comp
:
PosterDateSelectorComponent
;
let
fixture
:
ComponentFixture
<
PosterDateSelectorComponent
>
;
beforeEach
(
async
(()
=>
{
TestBed
.
configureTestingModule
({
declarations
:
[
PosterDateSelectorComponent
,
MaterialDateTimePickerDirective
,
MockComponent
({
selector
:
'
m-tooltip
'
,
template
:
'
<ng-content></ng-content>
'
,
inputs
:
[
'
icon
'
],
}),
],
imports
:
[
FormsModule
],
}).
compileComponents
();
// compile template and css
}));
// synchronous beforeEach
beforeEach
(
done
=>
{
jasmine
.
MAX_PRETTY_PRINT_DEPTH
=
10
;
jasmine
.
clock
().
uninstall
();
jasmine
.
clock
().
install
();
fixture
=
TestBed
.
createComponent
(
PosterDateSelectorComponent
);
comp
=
fixture
.
componentInstance
;
fixture
.
detectChanges
();
if
(
fixture
.
isStable
())
{
done
();
}
else
{
fixture
.
whenStable
().
then
(()
=>
{
done
();
});
}
});
afterEach
(()
=>
{
jasmine
.
clock
().
uninstall
();
});
it
(
'
should emit when onDateChange is called
'
,
fakeAsync
(()
=>
{
spyOn
(
comp
.
dateChange
,
'
emit
'
);
const
testDate
=
new
Date
();
testDate
.
setMonth
(
testDate
.
getMonth
()
+
1
);
comp
.
onDateChange
(
testDate
.
toString
());
let
timeDate
=
testDate
.
getTime
();
timeDate
=
Math
.
floor
(
timeDate
/
1000
);
expect
(
comp
.
dateChange
.
emit
).
toHaveBeenCalledWith
(
timeDate
);
}));
it
(
'
should emit onError when date more than 3 months
'
,
fakeAsync
(()
=>
{
spyOn
(
comp
.
onError
,
'
emit
'
);
const
testDate
=
new
Date
();
testDate
.
setMonth
(
testDate
.
getMonth
()
+
4
);
comp
.
onDateChange
(
testDate
.
toString
());
let
timeDate
=
testDate
.
getTime
();
timeDate
=
Math
.
floor
(
timeDate
/
1000
);
expect
(
comp
.
onError
.
emit
).
toHaveBeenCalledWith
(
"
Scheduled date can't be 3 months or more
"
);
}));
it
(
'
should emit onError when date less than 5 minutes or in the past
'
,
fakeAsync
(()
=>
{
spyOn
(
comp
.
onError
,
'
emit
'
);
const
testDate
=
new
Date
();
comp
.
onDateChange
(
testDate
.
toString
());
let
timeDate
=
testDate
.
getTime
();
timeDate
=
Math
.
floor
(
timeDate
/
1000
);
expect
(
comp
.
onError
.
emit
).
toHaveBeenCalledWith
(
"
Scheduled date can't be less than 5 minutes or in the past
"
);
}));
});
This diff is collapsed.
Click to expand it.
src/app/common/components/poster-date-selector/selector.component.ts
0 → 100644
View file @
b2be500f
import
{
Component
,
EventEmitter
,
Input
,
Output
}
from
'
@angular/core
'
;
import
{
DatePipe
}
from
'
@angular/common
'
;
@
Component
({
moduleId
:
module
.
id
,
selector
:
'
m-poster-date-selector
'
,
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
'
;
onDateChange
(
newDate
)
{
const
validation
=
this
.
validate
(
newDate
);
if
(
validation
!==
true
)
{
this
.
onError
.
emit
(
validation
);
return
;
}
this
.
date
=
newDate
;
newDate
=
new
Date
(
newDate
).
getTime
();
newDate
=
Math
.
floor
(
+
newDate
/
1000
);
this
.
dateChange
.
emit
(
newDate
);
}
hasDateSelected
()
{
return
this
.
date
&&
this
.
date
!==
''
;
}
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 or in the past
"
;
}
return
true
;
}
getDate
()
{
const
tempDate
=
parseInt
(
this
.
date
);
if
(
tempDate
)
{
this
.
date
=
new
Date
(
tempDate
*
1000
).
toString
();
}
return
this
.
date
;
}
}
This diff is collapsed.
Click to expand it.
src/app/common/directives/material/datetimepicker.directive.scss
View file @
b2be500f
...
...
@@ -7,6 +7,7 @@
opacity
:
0
;
transition
:
200ms
ease
opacity
;
will-change
:
opacity
;
z-index
:
9999
;
@include
m-theme
()
{
background-color
:
rgba
(
themed
(
$m-black-always
)
,
0
.541176
);
}
...
...
This diff is collapsed.
Click to expand it.
src/app/common/directives/material/datetimepicker.directive.ts
View file @
b2be500f
...
...
@@ -23,7 +23,11 @@ export class MaterialDateTimePickerDirective {
@
HostListener
(
'
click
'
)
onHostClick
()
{
if
(
!
this
.
open
)
{
this
.
picker
=
new
DateTimePicker
()
let
options
=
{};
if
(
this
.
date
)
{
options
=
{
default
:
new
Date
(
this
.
date
).
toString
()
};
}
this
.
picker
=
new
DateTimePicker
(
options
)
.
on
(
'
submit
'
,
this
.
submitCallback
.
bind
(
this
))
.
on
(
'
close
'
,
this
.
close
.
bind
(
this
));
this
.
open
=
true
;
...
...
This diff is collapsed.
Click to expand it.
src/app/modules/blogs/blog.scss
View file @
b2be500f
...
...
@@ -309,7 +309,6 @@ minds-blog-edit {
m-wire-threshold-input
{
position
:
relative
;
padding
:
8px
;
}
.m-additional-block
m-wire-threshold-input
{
...
...
@@ -366,6 +365,7 @@ minds-blog-edit {
}
.m-additional-block
>
*
{
flex
:
auto
;
margin-right
:
0px
;
}
}
...
...
This diff is collapsed.
Click to expand it.
src/app/modules/blogs/edit/edit.html
View file @
b2be500f
...
...
@@ -170,6 +170,15 @@
(validThreshold)=
"validThreshold = $event"
#thresholdInput
></m-wire-threshold-input>
<ng-container
*mIfFeature=
"'post-scheduler'"
>
<m-poster-date-selector
*ngIf=
"checkTimePublished()"
[date]=
"getTimeCreated()"
(dateChange)=
"onTimeCreatedChange($event)"
(onError)=
"posterDateSelectorError($event)"
></m-poster-date-selector>
</ng-container>
</div>
<div
...
...
This diff is collapsed.
Click to expand it.
src/app/modules/blogs/edit/edit.spec.ts
View file @
b2be500f
...
...
@@ -26,7 +26,7 @@ import { By } from '@angular/platform-browser';
import
{
Session
}
from
'
../../../services/session
'
;
import
{
sessionMock
}
from
'
../../../../tests/session-mock.spec
'
;
import
{
mindsTitleMock
}
from
'
../../../mocks/services/ux/minds-title.service.mock.spec
'
;
import
{
MockComponent
}
from
'
../../../utils/mock
'
;
import
{
MockComponent
,
MockDirective
}
from
'
../../../utils/mock
'
;
import
{
InMemoryStorageService
}
from
'
../../../services/in-memory-storage.service
'
;
import
{
inMemoryStorageServiceMock
}
from
'
../../../../tests/in-memory-storage-service-mock.spec
'
;
...
...
@@ -240,6 +240,15 @@ describe('BlogEdit', () => {
inputs
:
[
'
tags
'
,
'
alignLeft
'
],
outputs
:
[
'
tagsChange
'
,
'
tagsAdded
'
,
'
tagsRemoved
'
],
}),
MockComponent
({
selector
:
'
m-poster-date-selector
'
,
inputs
:
[
'
date
'
,
'
dateFormat
'
],
outputs
:
[
'
dateChange
'
],
}),
MockDirective
({
selector
:
'
[mIfFeature]
'
,
inputs
:
[
'
mIfFeature
'
],
}),
BlogEdit
,
MDLMock
,
],
// declare the test component
...
...
This diff is collapsed.
Click to expand it.
src/app/modules/blogs/edit/edit.ts
View file @
b2be500f
...
...
@@ -30,7 +30,7 @@ export class BlogEdit {
guid
:
'
new
'
,
title
:
''
,
description
:
'
<p><br></p>
'
,
time_created
:
Date
.
now
(
),
time_created
:
Math
.
floor
(
Date
.
now
()
/
1000
),
access_id
:
2
,
tags
:
[],
license
:
'
attribution-sharealike-cc
'
,
...
...
@@ -69,6 +69,8 @@ export class BlogEdit {
@
ViewChild
(
'
hashtagsSelector
'
,
{
static
:
false
})
hashtagsSelector
:
HashtagsSelectorComponent
;
protected
time_created
:
any
;
constructor
(
public
session
:
Session
,
public
client
:
Client
,
...
...
@@ -207,6 +209,9 @@ export class BlogEdit {
if
(
!
this
.
blog
.
category
)
this
.
blog
.
category
=
''
;
if
(
!
this
.
blog
.
license
)
this
.
blog
.
license
=
''
;
this
.
blog
.
time_created
=
response
.
blog
.
time_created
||
Math
.
floor
(
Date
.
now
()
/
1000
);
}
});
}
...
...
@@ -234,6 +239,10 @@ export class BlogEdit {
return
true
;
}
posterDateSelectorError
(
msg
)
{
this
.
error
=
msg
;
}
save
()
{
if
(
!
this
.
canSave
)
return
;
...
...
@@ -248,6 +257,8 @@ export class BlogEdit {
blog
.
mature
=
blog
.
mature
?
1
:
0
;
blog
.
monetization
=
blog
.
monetization
?
1
:
0
;
blog
.
monetized
=
blog
.
monetized
?
1
:
0
;
blog
.
time_created
=
blog
.
time_created
||
Math
.
floor
(
Date
.
now
()
/
1000
);
this
.
editing
=
false
;
this
.
inProgress
=
true
;
this
.
canSave
=
false
;
...
...
@@ -258,6 +269,7 @@ export class BlogEdit {
.
then
((
response
:
any
)
=>
{
this
.
inProgress
=
false
;
this
.
canSave
=
true
;
this
.
blog
.
time_created
=
null
;
if
(
response
.
status
!==
'
success
'
)
{
this
.
error
=
response
.
message
;
...
...
@@ -328,4 +340,21 @@ export class BlogEdit {
this
.
blog
.
categories
.
splice
(
this
.
blog
.
categories
.
indexOf
(
category
.
id
),
1
);
}
}
onTimeCreatedChange
(
newDate
)
{
this
.
blog
.
time_created
=
newDate
;
}
getTimeCreated
()
{
return
this
.
blog
.
time_created
>
Math
.
floor
(
Date
.
now
()
/
1000
)
?
this
.
blog
.
time_created
:
null
;
}
checkTimePublished
()
{
return
(
!
this
.
blog
.
time_published
||
this
.
blog
.
time_published
>
Math
.
floor
(
Date
.
now
()
/
1000
)
);
}
}
This diff is collapsed.
Click to expand it.
src/app/modules/canary/page.component.html
View file @
b2be500f
...
...
@@ -45,11 +45,18 @@
<h2>
Experiments
</h2>
<ul
class=
"m-canaryExperiments__list"
>
<li>
M
edia Modals
<a
href=
"https://gitlab.com/minds/front/merge_requests/
467
"
>
(front!
469
)
</a
M
ulti Currency Wire
<a
href=
"https://gitlab.com/minds/front/merge_requests/
508
"
>
(front!
508
)
</a
>
- 20th August '19
- 17th September '19
</li>
<li>
Post scheduler
<a
href=
"https://gitlab.com/minds/front/merge_requests/494"
>
(front!494)
</a
>
- 17th September '19
</li>
</ul>
</div>
...
...
This diff is collapsed.
Click to expand it.
src/app/modules/channels/sorted/sorted.component.html
View file @
b2be500f
...
...
@@ -6,14 +6,25 @@
<div
class=
"minds-list"
>
<div>
<m-sort-selector
class=
"m-channel--sorted__SortSelector m-border"
[allowedAlgorithms]=
"false"
[allowedPeriods]=
"false"
[allowedCustomTypes]=
"['activities', 'images', 'videos', 'blogs']"
[customType]=
"type"
(onChange)=
"setFilter($event.customType)"
></m-sort-selector>
<div
class=
"m-mindsList__tools m-border"
>
<div
*ngIf=
"isOwner()"
class=
"m-mindsListTools__scheduled"
(click)=
"toggleScheduled()"
[class.selected]=
"viewScheduled"
>
<m-tooltip
icon=
"date_range"
>
See Scheduled Activities
</m-tooltip>
<span>
scheduled: {{ scheduledCount }}
</span>
</div>
<m-sort-selector
class=
"m-channel--sorted__SortSelector"
[allowedAlgorithms]=
"false"
[allowedPeriods]=
"false"
[allowedCustomTypes]=
"['activities', 'images', 'videos', 'blogs']"
[customType]=
"type"
(onChange)=
"setFilter($event.customType)"
></m-sort-selector>
</div>
<m-onboarding-feed
*ngIf=
"isOwner()"
></m-onboarding-feed>
...
...
This diff is collapsed.
Click to expand it.
src/app/modules/channels/sorted/sorted.component.scss
View file @
b2be500f
.m-
channel--sorted__SortSelector
{
.m-
mindsList__tools
{
@include
m-theme
()
{
background-color
:
themed
(
$m-white
);
}
display
:
flex
;
position
:
relative
;
padding
:
8px
;
margin-bottom
:
16px
;
flex-direction
:
row
;
align-items
:
center
;
.m-mindsListTools__scheduled
{
cursor
:
pointer
;
i
{
vertical-align
:
middle
;
font-size
:
18px
;
margin-right
:
4px
;
}
span
{
text-transform
:
uppercase
;
font-size
:
11px
;
letter-spacing
:
1
.25px
;
text-rendering
:
optimizeLegibility
;
}
}
.m-channel--sorted__SortSelector
{
margin-left
:
auto
;
}
}
This diff is collapsed.
Click to expand it.
src/app/modules/channels/sorted/sorted.component.ts
View file @
b2be500f
...
...
@@ -15,6 +15,7 @@ import { Session } from '../../../services/session';
import
{
PosterComponent
}
from
'
../../newsfeed/poster/poster.component
'
;
import
{
SortedService
}
from
'
./sorted.service
'
;
import
{
ClientMetaService
}
from
'
../../../common/services/client-meta.service
'
;
import
{
Client
}
from
'
../../../services/api
'
;
@
Component
({
selector
:
'
m-channel--sorted
'
,
...
...
@@ -60,15 +61,20 @@ export class ChannelSortedComponent implements OnInit {
initialized
:
boolean
=
false
;
viewScheduled
:
boolean
=
false
;
@
ViewChild
(
'
poster
'
,
{
static
:
false
})
protected
poster
:
PosterComponent
;
scheduledCount
:
number
=
0
;
constructor
(
public
feedsService
:
FeedsService
,
protected
service
:
SortedService
,
protected
session
:
Session
,
protected
clientMetaService
:
ClientMetaService
,
@
SkipSelf
()
injector
:
Injector
,
protected
cd
:
ChangeDetectorRef
protected
cd
:
ChangeDetectorRef
,
public
client
:
Client
)
{
this
.
clientMetaService
.
inherit
(
injector
)
...
...
@@ -92,11 +98,18 @@ export class ChannelSortedComponent implements OnInit {
this
.
detectChanges
();
let
endpoint
=
'
api/v2/feeds/container
'
;
if
(
this
.
viewScheduled
)
{
endpoint
=
'
api/v2/feeds/scheduled
'
;
}
try
{
this
.
feedsService
.
setEndpoint
(
`
api/v2/feeds/container
/
${
this
.
channel
.
guid
}
/
${
this
.
type
}
`
)
.
setEndpoint
(
`
${
endpoint
}
/
${
this
.
channel
.
guid
}
/
${
this
.
type
}
`
)
.
setLimit
(
12
)
.
fetch
();
this
.
getScheduledCount
();
}
catch
(
e
)
{
console
.
error
(
'
ChannelsSortedComponent.load
'
,
e
);
}
...
...
@@ -170,4 +183,16 @@ export class ChannelSortedComponent implements OnInit {
this
.
cd
.
markForCheck
();
this
.
cd
.
detectChanges
();
}
toggleScheduled
()
{
this
.
viewScheduled
=
!
this
.
viewScheduled
;
this
.
load
(
true
);
}
async
getScheduledCount
()
{
const
url
=
`api/v2/feeds/scheduled/
${
this
.
channel
.
guid
}
/count`
;
const
response
:
any
=
await
this
.
client
.
get
(
url
);
this
.
scheduledCount
=
response
.
count
;
this
.
detectChanges
();
}
}
This diff is collapsed.
Click to expand it.
src/app/modules/legacy/components/cards/activity/activity.component.scss
View file @
b2be500f
...
...
@@ -60,7 +60,8 @@ minds-activity {
}
}
}
m-nsfw-selector
{
m-nsfw-selector
,
m-poster-date-selector
{
display
:
inline-block
;
border-radius
:
24px
;
padding
:
3px
16px
;
...
...
This diff is collapsed.
Click to expand it.
src/app/modules/legacy/components/cards/activity/activity.component.spec.ts
View file @
b2be500f
...
...
@@ -451,6 +451,11 @@ describe('Activity', () => {
inputs
:
[
'
selected
'
],
outputs
:
[
'
selected
'
],
}),
MockComponent
({
selector
:
'
m-poster-date-selector
'
,
inputs
:
[
'
date
'
,
'
dateFormat
'
],
outputs
:
[
'
dateChange
'
],
}),
MockDirective
({
selector
:
'
[mIfFeature]
'
,
inputs
:
[
'
mIfFeature
'
],
...
...
This diff is collapsed.
Click to expand it.
src/app/modules/legacy/components/cards/activity/activity.html
View file @
b2be500f
...
...
@@ -180,6 +180,12 @@
[(threshold)]=
"activity.wire_threshold"
[(enabled)]=
"activity.paywall"
></m-wire-threshold-input>
<m-poster-date-selector
*ngIf=
"checkCreated()"
[date]=
"getTimeCreated()"
(dateChange)=
"onTimeCreatedChange($event)"
(onError)=
"posterDateSelectorError($event)"
></m-poster-date-selector>
<button
class=
"mdl-button mdl-button--raised mdl-color--blue-grey-100"
(click)=
"messageEdit.value = activity.message; editing=false;"
...
...
@@ -503,3 +509,12 @@
>
This post is awaiting moderation.
</div>
<!-- Pending block -->
<div
class=
"mdl-card__supporting-text m-activity--pending"
*ngIf=
"isScheduled(activity.time_created)"
>
This activity is scheduled to be shown on {{activity.time_created * 1000 |
date:'medium'}}.
</div>
This diff is collapsed.
Click to expand it.
src/app/modules/legacy/components/cards/activity/activity.ts
View file @
b2be500f
...
...
@@ -156,6 +156,8 @@ export class Activity implements OnInit {
@
ViewChild
(
'
player
'
,
{
static
:
false
})
player
:
MindsVideoComponent
;
@
ViewChild
(
'
batchImage
'
,
{
static
:
false
})
batchImage
:
ElementRef
;
protected
time_created
:
any
;
constructor
(
public
session
:
Session
,
public
client
:
Client
,
...
...
@@ -233,6 +235,9 @@ export class Activity implements OnInit {
(
this
.
activity
.
remind_object
&&
this
.
translationService
.
isTranslatable
(
this
.
activity
.
remind_object
));
this
.
activity
.
time_created
=
this
.
activity
.
time_created
||
Math
.
floor
(
Date
.
now
()
/
1000
);
this
.
allowComments
=
this
.
activity
.
allow_comments
;
}
...
...
@@ -255,6 +260,8 @@ export class Activity implements OnInit {
console
.
log
(
'
trying to save your changes to the server
'
,
this
.
activity
);
this
.
editing
=
false
;
this
.
activity
.
edited
=
true
;
this
.
activity
.
time_created
=
this
.
activity
.
time_created
||
Math
.
floor
(
Date
.
now
()
/
1000
);
let
data
=
this
.
activity
;
if
(
this
.
attachment
.
has
())
{
...
...
@@ -494,6 +501,10 @@ export class Activity implements OnInit {
return
activity
&&
activity
.
pending
&&
activity
.
pending
!==
'
0
'
;
}
isScheduled
(
time_created
)
{
return
time_created
&&
time_created
*
1000
>
Date
.
now
();
}
toggleMatureVisibility
()
{
this
.
activity
.
mature_visibility
=
!
this
.
activity
.
mature_visibility
;
...
...
@@ -568,4 +579,24 @@ export class Activity implements OnInit {
this
.
cd
.
markForCheck
();
this
.
cd
.
detectChanges
();
}
onTimeCreatedChange
(
newDate
)
{
this
.
activity
.
time_created
=
newDate
;
}
posterDateSelectorError
(
msg
)
{
throw
new
Error
(
msg
);
}
getTimeCreated
()
{
return
this
.
activity
.
time_created
>
Math
.
floor
(
Date
.
now
()
/
1000
)
?
this
.
activity
.
time_created
:
null
;
}
checkCreated
()
{
return
this
.
activity
.
time_created
>
Math
.
floor
(
Date
.
now
()
/
1000
)
?
true
:
false
;
}
}
This diff is collapsed.
Click to expand it.
src/app/modules/legacy/components/cards/activity/preview.ts
View file @
b2be500f
...
...
@@ -78,6 +78,10 @@ export class ActivityPreview {
return
false
;
}
isScheduled
(
time_created
)
{
return
false
;
}
save
()
{
/* NOOP */
}
...
...
This diff is collapsed.
Click to expand it.
src/app/modules/legacy/components/cards/remind/remind.ts
View file @
b2be500f
...
...
@@ -140,6 +140,10 @@ export class Remind {
return
activity
&&
activity
.
pending
&&
activity
.
pending
!==
'
0
'
;
}
isScheduled
(
time_created
)
{
return
false
;
}
openComments
()
{
/* NOOP */
}
...
...
This diff is collapsed.
Click to expand it.
src/app/modules/newsfeed/poster/poster.component.html
View file @
b2be500f
...
...
@@ -96,6 +96,13 @@
(validThreshold)=
"validThreshold = $event"
></m-wire-threshold-input>
<m-poster-date-selector
[date]=
"meta.time_created"
(dateChange)=
"onTimeCreatedChange($event)"
(onError)=
"posterDateSelectorError($event)"
*mIfFeature=
"'post-scheduler'"
></m-poster-date-selector>
<button
type=
"submit"
class=
"m-posterActionBar__PostButton"
...
...
This diff is collapsed.
Click to expand it.
src/app/modules/newsfeed/poster/poster.component.scss
View file @
b2be500f
...
...
@@ -259,7 +259,7 @@ m-hashtags-selector {
}
>
*
{
padding
:
4px
8
px
;
padding
:
4px
4
px
;
position
:
relative
;
white-space
:
nowrap
;
text-decoration
:
none
;
...
...
@@ -287,6 +287,11 @@ m-hashtags-selector {
white-space
:
normal
;
}
}
m-poster-date-selector
{
padding-right
:
$minds-padding
;
}
.m-posterActionBar__CreateBlog
{
cursor
:
pointer
;
}
...
...
@@ -305,13 +310,15 @@ m-hashtags-selector {
}
.material-icons.m-posterActionBar__Icon
,
.m-posterActionBar__IconAndLabel
i
.material-icons
{
.m-posterActionBar__IconAndLabel
i
.material-icons
,
.m-tooltip
>
i
{
font-size
:
20px
;
transform
:
rotate
(
0
.03deg
)
translateY
(
-1px
);
// Jagged lines hack
}
.m-posterActionBar__Label
,
.m-posterActionBar__IconAndLabel
>
span
{
.m-posterActionBar__IconAndLabel
>
span
,
.m-poster-date-selector--input
>
span
{
font-size
:
12px
;
font-family
:
'Roboto'
,
sans-serif
;
text-transform
:
uppercase
;
...
...
This diff is collapsed.
Click to expand it.
src/app/modules/newsfeed/poster/poster.component.spec.ts
View file @
b2be500f
...
...
@@ -78,6 +78,11 @@ describe('PosterComponent', () => {
selector
:
'
minds-rich-embed
'
,
inputs
:
[
'
src
'
,
'
preview
'
,
'
maxheight
'
,
'
cropimage
'
],
}),
MockComponent
({
selector
:
'
m-poster-date-selector
'
,
inputs
:
[
'
date
'
,
'
dateFormat
'
],
outputs
:
[
'
dateChange
'
],
}),
MockComponent
({
selector
:
'
m-tooltip
'
,
template
:
'
<ng-content></ng-content>
'
,
...
...
This diff is collapsed.
Click to expand it.
src/app/modules/newsfeed/poster/poster.component.ts
View file @
b2be500f
...
...
@@ -32,6 +32,7 @@ export class PosterComponent {
meta
:
any
=
{
message
:
''
,
wire_threshold
:
null
,
time_created
:
null
,
};
tags
=
[];
minds
=
window
.
Minds
;
...
...
@@ -174,6 +175,9 @@ export class PosterComponent {
return
;
}
this
.
meta
.
time_created
=
this
.
meta
.
time_created
||
Math
.
floor
(
Date
.
now
()
/
1000
);
this
.
errorMessage
=
''
;
let
data
=
Object
.
assign
(
this
.
meta
,
this
.
attachment
.
exportMeta
());
...
...
@@ -285,4 +289,12 @@ export class PosterComponent {
onNSWFSelections
(
reasons
:
Array
<
{
value
;
label
;
selected
}
>
)
{
this
.
attachment
.
setNSFW
(
reasons
);
}
onTimeCreatedChange
(
newDate
)
{
this
.
meta
.
time_created
=
newDate
;
}
posterDateSelectorError
(
msg
)
{
this
.
errorMessage
=
msg
;
}
}
This diff is collapsed.
Click to expand it.