Skip to content

Commit

Permalink
show email address of recipient when inviting people to join discussi… (
Browse files Browse the repository at this point in the history
#10808)

* show email address of recipient when inviting people to join discussion, poll, group, if you're an admin

this is because it's easy for two people to have the same name, and we need a way to tell them apart
  • Loading branch information
robguthrie committed May 10, 2024
1 parent 2cffef9 commit 1ad2538
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
8 changes: 7 additions & 1 deletion app/controllers/api/v1/announcements_controller.rb
Expand Up @@ -147,8 +147,14 @@ def notification_kinds
end

def default_scope
if target_model && target_model.respond_to?(:group_id)
is_admin = target_model.group_id ? target_model.group.admins.exists?(current_user.id) : target_model.admins.exists?(current_user.id)
else
is_admin = false
end

super.merge(
include_email: (target_model && target_model.admins.exists?(current_user.id))
include_email: (is_admin)
)
end

Expand Down
4 changes: 3 additions & 1 deletion app/controllers/api/v1/discussion_readers_controller.rb
Expand Up @@ -48,7 +48,9 @@ def discussion_reader
end

def default_scope
super.merge({include_email: (@discussion_reader || @discussion).discussion.admins.exists?(current_user.id)})
discussion = (@discussion_reader || @discussion).discussion
is_admin = discussion.group_id ? discussion.group.admins.exists?(current_user.id) : discussion.admins.exists?(current_user.id)
super.merge({include_email: is_admin})
end

def accessible_records
Expand Down
2 changes: 2 additions & 0 deletions vue/src/components/common/recipients_autocomplete.vue
Expand Up @@ -392,6 +392,8 @@ div.recipients-autocomplete
span(v-if="data.item.type == 'user' && currentUserId == data.item.id")
space
span ({{ $t('common.you') }})
v-list-item-subtitle(v-if="data.item.user && data.item.user.email")
span {{data.item.user.email}}
notifications-count(
v-show="!hideCount && recipients.length"
:model='model'
Expand Down

0 comments on commit 1ad2538

Please sign in to comment.