diff --git a/app/adapters/user-message.ts b/app/adapters/user-message.ts new file mode 100644 index 00000000000..a92b865c714 --- /dev/null +++ b/app/adapters/user-message.ts @@ -0,0 +1,13 @@ +// app/adapters/user-message.js +import { inject as service } from '@ember/service'; +import config from 'ember-osf-web/config/environment'; +const { OSF: { apiUrl } } = config; +import OsfAdapter from './osf-adapter'; + +export default class UserMessageAdapter extends OsfAdapter { + @service session; + urlForCreateRecord(modelName, snapshot) { + const userId = snapshot.record.user; + return `${apiUrl}/v2/users/${userId}/messages/`; + } +} diff --git a/app/institutions/dashboard/-components/institutional-users-list/component.ts b/app/institutions/dashboard/-components/institutional-users-list/component.ts index 62c32591dc6..cadb989c193 100644 --- a/app/institutions/dashboard/-components/institutional-users-list/component.ts +++ b/app/institutions/dashboard/-components/institutional-users-list/component.ts @@ -26,6 +26,8 @@ interface InstitutionalUsersListArgs { export default class InstitutionalUsersList extends Component { @service analytics!: Analytics; @service intl!: Intl; + @service store; + @service currentUser!: CurrentUser; institution?: InstitutionModel; @@ -36,6 +38,10 @@ export default class InstitutionalUsersList extends Component {{institutionalUser.userName}} + {{else if (eq column.type 'osf_link')}} {{institutionalUser.userGuid}} @@ -185,4 +191,44 @@ {{t 'institutions.dashboard.users_list.empty'}} + + + {{t 'institutions.dashboard.send_message_modal.title'}} + + +
+
+ {{t 'institutions.dashboard.send_message_modal.opening_message_label'}} +
+ +
+ {{t 'institutions.dashboard.send_message_modal.closing_message_label' adminName=this.currentUser.user.fullName}} +
+
+
+ + + + +
{{/if}} diff --git a/app/models/user-message.ts b/app/models/user-message.ts new file mode 100644 index 00000000000..6233a239942 --- /dev/null +++ b/app/models/user-message.ts @@ -0,0 +1,8 @@ +// app/models/user-message.js +import Model, { attr, belongsTo } from '@ember-data/model'; + +export default class UserMessageModel extends Model { + @attr('string') messageText; + @attr('string') messageType; + @belongsTo('institution') institution; +} diff --git a/translations/en-us.yml b/translations/en-us.yml index 0416c52097d..b92b4bbdd72 100644 --- a/translations/en-us.yml +++ b/translations/en-us.yml @@ -799,6 +799,13 @@ institutions: search_placeholder: 'Search institutions' load_more: 'Load more institutions' dashboard: + send_message_modal: + title: 'Send Email' + opening_message_label: 'Comments:' + closing_message_label: 'Sincerely Yours, {adminName}' + message_sent_success: 'Message has been sent' + message_sent_failed: 'Message has failed to send of the issue persists contact your administrator' + send: 'Send' tabs: summary: Summary users: Users