Skip to content
Next
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in / Register
Toggle navigation
Minds Backend - Engine
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Locked Files
Issues
139
Issues
139
List
Boards
Labels
Service Desk
Milestones
Merge Requests
29
Merge Requests
29
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Packages
Packages
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
294a8bc2
Commit
294a8bc2
authored
16 minutes ago
by
Mark Harding
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(feat): support onchain boost label
parent
5b0ef158
master
No related merge requests found
Pipeline
#63702895
passed with stages
in 7 minutes and 2 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
12 deletions
+19
-12
Boost.php
Core/Boost/Network/Boost.php
+9
-0
BoostGuidResolverDelegate.php
Core/Entities/Delegates/BoostGuidResolverDelegate.php
+9
-12
Activity.php
Entities/Activity.php
+1
-0
No files found.
Core/Boost/Network/Boost.php
View file @
294a8bc2
...
...
@@ -125,6 +125,15 @@ class Boost
return
'created'
;
}
/**
* Return if the boost is an onchain boost
* @return boolean
*/
public
function
isOnChain
()
{
return
(
strpos
(
$this
->
getTransactionId
(),
'0x'
,
0
)
===
0
);
}
/**
* Export
* @param array $fields
...
...
This diff is collapsed.
Click to expand it.
Core/Entities/Delegates/BoostGuidResolverDelegate.php
View file @
294a8bc2
...
...
@@ -16,17 +16,17 @@ use Minds\Entities\Boost\BoostEntityInterface;
class
BoostGuidResolverDelegate
implements
ResolverDelegate
{
/**
* @var
Repository
* @var
Manager
*/
protected
$
repository
;
protected
$
manager
;
/**
* BoostGuidResolverDelegate constructor.
* @param
Repository $repository
* @param
Manager $manager
*/
public
function
__construct
(
$
repository
=
null
)
public
function
__construct
(
$
manager
=
null
)
{
$this
->
repository
=
$repository
?:
Di
::
_
()
->
get
(
'Boost\Repository
'
);
$this
->
manager
=
$manager
?:
Di
::
_
()
->
get
(
'Boost\Network\Manager
'
);
}
/**
...
...
@@ -45,15 +45,11 @@ class BoostGuidResolverDelegate implements ResolverDelegate
*/
public
function
resolve
(
array
$urns
,
array
$opts
=
[])
{
$meta
=
array_map
(
function
(
Urn
$urn
)
{
return
explode
(
':'
,
$urn
->
getNss
(),
2
);
},
$urns
);
$entities
=
[];
foreach
(
$
meta
as
list
(
$type
,
$guid
)
)
{
foreach
(
$
urns
as
$urn
)
{
/** @var BoostEntityInterface $boost */
$boost
=
$this
->
repository
->
getEntity
(
$type
,
$guid
);
$boost
=
$this
->
manager
->
get
(
$urn
,
[
'hydrate'
=>
true
]
);
$entities
[]
=
$boost
;
}
...
...
@@ -72,6 +68,7 @@ class BoostGuidResolverDelegate implements ResolverDelegate
if
(
$boostedEntity
)
{
$boostedEntity
->
boosted
=
true
;
$boostedEntity
->
boosted_guid
=
$entity
->
getGuid
();
$boostedEntity
->
boosted_onchain
=
$entity
->
isOnChain
();
$boostedEntity
->
urn
=
$urn
;
}
...
...
@@ -88,6 +85,6 @@ class BoostGuidResolverDelegate implements ResolverDelegate
return
null
;
}
return
"urn:boost:
{
$entity
->
get
Handler
()
}
:
{
$entity
->
getGuid
()
}
"
;
return
"urn:boost:
{
$entity
->
get
Type
()
}
:
{
$entity
->
getGuid
()
}
"
;
}
}
This diff is collapsed.
Click to expand it.
Entities/Activity.php
View file @
294a8bc2
...
...
@@ -236,6 +236,7 @@ class Activity extends Entity
if
(
$this
->
boosted_guid
)
{
$export
[
'boosted'
]
=
(
bool
)
$this
->
boosted
;
$export
[
'boosted_guid'
]
=
(
string
)
$this
->
boosted_guid
;
$export
[
'boosted_onchain'
]
=
$this
->
boosted_onchain
;
}
$export
[
'impressions'
]
=
$this
->
getImpressions
();
...
...
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