Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
cleaning-portalmec
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Richard Fernando Heise Ferreira
cleaning-portalmec
Commits
5820bc36
Commit
5820bc36
authored
8 years ago
by
Israel Barreto Sant'Anna
Browse files
Options
Downloads
Patches
Plain Diff
Added trackable_type to activity serializer and fixed user.activities
Signed-off-by:
Israel Barreto Sant'Anna
<
ibsa14@inf.ufpr.br
>
parent
a37cf8f5
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/models/user.rb
+1
-1
1 addition, 1 deletion
app/models/user.rb
app/serializers/public_activity/activity_serializer.rb
+1
-1
1 addition, 1 deletion
app/serializers/public_activity/activity_serializer.rb
with
2 additions
and
2 deletions
app/models/user.rb
+
1
−
1
View file @
5820bc36
...
@@ -142,7 +142,7 @@ class User < ApplicationRecord
...
@@ -142,7 +142,7 @@ class User < ApplicationRecord
# return an array of PublicActivity::Activity
# return an array of PublicActivity::Activity
def
activities
def
activities
condition
=
'(owner_type = :type AND owner_id = :id) OR (recipient_type = :type AND recipient_id = :id)'
condition
=
'(owner_type = :type AND owner_id = :id) OR (recipient_type = :type AND recipient_id = :id)'
PublicActivity
::
Activity
.
order
(
'created_at DESC'
).
where
(
condition
,
{
type:
object
.
class
.
to_s
,
id:
object
.
id
}).
all
PublicActivity
::
Activity
.
order
(
'created_at DESC'
).
where
(
condition
,
{
type:
self
.
class
.
to_s
,
id:
self
.
id
}).
all
end
end
private
private
...
...
This diff is collapsed.
Click to expand it.
app/serializers/public_activity/activity_serializer.rb
+
1
−
1
View file @
5820bc36
class
PublicActivity::ActivitySerializer
<
ActiveModel
::
Serializer
class
PublicActivity::ActivitySerializer
<
ActiveModel
::
Serializer
attributes
:id
,
:owner
,
:trackable
,
:recipient
,
:parameters
,
:created_at
attributes
:id
,
:owner
,
:trackable
,
:trackable_type
,
:recipient
,
:parameters
,
:created_at
end
end
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