mirror of
https://github.com/zulip/zulip.git
synced 2025-11-03 21:43:21 +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"));
|
||||
}
|
||||
|
||||
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) {
|
||||
if (!meta.loaded) {
|
||||
return;
|
||||
}
|
||||
|
||||
add_invited_as_text(invites_data.invites);
|
||||
|
||||
var invites_table = $("#admin_invites_table").expectOne();
|
||||
|
||||
var admin_invites_list = list_render.get("admin_invites_list");
|
||||
|
||||
@@ -12,6 +12,9 @@
|
||||
<td>
|
||||
<span class="invited_at">{{invited}}</span>
|
||||
</td>
|
||||
<td>
|
||||
<span>{{invited_as_text}}</span>
|
||||
</td>
|
||||
<td>
|
||||
<button class="button rounded small revoke btn-danger" data-invite-id="{{id}}">
|
||||
{{t "Revoke" }}
|
||||
|
||||
@@ -9,7 +9,8 @@
|
||||
<th>{{t "Email" }}</th>
|
||||
<th>{{t "Invited by" }}</th>
|
||||
<th>{{t "Invited at" }}</th>
|
||||
<th class="actions">{{t "Actions" }}</th>
|
||||
<th>{{t "Invited as" }}</th>
|
||||
<th>{{t "Actions" }}</th>
|
||||
</thead>
|
||||
<tbody id="admin_invites_table" class="required-text thick admin_invites_table" data-empty="{{t 'No invites match your current filter.' }}"></tbody>
|
||||
</table>
|
||||
|
||||
@@ -1047,6 +1047,9 @@ class PreregistrationUser(models.Model):
|
||||
|
||||
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(
|
||||
MEMBER = 1,
|
||||
REALM_ADMIN = 2,
|
||||
|
||||
Reference in New Issue
Block a user