mirror of https://github.com/zulip/zulip.git
invite: Add frontend support to send an invite which never expires.
Fixes part of #20337.
This commit is contained in:
parent
392b17da5f
commit
9be82356cb
|
@ -34,7 +34,15 @@ function reset_error_messages() {
|
||||||
|
|
||||||
function get_common_invitation_data() {
|
function get_common_invitation_data() {
|
||||||
const invite_as = Number.parseInt($("#invite_as").val(), 10);
|
const invite_as = Number.parseInt($("#invite_as").val(), 10);
|
||||||
const expires_in = Number.parseFloat($("#expires_in").val());
|
let expires_in = $("#expires_in").val();
|
||||||
|
|
||||||
|
// See settings_config.expires_in_values for why we do this conversion.
|
||||||
|
if (expires_in === "null") {
|
||||||
|
expires_in = JSON.stringify(null);
|
||||||
|
} else {
|
||||||
|
expires_in = Number.parseFloat($("#expires_in").val());
|
||||||
|
}
|
||||||
|
|
||||||
const stream_ids = [];
|
const stream_ids = [];
|
||||||
$("#invite-stream-checkboxes input:checked").each(function () {
|
$("#invite-stream-checkboxes input:checked").each(function () {
|
||||||
const stream_id = Number.parseInt($(this).val(), 10);
|
const stream_id = Number.parseInt($(this).val(), 10);
|
||||||
|
|
|
@ -467,12 +467,15 @@ export const expires_in_values = {
|
||||||
description: $t({defaultMessage: "30 days"}),
|
description: $t({defaultMessage: "30 days"}),
|
||||||
default: false,
|
default: false,
|
||||||
},
|
},
|
||||||
// Backend support for this configuration is not available yet.
|
never: {
|
||||||
// never: {
|
// Ideally we'd just store `null`, not the string `"null"`, but
|
||||||
// value: "never",
|
// .val() will read null back as `""`. Custom logic in
|
||||||
// description: $t({defaultMessage: "Never expires"}),
|
// get_common_invitation_data converts this back to `null`
|
||||||
// default: false,
|
// before sending to the server.
|
||||||
// }
|
value: "null",
|
||||||
|
description: $t({defaultMessage: "Never expires"}),
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
const user_role_array = Object.values(user_role_values);
|
const user_role_array = Object.values(user_role_values);
|
||||||
|
|
|
@ -62,7 +62,9 @@ function populate_invites(invites_data) {
|
||||||
name: "admin_invites_list",
|
name: "admin_invites_list",
|
||||||
modifier(item) {
|
modifier(item) {
|
||||||
item.invited_absolute_time = timerender.absolute_time(item.invited * 1000);
|
item.invited_absolute_time = timerender.absolute_time(item.invited * 1000);
|
||||||
|
if (item.expiry_date !== null) {
|
||||||
item.expiry_date_absolute_time = timerender.absolute_time(item.expiry_date * 1000);
|
item.expiry_date_absolute_time = timerender.absolute_time(item.expiry_date * 1000);
|
||||||
|
}
|
||||||
item.is_admin = page_params.is_admin;
|
item.is_admin = page_params.is_admin;
|
||||||
item.disable_buttons =
|
item.disable_buttons =
|
||||||
item.invited_as === settings_config.user_role_values.owner.code &&
|
item.invited_as === settings_config.user_role_values.owner.code &&
|
||||||
|
|
|
@ -22,7 +22,11 @@
|
||||||
<span class="invited_at">{{invited_absolute_time}}</span>
|
<span class="invited_at">{{invited_absolute_time}}</span>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
|
{{#if expiry_date_absolute_time}}
|
||||||
<span class="expires_at">{{expiry_date_absolute_time}}</span>
|
<span class="expires_at">{{expiry_date_absolute_time}}</span>
|
||||||
|
{{else}}
|
||||||
|
<span class="expires_at">{{t "Never expires"}}</span>
|
||||||
|
{{/if}}
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<span>{{invited_as_text}}</span>
|
<span>{{invited_as_text}}</span>
|
||||||
|
|
Loading…
Reference in New Issue