47
from canonical.launchpad import _
48
from lp.answers.interfaces.faq import IFAQ
47
49
from lp.answers.enums import (
51
from lp.answers.interfaces.faq import IFAQ
52
53
from lp.answers.interfaces.questionmessage import IQuestionMessage
53
54
from lp.answers.interfaces.questiontarget import IQuestionTarget
54
from lp.registry.interfaces.person import IPerson
55
55
from lp.registry.interfaces.role import IHasOwner
56
56
from lp.services.fields import PublicPersonChoice
57
57
from lp.services.worlddata.interfaces.language import ILanguage
156
156
description=_('Up-to-date notes on the status of the question.'))
157
157
# other attributes
158
158
target = exported(Reference(
159
title=_('This question is about'), required=True,
160
schema=IQuestionTarget,
161
description=_('The distribution, source package, or project the '
159
title=_('Project'), required=True, schema=IQuestionTarget,
160
description=_('The distribution, source package, or product the '
162
161
'question pertains to.')),
437
436
# subscription-related methods
439
@operation_parameters(
440
person=Reference(IPerson, title=_('Person'), required=True))
441
@call_with(subscribed_by=REQUEST_USER)
442
@export_write_operation()
443
@operation_for_version("devel")
444
def subscribe(person, subscribed_by=None):
445
"""Subscribe `person` to the question.
447
:param person: the subscriber.
448
:param subscribed_by: the person who created the subscription.
449
:return: an `IQuestionSubscription`.
437
def subscribe(person):
438
"""Subscribe this person to the question."""
452
440
def isSubscribed(person):
453
441
"""Return a boolean indicating whether the person is subscribed."""
455
@operation_parameters(
456
person=Reference(IPerson, title=_('Person'), required=False))
457
@call_with(unsubscribed_by=REQUEST_USER)
458
@export_write_operation()
459
@operation_for_version("devel")
460
def unsubscribe(person, unsubscribed_by):
461
"""Unsubscribe `person` from the question.
463
:param person: the subscriber.
464
:param unsubscribed_by: the person who removed the subscription.
443
def unsubscribe(person):
444
"""Remove the person's subscription to this question."""
467
446
def getDirectSubscribers():
468
447
"""Return the persons who are subscribed to this question.
470
449
:return: A list of persons sorted by displayname.
473
def getDirectSubscribersWithDetails():
474
"""Get direct subscribers and their subscriptions for the question.
476
:returns: A ResultSet of tuples (Person, QuestionSubscription)
477
representing a subscriber and their question subscription.
480
452
def getIndirectSubscribers():
481
453
"""Return the persons who are implicitly subscribed to this question.