mirror of
https://github.com/viq/NewsBlur.git
synced 2025-09-18 21:43:31 +00:00
Adding count to activity for exported OPML, for #1646.
This commit is contained in:
parent
93fb2dde12
commit
3a260fb2f7
4 changed files with 10 additions and 6 deletions
|
@ -106,7 +106,11 @@ class OPMLExporter(Importer):
|
||||||
except Feed.DoesNotExist:
|
except Feed.DoesNotExist:
|
||||||
continue
|
continue
|
||||||
self.feeds = dict(self.feeds)
|
self.feeds = dict(self.feeds)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def feed_count(self):
|
||||||
|
return len(self.feeds)
|
||||||
|
|
||||||
|
|
||||||
class OPMLImporter(Importer):
|
class OPMLImporter(Importer):
|
||||||
|
|
||||||
|
|
|
@ -83,7 +83,7 @@ def opml_export(request):
|
||||||
opml = exporter.process()
|
opml = exporter.process()
|
||||||
|
|
||||||
from apps.social.models import MActivity
|
from apps.social.models import MActivity
|
||||||
MActivity.new_opml_export(user_id=user.pk)
|
MActivity.new_opml_export(user_id=user.pk, count=exporter.feed_count)
|
||||||
|
|
||||||
response = HttpResponse(opml, content_type='text/xml; charset=utf-8')
|
response = HttpResponse(opml, content_type='text/xml; charset=utf-8')
|
||||||
response['Content-Disposition'] = 'attachment; filename=NewsBlur-%s-%s.opml' % (
|
response['Content-Disposition'] = 'attachment; filename=NewsBlur-%s-%s.opml' % (
|
||||||
|
|
|
@ -759,7 +759,7 @@ class Profile(models.Model):
|
||||||
msg.send(fail_silently=True)
|
msg.send(fail_silently=True)
|
||||||
|
|
||||||
from apps.social.models import MActivity
|
from apps.social.models import MActivity
|
||||||
MActivity.new_opml_export(user_id=self.user.pk, automated=True)
|
MActivity.new_opml_export(user_id=self.user.pk, count=exporter.feed_count, automated=True)
|
||||||
|
|
||||||
logging.user(self.user, "~BB~FM~SBSending OPML backup email to: %s" % self.user.email)
|
logging.user(self.user, "~BB~FM~SBSending OPML backup email to: %s" % self.user.email)
|
||||||
|
|
||||||
|
|
|
@ -3232,14 +3232,14 @@ class MActivity(mongo.Document):
|
||||||
cls.objects.create(**params)
|
cls.objects.create(**params)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def new_opml_export(cls, user_id, automated=False):
|
def new_opml_export(cls, user_id, count, automated=False):
|
||||||
params = {
|
params = {
|
||||||
"user_id": user_id,
|
"user_id": user_id,
|
||||||
"category": 'opml_export',
|
"category": 'opml_export',
|
||||||
'content': "You exported an OPML backup of your subscriptions"
|
'content': f"You exported an OPML backup of {count} subscriptions"
|
||||||
}
|
}
|
||||||
if automated:
|
if automated:
|
||||||
params['content'] = "An automatic OPML backup was emailed to you"
|
params['content'] = f"An automatic OPML backup of {count} subscriptions was emailed to you"
|
||||||
cls.objects.create(**params)
|
cls.objects.create(**params)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
|
Loading…
Add table
Reference in a new issue