Split pending organisations into a separate list and default to only returning organisations a user is an accepted member of (Fixes #1)

This commit is contained in:
2022-02-22 13:47:44 +00:00
parent e825050814
commit be8404c9a5
9 changed files with 44 additions and 17 deletions

View File

@@ -45,7 +45,7 @@
<a href="#" data-toggle="collapse" data-target="#submenu-organisations" aria-expanded="false"><i class="fa fa-fw fa-sitemap"></i> <span>{{ translate("ORGANISATION.SELF") }}</span> <i class="fa fa-fw pull-right fa-angle-down"></i></a>
<ul id="submenu-organisations" class="collapsable collapse" aria-expanded="false" style="height: 1px;">
{% for organisation in current_user.organisations %}
{% if (organisation.flag_approved and isOrganisationMember(organisation)) or isOrganisationRegistrant(organisation) %}
{% if organisation.flag_approved or isOrganisationRegistrant(organisation) %}
<li>
<a href="{{site.uri.public}}/organisations/o/{{organisation.slug}}"><i class="fas fa-angle-double-right"></i> <span>{{organisation.name}}</span></a>
</li>

View File

@@ -35,7 +35,7 @@
<i class="fas fa-minus-square"></i> {{translate("VIEW_DELETED")}}
</button>
{% elseif checkAccess('register_organisation') %}
{% if (organisationConfig.membership.single_membership == 0) or (current_user.organisations.count == 0) %}
{% if (organisationConfig.membership.single_membership == 0) or ((current_user.organisations.count == 0) and (current_user.pendingOrganisations.count == 0)) %}
<button type="button" class="btn btn-success js-organisation-register">
<i class="fas fa-plus-square"></i> {{translate("ORGANISATION.REGISTRATION.REGISTER")}}
</button>

View File

@@ -117,7 +117,7 @@
{% endverbatim %}{{translate("LEAVE")}}{% verbatim %}
</button>
{{ else }}
{% endverbatim %}{% if (organisationConfig.membership.single_membership == 0) or (current_user.organisations.count == 0) %}{% verbatim %}
{% endverbatim %}{% if (organisationConfig.membership.single_membership == 0) or ((current_user.organisations.count == 0) and (current_user.pendingOrganisations.count == 0)) %}{% verbatim %}
<button type="button" data-slug="{{row.slug}}" class="btn btn-success js-organisation-join" style="min-width: 70px">
{% endverbatim %}{{translate("JOIN")}}{% verbatim %}
</button>

View File

@@ -83,15 +83,18 @@
{% block table_cell_template_organisations %}
{% verbatim %}
<script id="user-table-column-organisations" type="text/x-handlebars-template">
{{#if row.organisations.length }}
<td style="line-height: 2em;">
{{#if row.organisations.length }}
{{#each row.organisations }}
<a href="{% endverbatim %}{{site.uri.public}}{% verbatim %}/organisations/o/{{this.slug}}" class="label bg-primary {{#ifx this.pivot.flag_approved '!=' 1 }}membership-pending{{/ifx}} {{#ifx this.flag_approved '!=' 1 }}organisation-pending{{/ifx}} {{#if this.pivot.flag_admin }}organisation-admin{{/if}}" title="{{this.description}}" data-text="{{this.name}}" style="font-size: 100%;">{{this.name}}</a><br>
<a href="{% endverbatim %}{{site.uri.public}}{% verbatim %}/organisations/o/{{this.slug}}" class="label bg-primary {{#ifx this.flag_approved '!=' 1 }}organisation-pending{{/ifx}} {{#if this.pivot.flag_admin }}organisation-admin{{/if}}" title="{{this.description}}" data-text="{{this.name}}" style="font-size: 100%;">{{this.name}}</a><br>
{{/each}}
</td>
{{ else }}
<td></td>
{{/if }}
{{#if row.pending_organisations.length }}
{{#each row.pending_organisations }}
<a href="{% endverbatim %}{{site.uri.public}}{% verbatim %}/organisations/o/{{this.slug}}" class="label bg-primary {{#ifx this.flag_approved '!=' 1 }}organisation-pending{{/ifx}} {{#if this.pivot.flag_admin }}organisation-admin{{/if}} membership-pending" title="{{this.description}}" data-text="{{this.name}}" style="font-size: 100%;">{{this.name}}</a><br>
{{/each}}
{{/if }}
</td>
</script>
{% endverbatim %}
{% endblock %}