mirror of
https://github.com/viq/NewsBlur.git
synced 2025-08-31 22:20:12 +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:
|
||||
continue
|
||||
self.feeds = dict(self.feeds)
|
||||
|
||||
|
||||
@property
|
||||
def feed_count(self):
|
||||
return len(self.feeds)
|
||||
|
||||
|
||||
class OPMLImporter(Importer):
|
||||
|
||||
|
|
|
@ -83,7 +83,7 @@ def opml_export(request):
|
|||
opml = exporter.process()
|
||||
|
||||
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['Content-Disposition'] = 'attachment; filename=NewsBlur-%s-%s.opml' % (
|
||||
|
|
|
@ -759,7 +759,7 @@ class Profile(models.Model):
|
|||
msg.send(fail_silently=True)
|
||||
|
||||
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)
|
||||
|
||||
|
|
|
@ -3232,14 +3232,14 @@ class MActivity(mongo.Document):
|
|||
cls.objects.create(**params)
|
||||
|
||||
@classmethod
|
||||
def new_opml_export(cls, user_id, automated=False):
|
||||
def new_opml_export(cls, user_id, count, automated=False):
|
||||
params = {
|
||||
"user_id": user_id,
|
||||
"category": 'opml_export',
|
||||
'content': "You exported an OPML backup of your subscriptions"
|
||||
'content': f"You exported an OPML backup of {count} subscriptions"
|
||||
}
|
||||
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)
|
||||
|
||||
@classmethod
|
||||
|
|
Loading…
Add table
Reference in a new issue