mirror of
https://github.com/zulip/zulip.git
synced 2025-11-04 22:13:26 +00:00
settings_invites: Add invited_as column to the table.
This makes it possible to review the roles used in active invitations.
This commit is contained in:
committed by
Tim Abbott
parent
efb9128aaa
commit
e26cba062b
@@ -15,10 +15,38 @@ function failed_listing_invites(xhr) {
|
|||||||
ui_report.error(i18n.t("Error listing invites"), xhr, $("#organization-status"));
|
ui_report.error(i18n.t("Error listing invites"), xhr, $("#organization-status"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
exports.invited_as_values = {
|
||||||
|
member: {
|
||||||
|
value: 1,
|
||||||
|
description: i18n.t("Member"),
|
||||||
|
},
|
||||||
|
admin_user: {
|
||||||
|
value: 2,
|
||||||
|
description: i18n.t("Organization administrator"),
|
||||||
|
},
|
||||||
|
guest_user: {
|
||||||
|
value: 3,
|
||||||
|
description: i18n.t("Guest user"),
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
function add_invited_as_text(invites) {
|
||||||
|
invites.forEach(data => {
|
||||||
|
var invited_as_type = _.findKey(exports.invited_as_values, function (elem) {
|
||||||
|
return elem.value === data.invited_as;
|
||||||
|
});
|
||||||
|
data.invited_as_text = exports.invited_as_values[invited_as_type].description;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function populate_invites(invites_data) {
|
function populate_invites(invites_data) {
|
||||||
if (!meta.loaded) {
|
if (!meta.loaded) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
add_invited_as_text(invites_data.invites);
|
||||||
|
|
||||||
var invites_table = $("#admin_invites_table").expectOne();
|
var invites_table = $("#admin_invites_table").expectOne();
|
||||||
|
|
||||||
var admin_invites_list = list_render.get("admin_invites_list");
|
var admin_invites_list = list_render.get("admin_invites_list");
|
||||||
|
|||||||
@@ -12,6 +12,9 @@
|
|||||||
<td>
|
<td>
|
||||||
<span class="invited_at">{{invited}}</span>
|
<span class="invited_at">{{invited}}</span>
|
||||||
</td>
|
</td>
|
||||||
|
<td>
|
||||||
|
<span>{{invited_as_text}}</span>
|
||||||
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<button class="button rounded small revoke btn-danger" data-invite-id="{{id}}">
|
<button class="button rounded small revoke btn-danger" data-invite-id="{{id}}">
|
||||||
{{t "Revoke" }}
|
{{t "Revoke" }}
|
||||||
|
|||||||
@@ -9,7 +9,8 @@
|
|||||||
<th>{{t "Email" }}</th>
|
<th>{{t "Email" }}</th>
|
||||||
<th>{{t "Invited by" }}</th>
|
<th>{{t "Invited by" }}</th>
|
||||||
<th>{{t "Invited at" }}</th>
|
<th>{{t "Invited at" }}</th>
|
||||||
<th class="actions">{{t "Actions" }}</th>
|
<th>{{t "Invited as" }}</th>
|
||||||
|
<th>{{t "Actions" }}</th>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody id="admin_invites_table" class="required-text thick admin_invites_table" data-empty="{{t 'No invites match your current filter.' }}"></tbody>
|
<tbody id="admin_invites_table" class="required-text thick admin_invites_table" data-empty="{{t 'No invites match your current filter.' }}"></tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|||||||
@@ -1047,6 +1047,9 @@ class PreregistrationUser(models.Model):
|
|||||||
|
|
||||||
realm = models.ForeignKey(Realm, null=True, on_delete=CASCADE) # type: Optional[Realm]
|
realm = models.ForeignKey(Realm, null=True, on_delete=CASCADE) # type: Optional[Realm]
|
||||||
|
|
||||||
|
# Changes to INVITED_AS should also be reflected in
|
||||||
|
# settings_invites.invited_as_values in
|
||||||
|
# static/js/settings_invites.js
|
||||||
INVITE_AS = dict(
|
INVITE_AS = dict(
|
||||||
MEMBER = 1,
|
MEMBER = 1,
|
||||||
REALM_ADMIN = 2,
|
REALM_ADMIN = 2,
|
||||||
|
|||||||
Reference in New Issue
Block a user