
Security News
How Enterprise Security Is Adapting to AI-Accelerated Threats
Socket CTO Ahmad Nassri discusses why supply chain attacks now target developer machines and what AI means for the future of enterprise security.
@bigbinary/neeto-activities-frontend
Advanced tools
A repo acts as the source of truth for the new nano's structure, configs, data etc.
The nano that manages backend structure for activities.
create_table :neeto_activities_engine_activities, id: :uuid do |t|
# Parent association for the activity, example: Ticket
t.references :trackable, polymorphic: true, index: true, type: :uuid
# Performer of the activity, example: User
t.references :performer, polymorphic: true, type: :uuid
# Unique key per activity that can be used in translations to render on UI
t.string :key
# Any additional details that might be helpful for building the translations or debugging purpose
t.jsonb :metadata, default: {}
t.timestamps
end
Check an example of an activity generated for updating the ticket status in neetoDesk.
#<NeetoActivitiesEngine::Activity:0x000000013237f158> {
:id => "d0458158-68d1-423f-b364-d22a8916f6d0",
:key => "activity.ticket.update.status",
:trackable_type => "Ticket",
:trackable_id => "c5104a50-2eff-49a3-accb-f2fa8f4fc1f7",
:performer_type => "User",
:performer_id => "b028d29e-f40a-4c09-9222-357cfe84e2c3",
:created_at => Mon, 30 Oct 2023 10:23:26.705884000 UTC +00:00,
:updated_at => Mon, 30 Oct 2023 10:23:26.705884000 UTC +00:00,
:metadata => {
"new_value" => "trash",
"old_value" => "open"
}
}
We have a concern that can be included in the models that need to track the activities, this concern adds associations and a helper method that allows creating activities easily.
Refer: NeetoActivitiesEngine::Trackable
Example:
class User
include NeetoActivitiesEngine::Trackable
after_save :log_account_block_activity!, if: :blocked?
private
def log_account_block_activity!
old_value, new_value = saved_change_to_blocked_at
key = new_value ? "activity.user.blocked" : "activity.user.unblocked"
metadata = { performer_name: User.current&.name }
log_activity!(key:, metadata:, performer: User.current)
end
end
neetoDesk needs many custom activities for tickets, in order to achieve it, we have created another concern that works on top of the above concern.
Refer: app/models/concerns/trackable/tickets.rb
Usage:
class Ticket
include NeetoActivitiesEngine::Trackable
include Trackable::Tickets # Depends on NeetoActivitiesEngine::Trackable
end
Using User.current is not a good practice,
it also does not fit in all the places.
Example: In neetoDesk, Automation rules can update tickets,
here the performer is Automation::Rule not User.
To get around this problem, we have activity_performer attr_accessor.
class Ticket
include NeetoActivitiesEngine::Trackable
after_save :log_status_activity!, if: :saved_change_to_status?
private
def log_status_activity!
old_value, new_value = saved_change_to_status
key = "activity.ticket.status.update"
metadata = { old_value:, new_value: }
log_activity!(key: , metadata:, performer: activity_performer)
end
end
ticket.activity_performer = Automation::Rule.first
ticket.update(status: :closed)
Occationally, the business logic demands to skip the activity.
For this, we have added skip_activity attr_accessor in the concern.
Example: Assume that you want to skip the activities when you update the ticket from Rails console.
class Ticket
include NeetoActivitiesEngine::Trackable
after_save :log_status_activity!, if: :saved_change_to_status?
private
def log_status_activity!
old_value, new_value = saved_change_to_status
key = "activity.ticket.status.update"
metadata = { old_value:, new_value: }
log_activity!(key: , metadata:, performer: activity_performer)
end
end
# rails c
ticket.skip_activity = true
ticket.update(status: :closed)
FAQs
A repo acts as the source of truth for the new nano's structure, configs, data etc.
We found that @bigbinary/neeto-activities-frontend demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Socket CTO Ahmad Nassri discusses why supply chain attacks now target developer machines and what AI means for the future of enterprise security.

Security News
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.

Security News
Experts push back on new claims about AI-driven ransomware, warning that hype and sponsored research are distorting how the threat is understood.