Beispiel #1
0
 def request_for_review(self, plot):
     """Makes a request for joining a plot"""
     if not self.rhs:
         return self.display_open_tickets_for_plot(plot)
     beat = None
     if len(self.lhslist) > 1:
         beat = self.get_beat(self.lhslist[1])
     title = "RFR: %s" % plot
     create_ticket(self.caller.player_ob, self.rhs, queue_slug="PRP", optional_title=title, plot=plot, beat=beat)
     self.msg("You have submitted a new ticket for %s." % plot)
Beispiel #2
0
    def test_cmd_gm_goals(self, mock_now):
        from server.utils.helpdesk_api import create_ticket

        self.setup_cmd(goal_commands.CmdGMGoals, self.caller)
        mock_now.return_value = self.fake_datetime
        goal = Goal.objects.create(entry=self.roster_entry2,
                                   summary="test goal")
        update = goal.updates.create(player_summary="test summary")
        ticket = create_ticket(
            self.account2,
            message="hepl i do thing",
            queue_slug="Goals",
            goal_update=update,
        )
        self.call_cmd(
            "",
            "| ID | Player       | Goal      "
            "~~~~+~~~~~~~~~~~~~~+~~~~~~~~~~~+\n"
            "| 1  | Testaccount2 | test goal",
        )
        self.call_cmd("2", "No ticket found by that ID.")
        self.call_cmd(
            "1",
            "[Ticket #1] hepl i do thing\nQueue:  - Priority 3\nPlayer: TestAccount2\n"
            "Location: Room (#1)\nSubmitted: 08/27/78 12:08:00 - Last Update: 08/27/78 12:08:00\n"
            "Request: hepl i do thing\nUpdate for goal: Char2's Goal (#1): test goal (#1)\n"
            "Player Summary: test summary\nGM Resolution: None",
        )
        self.call_cmd(
            "/close 1=ok stuff happen",
            "You have closed the ticket and set the result to: ok stuff happen",
        )
        self.assertEqual(ticket.resolution, "Result: ok stuff happen")
        self.assertEqual(update.result, "ok stuff happen")
 def create_lore_question(self):
     """Submits a ticket as a new theme question"""
     try:
         category, title = self.lhs.split("/")
         category = KBCategory.objects.get(title__iexact=category)
     except ValueError:
         raise self.error_class(
             "You must specify both a category and a "
             "title for the entry created by your question.")
     except KBCategory.DoesNotExist:
         raise self.error_class("No category by that title.")
     if KBItem.objects.filter(title__iexact=title).exists():
         raise self.error_class(
             "There is already an entry with that title.")
     if Ticket.objects.filter(title__iexact=title).exists():
         raise self.error_class(
             "An entry is already proposed with that title.")
     if not self.rhs:
         raise self.error_class(
             "You must enter a question about lore or theme for staff to answer."
         )
     ticket = helpdesk_api.create_ticket(self.caller,
                                         self.rhs,
                                         kb_category=category,
                                         queue_slug="Theme",
                                         optional_title=title)
     self.msg("You have created ticket %s, asking: %s" %
              (ticket.id, self.rhs))
Beispiel #4
0
def create_plot_pitch(desc, gm_notes, name, parent_plot, summary, player_ob):
    """
    Creates a plot pitch with the given arguments
    Args:
        desc: Text description of the plot
        gm_notes: gm notes for the pitch
        name: name of the plot
        parent_plot: parent plot, if any
        summary: headline of the plot
        player_ob: owner/submitting player for the plot

    Returns:
        The pitch, which is a Ticket object
    """
    plot = Plot.objects.create(name=name,
                               headline=summary,
                               desc=desc,
                               parent_plot=parent_plot,
                               usage=Plot.PITCH,
                               public=False)

    plot.dompc_involvement.create(dompc=player_ob.Dominion,
                                  admin_status=PCPlotInvolvement.SUBMITTER)
    title = "Pitch: %s" % plot
    if parent_plot:
        title += " (%s)" % parent_plot
    ticket = create_ticket(player_ob,
                           gm_notes,
                           queue_slug="PRP",
                           optional_title=title,
                           plot=plot)
    return ticket
Beispiel #5
0
    def create_ticket(self, title, message):
        caller = self.caller
        priority = 3
        slug = settings.REQUEST_QUEUE_SLUG

        optional_title = title if message else (title[:27] + "...")
        args = message if message else self.args
        email = caller.email if caller.email != "*****@*****.**" else None

        cmdstr = self.cmdstring.lower()
        if cmdstr == "+911":
            priority = 1
        elif cmdstr == "bug":
            slug = settings.BUG_QUEUE_SLUG
        elif cmdstr == "typo":
            priority = 5
            slug = "Typo"
        elif "featurerequest" in cmdstr:
            if settings.ISSUES_URL:
                url = "https://" + settings.ISSUES_URL
                self.msg(f"Please open an issue at: {url}")
                return
            priority = 4
            slug = "Code"
        elif "prprequest" in cmdstr:
            slug = "PRP"

        return helpdesk_api.create_ticket(
            caller,
            args,
            priority,
            queue_slug=slug,
            send_email=email,
            optional_title=optional_title,
        )
