diff --git a/app/api/mobile/entities/activity.rb b/app/api/mobile/entities/activity.rb index ad4af39fd..fdc03c47b 100644 --- a/app/api/mobile/entities/activity.rb +++ b/app/api/mobile/entities/activity.rb @@ -30,22 +30,26 @@ module Mobile ac.nil? || ac.act.nil? ? 0 : ac.act.journals.where("notes is not null and notes != ''").count end when :subject - if ac.act_type == "HomeworkCommon" - ac.act.name unless ac.nil? || ac.act.nil? - elsif ac.act_type == "News" || ac.act_type == "BlogComment" - ac.act.title unless ac.nil? || ac.act.nil? - elsif ac.act_type == "Message" || ac.act_type == "Issue" - ac.act.subject unless ac.nil? || ac.act.nil? - elsif ac.act_type == "JournalsForMessage" - ac.act.private == 0 ? "留言" : "私信" + unless ac.act.nil? + if ac.act_type == "HomeworkCommon" + ac.act.name unless ac.nil? || ac.act.nil? + elsif ac.act_type == "News" || ac.act_type == "BlogComment" + ac.act.title unless ac.nil? || ac.act.nil? + elsif ac.act_type == "Message" || ac.act_type == "Issue" + ac.act.subject unless ac.nil? || ac.act.nil? + elsif ac.act_type == "JournalsForMessage" + ac.act.private == 0 ? "留言" : "私信" + end end when :description - if ac.act_type == "HomeworkCommon" || ac.act_type == "Issue" || ac.act_type == "News" - ac.act.description unless ac.nil? || ac.act.nil? - elsif ac.act_type == "Message" || ac.act_type == "BlogComment" - ac.act.content unless ac.nil? || ac.act.nil? - elsif ac.act_type == "JournalsForMessage" - ac.act.notes + unless ac.act.nil? + if ac.act_type == "HomeworkCommon" || ac.act_type == "Issue" || ac.act_type == "News" + ac.act.description unless ac.nil? || ac.act.nil? + elsif ac.act_type == "Message" || ac.act_type == "BlogComment" + ac.act.content unless ac.nil? || ac.act.nil? + elsif ac.act_type == "JournalsForMessage" + ac.act.notes + end end when :latest_update time_from_now ac.updated_at unless ac.nil? @@ -103,12 +107,14 @@ module Mobile if a.is_a? ::UserActivity if a.act_type == "ProjectCreateInfo" get_user(get_project(a.act_id).user_id) - elsif a.act_type == 'Issue' || a.act_type == 'News' || a.act_type == 'Message' || a.act_type == 'BlogComment' + elsif !a.act.nil? + if a.act_type == 'Issue' || a.act_type == 'News' || a.act_type == 'Message' || a.act_type == 'BlogComment' a.act.author - elsif a.act_type == 'HomeworkCommon' || a.act_type == 'Poll' || a.act_type == 'JournalsForMessage' - a.act.user - elsif a.act_type == 'Course' - a.act.teacher + elsif a.act_type == 'HomeworkCommon' || a.act_type == 'Poll' || a.act_type == 'JournalsForMessage' + a.act.user + elsif a.act_type == 'Course' + a.act.teacher + end end end end