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 Backend - Engine
Project
Project
Details
Activity
Releases
Cycle Analytics
Insights
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Locked Files
Issues
221
Issues
221
List
Boards
Labels
Service Desk
Milestones
Merge Requests
36
Merge Requests
36
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 Backend - Engine
Commits
4ed0025f
Commit
4ed0025f
authored
2 days ago
by
Mark Harding
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(fix): move create referral cookie step to shutdown function vs api result
parent
8450551b
feat/842-issue-referral-cookie
1 merge request
!333
WIP: Resolve "Issue referral cookie on channel and asset pages if not already set"
Pipeline
#83834341
passed with stages
in 10 minutes and 49 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
3 deletions
+17
-3
Factory.php
Api/Factory.php
+0
-3
ReferralCookie.php
Core/Referrals/ReferralCookie.php
+17
-0
No files found.
Api/Factory.php
View file @
4ed0025f
...
...
@@ -146,9 +146,6 @@ class Factory
*/
public
static
function
response
(
$data
=
[])
{
Di
::
_
()
->
get
(
'Referrals\Cookie'
)
->
create
();
$data
=
array_merge
([
'status'
=>
'success'
,
//should success be assumed?
],
$data
);
...
...
This diff is collapsed.
Click to expand it.
Core/Referrals/ReferralCookie.php
View file @
4ed0025f
...
...
@@ -16,6 +16,14 @@ class ReferralCookie
/** @var Entity */
private
$entity
;
public
function
__construct
()
{
register_shutdown_function
(
function
()
{
error_log
(
'shutdown called'
);
$this
->
create
();
});
}
/**
* Set the router request
* @param Request $request
...
...
@@ -45,7 +53,9 @@ class ReferralCookie
*/
public
function
create
()
:
void
{
error_log
(
'referral create function called!'
);
if
(
!
$this
->
request
)
{
error_log
(
'no request'
);
return
;
}
...
...
@@ -53,12 +63,14 @@ class ReferralCookie
$params
=
$this
->
request
->
getQueryParams
();
if
(
isset
(
$cookies
[
'referrer'
]))
{
error_log
(
'found referrer cookie'
);
return
;
// Do not override previosuly set cookie
}
$referrerGuid
=
null
;
if
(
isset
(
$params
[
'referrer'
]))
{
// Is a referrer param set in the request?
error_log
(
'referrer param is '
.
$params
[
'referrer'
]);
$referrerGuid
=
$params
[
'referrer'
];
}
elseif
(
$this
->
entity
)
{
// Was an entity set?
switch
(
get_class
(
$this
->
entity
))
{
...
...
@@ -80,5 +92,10 @@ class ReferralCookie
->
create
();
$_COOKIE
[
'referrer'
]
=
$referrerGuid
;
// TODO: replace with Response object later
}
error_log
(
"referrerGuid is
$referrerGuid
"
);
error_log
(
print_r
(
$params
,
true
));
error_log
(
print_r
(
$this
->
request
,
true
));
error_log
(
print_r
(
$this
->
entity
,
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