Beispiel #6
0
    def request_review(self, goal):
        """Submits a ticket asking for a review of progress toward their goal"""
        from datetime import datetime, timedelta

        past_thirty_days = datetime.now() - timedelta(days=30)
        recent = GoalUpdate.objects.filter(
            goal__in=self.goals.all(),
            db_date_created__gt=past_thirty_days).first()
        beat = None
        if recent:
            raise CommandError(
                "You submitted a request for review for goal %s too recently."
                % recent.goal.id)
        try:
            summary, ooc_message = self.rhs.split("/")
        except (AttributeError, ValueError):
            raise CommandError(
                "You must provide both a short story summary of what your character did or attempted to "
                "do in order to make progress toward their goal, and an OOC message to staff, telling "
                "them of your intent for results you would like and anything else that seems "
                "relevant.")
        if len(self.lhslist) > 1:
            try:
                beat = PlotUpdate.objects.filter(
                    plot__in=self.caller.dompc.plots.all()).get(
                        id=self.lhslist[1])
            except (PlotUpdate.DoesNotExist, ValueError):
                raise CommandError("No beat by that ID.")
        update = goal.updates.create(beat=beat, player_summary=summary)
        ticket = create_ticket(
            self.caller.player_ob,
            self.rhs,
            plot=goal.plot,
            beat=beat,
            goal_update=update,
            queue_slug="Goals",
        )
        self.msg(
            "You have sent in a request for review for goal %s. Ticket ID is %s."
            % (goal.id, ticket.id))
Beispiel #7
0
 def func(self):
     """Implement the command"""
     caller = self.caller
     args = self.args
     priority = 5
     if "followup" in self.switches or "comment" in self.switches:
         if not self.lhs or not self.rhs:
             caller.msg("Missing arguments required.")
             ticketnumbers = ", ".join(
                 str(ticket.id) for ticket in self.tickets)
             caller.msg("Your tickets: %s" % ticketnumbers)
             return
         ticket = self.get_ticket_from_args(self.lhs)
         if not ticket:
             return
         if ticket.status == ticket.CLOSED_STATUS:
             self.msg("That ticket is already closed. Make a new one.")
             return
         helpdesk_api.add_followup(caller,
                                   ticket,
                                   self.rhs,
                                   mail_player=False)
         caller.msg("Followup added.")
         return
     cmdstr = self.cmdstring.lower()
     if cmdstr == '+911':
         priority = 1
     if not self.lhs:
         self.list_tickets()
         return
     if self.lhs.isdigit():
         ticket = self.get_ticket_from_args(self.lhs)
         if not ticket:
             return
         self.display_ticket(ticket)
         return
     optional_title = None
     if self.lhs and self.rhs:
         args = self.rhs
         optional_title = self.lhs
     email = caller.email
     if email == "*****@*****.**":
         email = None
     if cmdstr == "bug":
         optional_title = "Bug Report"
         args = self.args
         queue = settings.BUG_QUEUE_ID
     elif cmdstr == "typo":
         optional_title = "Typo found"
         queue = Queue.objects.get(slug="Typo").id
     elif cmdstr == "+featurerequest":
         optional_title = "Features"
         queue = Queue.objects.get(slug="Code").id
     elif cmdstr == "+prprequest":
         optional_title = "PRP"
         queue = Queue.objects.get(slug="PRP").id
     else:
         queue = settings.REQUEST_QUEUE_ID
     if helpdesk_api.create_ticket(caller,
                                   args,
                                   priority,
                                   queue=queue,
                                   send_email=email,
                                   optional_title=optional_title):
         caller.msg(
             "Thank you for submitting a request to the GM staff. Your ticket has been added "
             "to the queue.")
         return
     else:
         caller.msg(
             "Ticket submission has failed for unknown reason. Please inform the administrators."
         )
         return
Beispiel #8
0
 def func(self):
     """Implement the command"""
     caller = self.caller
     priority = 3
     if "followup" in self.switches or "comment" in self.switches:
         if not self.lhs or not self.rhs:
             msg = "Usage: <#>=<message>"
             ticketnumbers = ", ".join(
                 str(ticket.id) for ticket in self.tickets)
             if ticketnumbers:
                 msg += "\nYour tickets: %s" % ticketnumbers
             return caller.msg(msg)
         ticket = self.get_ticket_from_args(self.lhs)
         if not ticket:
             return
         if ticket.status == ticket.CLOSED_STATUS:
             self.msg(
                 "That ticket is already closed. Please make a new one.")
             return
         helpdesk_api.add_followup(caller,
                                   ticket,
                                   self.rhs,
                                   mail_player=False)
         caller.msg("Followup added.")
         return
     cmdstr = self.cmdstring.lower()
     if cmdstr == '+911':
         priority = 1
     if not self.lhs:
         self.list_tickets()
         return
     if self.lhs.isdigit():
         ticket = self.get_ticket_from_args(self.lhs)
         if not ticket:
             return
         self.display_ticket(ticket)
         return
     optional_title = self.lhs if self.rhs else (self.lhs[:27] + "...")
     args = self.rhs if self.rhs else self.args
     email = caller.email if caller.email != "*****@*****.**" else None
     if cmdstr == "bug":
         slug = settings.BUG_QUEUE_SLUG
     elif cmdstr == "typo":
         priority = 5
         slug = "Typo"
     elif cmdstr == "+featurerequest":
         priority = 4
         slug = "Code"
     elif cmdstr == "+prprequest":
         slug = "PRP"
     else:
         slug = settings.REQUEST_QUEUE_SLUG
     new_ticket = helpdesk_api.create_ticket(caller,
                                             args,
                                             priority,
                                             queue_slug=slug,
                                             send_email=email,
                                             optional_title=optional_title)
     if new_ticket:
         caller.msg(
             "Thank you for submitting a request to the GM staff. Your ticket (#%s) "
             "has been added to the queue." % new_ticket.id)
         return
     else:
         caller.msg(
             "Ticket submission has failed for unknown reason. Please inform the administrators."
         )
         return