mirror of
https://gitlink.org.cn/Gitlink/forgeplus.git
synced 2026-07-16 23:18:56 +08:00
add: notice message skeletal code
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
json.id message["id"]
|
||||
# json.receiver do
|
||||
# json.partial! '/users/user_simple', locals: {user: current_user}
|
||||
# end
|
||||
json.status message["status"]
|
||||
json.content message["content"]
|
||||
json.notification_url message["notification_url"]
|
||||
json.source message["source"]
|
||||
case message["type"]
|
||||
when 1
|
||||
json.type "notification"
|
||||
when 2
|
||||
json.type "atme"
|
||||
json.sender do
|
||||
sender = User.find_by_id(message["sender"])
|
||||
if sender.present?
|
||||
json.partial! '/users/user_simple', locals: {user: sender}
|
||||
else
|
||||
json.nil
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,7 @@
|
||||
json.total_count @data["records_count"]
|
||||
json.type %w(notification atme).include?(params[:type]) ? params[:type] : ""
|
||||
json.unread_notification @data["unread_notification"]
|
||||
json.unread_atme @data["unread_atme"]
|
||||
json.messages @data["records"].each do |message|
|
||||
json.partial! "message", message: message.stringify_keys
|
||||
end
|
||||
Reference in New Issue
Block a user