Fix updating tickets when opened from my-tickets view

This commit is contained in:
Timothy Hobbs 2023-12-03 10:49:59 +00:00
parent 27f295098c
commit 83994d07d7
2 changed files with 3 additions and 2 deletions

View File

@ -83,12 +83,13 @@ class PublicTicketListingSerializer(serializers.ModelSerializer):
status = serializers.SerializerMethodField() status = serializers.SerializerMethodField()
queue = serializers.SerializerMethodField() queue = serializers.SerializerMethodField()
kbitem = serializers.SerializerMethodField() kbitem = serializers.SerializerMethodField()
secret_key = serializers.CharField(read_only=True)
class Meta: class Meta:
model = Ticket model = Ticket
# fields = '__all__' # fields = '__all__'
fields = ('ticket', 'id', 'title', 'queue', 'status', fields = ('ticket', 'id', 'title', 'queue', 'status',
'created', 'due_date', 'submitter', 'kbitem') 'created', 'due_date', 'submitter', 'kbitem', 'secret_key')
def get_queue(self, obj): def get_queue(self, obj):
return {"title": obj.queue.title, "id": obj.queue.id} return {"title": obj.queue.title, "id": obj.queue.id}

View File

@ -37,7 +37,7 @@ window.addEventListener('load', function()
data.results.forEach(function(ticket) { data.results.forEach(function(ticket) {
$('#ticketsTable tbody').append(` $('#ticketsTable tbody').append(`
<tr> <tr>
<td><a href="/view/?ticket=${ticket.id}&email=${ticket.submitter}">${ticket.title}</a></td> <td><a href="/view/?ticket=${ticket.id}&email=${ticket.submitter}&key=${ticket.secret_key}">${ticket.title}</a></td>
<td>${ticket.queue.title}</td> <td>${ticket.queue.title}</td>
<td>${ticket.status}</td> <td>${ticket.status}</td>
<td>${ticket.created}</td> <td>${ticket.created}</td>