| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151 |
- """
- ForgeFed plugin for Pagure.
- Copyright (C) 2020-2021 zPlus <zplus@peers.community>
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with this program; if not, see <https://www.gnu.org/licenses/>.
- SPDX-FileCopyrightText: 2020-2021 zPlus <zplus@peers.community>
- SPDX-License-Identifier: GPL-2.0-only
- """
- def create_tagref(repository, ref):
- """
- Feed to show when a new Tag has been created on a Git repository.
- """
- return {
- 'type': 'create_git_tag',
- 'repository': {
- 'name': repository['name'],
- 'id': repository['id']
- },
- 'ref': {
- 'name': ref['name'],
- 'id': ref['id']
- },
- }
- def follow(follower=None, followee=None):
- """
- Feed to show when a Follow request has been sent.
- :param follower: The actor that followed
- :type follower: dict
- :param followee: The actor being followed
- :type followee: dict
- """
- return {
- 'type': 'follow',
- 'follower': {
- 'name': follower['name'],
- 'id': follower['id']
- },
- 'followee': {
- 'name': followee['name'],
- 'id': followee['id']
- },
- }
- def accept_follow(follower=None, followee=None):
- """
- Feed to show when a Follow request has been accepted.
- :param follower: The actor that sent the Follow Activity
- :type follower: dict
- :param followee: The actor that Accepted the Follow Activity
- :type followee: dict
- """
- return {
- 'type': 'accept_follow',
- 'follower': {
- 'name': follower['name'],
- 'id': follower['id']
- },
- 'followee': {
- 'name': followee['name'],
- 'id': followee['id']
- },
- }
- def accept_ticket(tickettracker, ticket):
- """
- :param tickettracker: The TicketTracker that accepted the Ticket
- :type follower: dict
- :param followee: The Ticket
- :type followee: dict
- """
- return {
- 'type': 'accept_ticket',
- 'tickettracker': {
- 'name': tickettracker['name'],
- 'id': tickettracker['id']
- },
- 'ticket': {
- 'summary': ticket['summary'],
- 'id': ticket['id']
- },
- }
- def delete_ticket(actor, ticket):
- """
- :param tickettracker: The TicketTracker that accepted the Ticket
- :type follower: dict
- :param followee: The Ticket
- :type followee: dict
- """
- return {
- 'type': 'delete_ticket',
- 'actor': {
- 'name': actor.username,
- 'id': actor.uri
- },
- 'ticket': {
- 'id': ticket['id']
- },
- }
- def accept_mergerequest(mergerequest):
- """
- :param mergerequest: The mergerequest that was accepted
- :type follower: dict
- """
- return {
- 'type': 'accept_mergerequest',
- 'mergerequest': {
- 'summary': mergerequest['summary'],
- 'id': mergerequest['id']
- },
- }
|