Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
Metabase
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Engineering Digital Service
Metabase
Commits
291536dd
Unverified
Commit
291536dd
authored
2 years ago
by
Braden Shepherdson
Committed by
GitHub
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Include moderated_status on /api/activity/recent_views (#21777)
The frontend doesn't currently use this value.
parent
d6c78de7
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/metabase/api/activity.clj
+19
-18
19 additions, 18 deletions
src/metabase/api/activity.clj
with
19 additions
and
18 deletions
src/metabase/api/activity.clj
+
19
−
18
View file @
291536dd
...
...
@@ -111,20 +111,25 @@
(
not=
model
"table"
)
(
merge
{
:left-join
[
Collection
[
:=
(
db/qualify
Collection
:id
)
:collection_id
]]}))))
(
defn-
select-items!
[
model
ids
]
(
when
(
seq
ids
)
(
for
[
model
(
hydrate
(
models-query
model
ids
)
:moderation_reviews
)
:let
[
reviews
(
:moderation_reviews
model
)
status
(
->>
reviews
(
filter
:most_recent
)
first
:status
)]]
(
assoc
model
:moderated_status
status
))))
(
defn-
models-for-views
"Returns a map of {model {id instance}} for activity views suitable for looking up by model and id to get a model."
[
views
]
(
letfn
[(
select-items!
[
model
ids
]
(
when
(
seq
ids
)
(
->
(
models-query
model
ids
)
(
hydrate
:moderation_reviews
))))
(
by-id
[
models
]
(
m/index-by
:id
models
))]
(
into
{}
(
map
(
fn
[[
model
models
]]
[
model
(
->>
models
(
map
:model_id
)
(
select-items!
model
)
(
by-id
))]))
(
group-by
:model
views
))))
(
into
{}
(
map
(
fn
[[
model
models
]]
[
model
(
->>
models
(
map
:model_id
)
(
select-items!
model
)
(
m/index-by
:id
))]))
(
group-by
:model
views
)))
(
defn-
views-and-runs
"Common query implementation for `recent_views` and `popular_items`. Tables and Dashboards have a query limit of `views-limit`.
...
...
@@ -200,13 +205,9 @@
(
#
{
"official"
}
authority_level
))))
(
defn-
verified?
"Return true if the item is verified, false otherwise. Assumes that `:moderation_reviews` is hydrated.
Assumes that moderation reviews are ordered so that the most recent is the first. This is the case
from the hydration function for moderation_reviews."
[{
:keys
[
moderation_reviews
]}]
(
boolean
(
when
moderation_reviews
(
->
moderation_reviews
first
:status
#
{
"verified"
}))))
"Return true if the item is verified, false otherwise. Assumes that `:moderated_status` is hydrated."
[{
:keys
[
moderated_status
]}]
(
=
moderated_status
"verified"
))
(
defn-
score-items
[
items
]
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment