mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-01 15:09:14 +00:00
show "Expired" when file share expired
This commit is contained in:
@@ -145,6 +145,12 @@ class FileShare(models.Model):
|
||||
def is_encrypted(self):
|
||||
return True if self.password is not None else False
|
||||
|
||||
def is_expired(self):
|
||||
if self.expire_date is not None and timezone.now() > self.expire_date:
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
class OrgFileShareManager(models.Manager):
|
||||
def set_org_file_share(self, org_id, file_share):
|
||||
"""Set a share link as org share link.
|
||||
|
@@ -1413,6 +1413,7 @@ def ajax_get_download_link(request):
|
||||
data = {
|
||||
'download_link': gen_shared_link(token, l[0].s_type),
|
||||
'token': token,
|
||||
'is_expired': l[0].is_expired(),
|
||||
}
|
||||
else:
|
||||
data = {}
|
||||
|
@@ -119,12 +119,22 @@ define([
|
||||
downloadLinkPanelInit: function() {
|
||||
var _this = this;
|
||||
var after_op_success = function(data) {
|
||||
|
||||
_this.$('.loading-tip').hide();
|
||||
|
||||
if (data['download_link']) {
|
||||
if (data['is_expired']) {
|
||||
_this.$('#send-download-link').addClass('hide');
|
||||
_this.$('#download-link').html(data['download_link'] + ' ' + gettext('(Expired)'))
|
||||
.addClass('error');
|
||||
_this.$('#direct-dl-link').html(data['download_link']+'?raw=1' + ' ' + gettext('(Expired)'))
|
||||
.addClass('error');
|
||||
} else {
|
||||
_this.$('#download-link').html(data['download_link']); // TODO:
|
||||
_this.$('#direct-dl-link').html(data['download_link']+'?raw=1'); // TODO:
|
||||
}
|
||||
_this.download_link = data["download_link"]; // for 'link send'
|
||||
_this.download_link_token = data["token"]; // for 'link delete'
|
||||
_this.$('#download-link').html(data['download_link']); // TODO:
|
||||
_this.$('#direct-dl-link').html(data['download_link']+'?raw=1'); // TODO:
|
||||
_this.$('#download-link-operations').removeClass('hide');
|
||||
} else {
|
||||
_this.$('#generate-download-link-form').removeClass('hide');
|
||||
|
Reference in New Issue
Block a user