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
873
Issues
873
List
Boards
Labels
Service Desk
Milestones
Merge Requests
47
Merge Requests
47
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
cb40e117
Commit
cb40e117
authored
2 days ago
by
Marcelo Rivera
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(feat): enforce CREATE_POST permission
parent
94f507a7
epic/permissions-28
No related merge requests found
Pipeline
#87053561
failed with stages
in 6 minutes and 41 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
48 additions
and
23 deletions
+48
-23
src/app/modules/groups/profile/feed/legacy.html
src/app/modules/groups/profile/feed/legacy.html
+1
-1
src/app/modules/groups/profile/feed/sorted.component.html
src/app/modules/groups/profile/feed/sorted.component.html
+1
-1
src/app/modules/newsfeed/poster/poster.component.ts
src/app/modules/newsfeed/poster/poster.component.ts
+46
-21
No files found.
src/app/modules/groups/profile/feed/legacy.html
View file @
cb40e117
...
...
@@ -2,7 +2,7 @@
<minds-newsfeed-poster
#poster
(load)=
"prepend($event)"
[container
Guid]=
"group.guid
"
[container
]=
"group
"
[accessId]=
"group.guid"
*ngIf=
"filter == 'activity' && group['is:member']"
>
...
...
This diff is collapsed.
Click to expand it.
src/app/modules/groups/profile/feed/sorted.component.html
View file @
cb40e117
<minds-newsfeed-poster
*ngIf=
"isMember()"
(load)=
"prepend($event)"
[container
Guid]=
"group.guid
"
[container
]=
"group
"
[accessId]=
"group.guid"
#poster
></minds-newsfeed-poster>
...
...
This diff is collapsed.
Click to expand it.
src/app/modules/newsfeed/poster/poster.component.ts
View file @
cb40e117
...
...
@@ -3,6 +3,8 @@ import {
ElementRef
,
EventEmitter
,
HostListener
,
Input
,
Output
,
ViewChild
,
}
from
'
@angular/core
'
;
import
{
Session
}
from
'
../../../services/session
'
;
...
...
@@ -18,16 +20,18 @@ import { debounceTime } from 'rxjs/operators';
import
{
Router
}
from
'
@angular/router
'
;
import
{
InMemoryStorageService
}
from
'
../../../services/in-memory-storage.service
'
;
import
{
AutocompleteSuggestionsService
}
from
'
../../suggestions/services/autocomplete-suggestions.service
'
;
import
{
FeaturesService
}
from
'
../../../services/features.service
'
;
import
{
PermissionsService
}
from
'
../../../common/services/permissions/permissions.service
'
;
import
{
Flags
}
from
'
../../../common/services/permissions/flags
'
;
@
Component
({
moduleId
:
module
.
id
,
selector
:
'
minds-newsfeed-poster
'
,
inputs
:
[
'
_container_guid: containerGuid
'
,
'
accessId
'
,
'
message
'
],
outputs
:
[
'
load
'
],
providers
:
[
AttachmentService
],
templateUrl
:
'
poster.component.html
'
,
})
export
class
PosterComponent
{
container
:
any
;
content
=
''
;
meta
:
any
=
{
message
:
''
,
...
...
@@ -36,7 +40,6 @@ export class PosterComponent {
};
tags
=
[];
minds
=
window
.
Minds
;
load
:
EventEmitter
<
any
>
=
new
EventEmitter
();
inProgress
:
boolean
=
false
;
canPost
:
boolean
=
true
;
...
...
@@ -56,6 +59,26 @@ export class PosterComponent {
protected
resizeSubject
:
Subject
<
number
>
=
new
Subject
<
number
>
();
@
Input
(
'
container
'
)
set
_container_guid
(
container
:
any
)
{
this
.
container
=
container
;
this
.
attachment
.
setContainer
(
container
.
guid
);
}
@
Input
(
'
accessId
'
)
set
accessId
(
access_id
:
any
)
{
this
.
attachment
.
setAccessId
(
access_id
);
}
@
Input
(
'
message
'
)
set
message
(
value
:
any
)
{
if
(
value
)
{
value
=
decodeURIComponent
(
value
.
replace
(
/
\+
/g
,
'
%20
'
));
this
.
meta
.
message
=
value
;
this
.
showTagsError
();
this
.
getPostPreview
({
value
:
value
});
//a little ugly here!
}
}
@
Output
()
load
:
EventEmitter
<
any
>
=
new
EventEmitter
();
constructor
(
public
session
:
Session
,
public
client
:
Client
,
...
...
@@ -64,7 +87,9 @@ export class PosterComponent {
public
suggestions
:
AutocompleteSuggestionsService
,
protected
elementRef
:
ElementRef
,
protected
router
:
Router
,
protected
inMemoryStorageService
:
InMemoryStorageService
protected
inMemoryStorageService
:
InMemoryStorageService
,
private
featuresService
:
FeaturesService
,
private
permissionsService
:
PermissionsService
)
{}
@
HostListener
(
'
window:resize
'
)
_widthDetection
()
{
...
...
@@ -72,6 +97,8 @@ export class PosterComponent {
}
ngOnInit
()
{
this
.
checkPermissions
();
this
.
resizeSubscription
=
this
.
resizeSubject
.
pipe
(
debounceTime
(
1000
/
30
))
.
subscribe
(()
=>
this
.
onResize
());
...
...
@@ -100,23 +127,6 @@ export class PosterComponent {
}
}
set
_container_guid
(
guid
:
any
)
{
this
.
attachment
.
setContainer
(
guid
);
}
set
accessId
(
access_id
:
any
)
{
this
.
attachment
.
setAccessId
(
access_id
);
}
set
message
(
value
:
any
)
{
if
(
value
)
{
value
=
decodeURIComponent
(
value
.
replace
(
/
\+
/g
,
'
%20
'
));
this
.
meta
.
message
=
value
;
this
.
showTagsError
();
this
.
getPostPreview
({
value
:
value
});
//a little ugly here!
}
}
onMessageChange
(
$event
)
{
this
.
errorMessage
=
''
;
this
.
meta
.
message
=
$event
;
...
...
@@ -297,4 +307,19 @@ export class PosterComponent {
posterDateSelectorError
(
msg
)
{
this
.
errorMessage
=
msg
;
}
private
checkPermissions
()
{
// check whether we're posting to a group or a channel
const
entity
:
any
=
this
.
container
?
this
.
container
:
this
.
session
.
getLoggedInUser
();
if
(
this
.
featuresService
.
has
(
'
permissions
'
))
{
this
.
canPost
=
this
.
permissionsService
.
canInteract
(
entity
,
Flags
.
CREATE_POST
);
}
this
.
canPost
=
true
;
}
}
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