You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
624 B
23 lines
624 B
5 years ago
|
class Users::PrivateMessageDetailsController < Users::BaseController
|
||
|
before_action :private_user_resources!
|
||
|
|
||
|
after_action :update_message_status, only: [:show]
|
||
|
|
||
|
def show
|
||
|
messages = observed_user.private_messages.without_deleted.where(target: target_user)
|
||
|
|
||
|
@count = messages.count
|
||
|
@messages = messages.order(send_time: :asc).includes(sender: :user_extension)
|
||
|
end
|
||
|
|
||
|
private
|
||
|
|
||
|
def target_user
|
||
|
@_target_user ||= User.find(params[:target_id])
|
||
|
end
|
||
|
|
||
|
# 置为已读
|
||
|
def update_message_status
|
||
|
observed_user.private_messages.only_unread.where(target: target_user).update_all(status: 1)
|
||
|
end
|
||
|
end
|