Skip to content

Commit

Permalink
Merge pull request #217 from BBMRI-ERIC/feat/adds_support_to_public_a…
Browse files Browse the repository at this point in the history
…nd_private_posts

Changes negotiation posts to support public and private posts
  • Loading branch information
tmilost committed Jun 7, 2024
2 parents afb80dd + 7ef613e commit aa1be2e
Showing 1 changed file with 20 additions and 9 deletions.
29 changes: 20 additions & 9 deletions src/components/NegotiationPosts.vue
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
<div class="d-flex flex-row-reverse mt-3 mb-2">
<span
data-bs-toggle="tooltip"
:title="negotiation.postsEnabled ? '' : 'Messaging is unavailable until the request has been reviewed.' "
:title="negotiation.privatePostsEnabled ? '' : 'Messaging is unavailable until the request has been reviewed.' "
>
<button
type="submit"
Expand Down Expand Up @@ -94,13 +94,16 @@
<option value="Everyone">
Everyone
</option>
<option
v-for="recipient in recipients"
:key="recipient.id"
:value="recipient.id"
>
{{ recipient.name }}
</option>
<optgroup :label="privatePostsGroupLabel">
<option
v-for="recipient in recipients"
:key="recipient.id"
:value="recipient.id"
:disabled="!negotiation.privatePostsEnabled"
>
{{ recipient.name }}
</option>
</optgroup>
</select>
</div>
</form>
Expand Down Expand Up @@ -151,13 +154,21 @@ const oidcUser = computed(() => {
})
const readyToSend = computed(() => {
return (message.value !== "" || attachment.value !== undefined) && recipientId.value !== "" && props.negotiation.postsEnabled
return (message.value !== "" || attachment.value !== undefined) && recipientId.value !== "" &&
(props.negotiation.publicPostsEnabled || props.negotiation.privatePostsEnabled)
})
const recipientsById = computed(() => {
return props.recipients.reduce((obj, item) => Object.assign(obj, { [item.id]: { name: item.name } }), {})
})
const privatePostsGroupLabel = computed(() => {
if (props.negotiation.privatePostsEnabled) {
return "Private messages"
}
return "Private messages will be enabled after an administrator will approve the negotiation"
})
onMounted(() => {
new Tooltip(document.body, {
selector: "[data-bs-toggle='tooltip']"
Expand Down

0 comments on commit aa1be2e

Please sign in to comment.