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
51dcbd4ccd349d7f92470726c5086dfc526cdde8...19ac9cb145835fdb250bbbdd7c4417a88eb817d7
Source
19ac9cb145835fdb250bbbdd7c4417a88eb817d7
Select Git revision
...
Target
51dcbd4ccd349d7f92470726c5086dfc526cdde8
Select Git revision
Compare
Commits (2)
Added in featureflag cookie setting
· 8bb61289
Ben Hayward
authored
4 hours ago
8bb61289
Updated to override feat flag by cookie
· 19ac9cb1
Ben Hayward
authored
1 hour ago
19ac9cb1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
2 deletions
+34
-2
comment-permissions.spec.js
cypress/integration/comments/comment-permissions.spec.js
+14
-1
commands.js
cypress/support/commands.js
+11
-0
features.service.ts
src/app/services/features.service.ts
+9
-1
No files found.
cypress/integration/comments/comment-permissions.spec.js
View file @
19ac9cb1
context
.
skip
(
'
Comment Permissions
'
,
()
=>
{
context
(
'
Comment Permissions
'
,
()
=>
{
const
postMenu
=
'
minds-activity:first > div > m-post-menu
'
;
const
deletePostOption
=
"
m-post-menu > ul > li:visible:contains('Delete')
"
;
...
...
@@ -8,6 +8,19 @@ context.skip('Comment Permissions', () => {
before
(()
=>
{
//make a post new.
cy
.
overrideFeatureFlag
({
'
blockchain_creditcard
'
:
true
,
'
suggested-users
'
:
true
,
'
helpdesk
'
:
true
,
'
top-feeds
'
:
true
,
'
es-feeds
'
:
true
,
'
allow-comments-toggle
'
:
true
,
'
permissions
'
:
true
,
'
wire-multi-currency
'
:
true
,
'
dark-mode
'
:
true
,
'
pro
'
:
true
});
cy
.
getCookie
(
'
minds_sess
'
)
.
then
((
sessionCookie
)
=>
{
if
(
sessionCookie
===
null
)
{
...
...
This diff is collapsed.
Click to expand it.
cypress/support/commands.js
View file @
19ac9cb1
...
...
@@ -215,6 +215,17 @@ Cypress.Commands.add('post', (message) => {
});
});
/**
* Sets the feature flag cookie.
* @param { Object } flags - JSON object containing flags to turn on
* e.g. { dark mode:false, es-feeds: true }
* @returns void
*/
Cypress
.
Commands
.
add
(
'
overrideFeatureFlag
'
,
(
flags
)
=>
{
const
base64
=
Buffer
.
from
(
JSON
.
stringify
(
flags
)).
toString
(
"
base64
"
);
cy
.
setCookie
(
'
staging-features
'
,
base64
);
});
/**
* Converts base64 to blob format
* @param { string } b64Data - The base64 data.
...
...
This diff is collapsed.
Click to expand it.
src/app/services/features.service.ts
View file @
19ac9cb1
import
{
Injectable
,
isDevMode
}
from
'
@angular/core
'
;
import
{
Session
}
from
'
./session
'
;
import
{
Router
}
from
'
@angular/router
'
;
import
{
Cookie
}
from
'
../services/cookie
'
;
import
{
includes
}
from
'
lodash
'
;
@
Injectable
()
export
class
FeaturesService
{
protected
_features
:
any
;
protected
_warnedCache
:
{
[
key
:
string
]:
number
}
=
{};
private
cookie
:
Cookie
=
new
Cookie
();
constructor
(
private
session
:
Session
,
private
router
:
Router
)
{
this
.
_features
=
window
.
Minds
.
features
||
{};
...
...
@@ -20,6 +23,11 @@ export class FeaturesService {
return
!
this
.
has
(
feature
.
substring
(
1
));
}
const
overrides
=
JSON
.
parse
(
atob
(
this
.
cookie
.
get
(
'
staging-features
'
)));
if
(
feature
in
overrides
)
{
return
true
;
}
if
(
typeof
this
.
_features
[
feature
]
===
'
undefined
'
)
{
if
(
isDevMode
()
&&
!
this
.
_hasWarned
(
feature
))
{
console
.
warn
(
...
...
@@ -68,7 +76,7 @@ export class FeaturesService {
return
this
.
_warnedCache
[
feature
]
+
5000
<
Date
.
now
();
}
static
_
(
session
:
Session
,
router
:
Router
)
{
static
_
(
session
:
Session
,
router
:
Router
,
cookie
:
Cookie
)
{
return
new
FeaturesService
(
session
,
router
);
}
}
This diff is collapsed.
Click to expand it.