mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 22:43:33 +08:00
FEATURE: add composer warning when user haven't been seen in a long time (#18340)
* FEATURE: add composer warning when user haven't been seen in a long time When a user creates a PM and adds a recipient that hasn't been seen in a long time then we'll now show a warning in composer indicating that the user hasn't been seen in a long time.
This commit is contained in:
@ -17,4 +17,22 @@ class ComposerMessagesController < ApplicationController
|
||||
|
||||
render_json_dump(json, rest_serializer: true)
|
||||
end
|
||||
|
||||
def user_not_seen_in_a_while
|
||||
usernames = params.require(:usernames)
|
||||
users = ComposerMessagesFinder.user_not_seen_in_a_while(usernames)
|
||||
user_count = users.count
|
||||
warning_message = nil
|
||||
|
||||
if user_count > 0
|
||||
message_locale = if user_count == 1
|
||||
"education.user_not_seen_in_a_while.single"
|
||||
else
|
||||
"education.user_not_seen_in_a_while.multiple"
|
||||
end
|
||||
end
|
||||
|
||||
json = { user_count: user_count, usernames: users, time_ago: FreedomPatches::Rails4.time_ago_in_words(SiteSetting.pm_warn_user_last_seen_months_ago.month.ago, true, scope: :'datetime.distance_in_words_verbose') }
|
||||
render_json_dump(json)
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user