Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Issue #507] Allow non delegate users to declare interest in a patch #588

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions docs/api/schemas/latest/patchwork.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2312,6 +2312,11 @@ components:
type: array
items:
$ref: '#/components/schemas/PatchEmbedded'
attention_set:
title: AttentionSet
type: array
items:
$ref: '#/components/schemas/PatchAttentionSet'
PatchDetail:
type: object
title: Patches
Expand Down Expand Up @@ -2390,6 +2395,11 @@ components:
type: array
items:
type: integer
attention_set:
title: Attention Set
type: array
items:
type: integer
Person:
type: object
title: Person
Expand Down Expand Up @@ -2831,6 +2841,19 @@ components:
type: string
format: uri
readOnly: true
PatchAttentionSet:
type: object
title: PatchAttentionSet
description: |
A user interested or with pending actions over a patch
properties:
user:
$ref: '#/components/schemas/UserEmbedded'
last_updated:
title: last_updated
type: string
format: iso8601
readOnly: true
PatchEmbedded:
type: object
title: Patch
Expand Down
29 changes: 29 additions & 0 deletions docs/api/schemas/patchwork.j2
Original file line number Diff line number Diff line change
Expand Up @@ -2397,6 +2397,13 @@ components:
type: array
items:
$ref: '#/components/schemas/PatchEmbedded'
{% endif %}
{% if version >= (1, 4) %}
attention_set:
title: AttentionSet
type: array
items:
$ref: '#/components/schemas/PatchAttentionSet'
{% endif %}
PatchDetail:
type: object
Expand Down Expand Up @@ -2477,6 +2484,13 @@ components:
type: array
items:
type: integer
{% endif %}
{% if version >= (1, 4) %}
attention_set:
title: Attention Set
type: array
items:
type: integer
{% endif %}
Person:
type: object
Expand Down Expand Up @@ -2941,6 +2955,21 @@ components:
type: string
format: uri
readOnly: true
{% if version >= (1, 4) %}
PatchAttentionSet:
type: object
title: PatchAttentionSet
description: |
A user interested or with pending actions over a patch
properties:
user:
$ref: '#/components/schemas/UserEmbedded'
last_updated:
title: last_updated
type: string
format: iso8601
readOnly: true
{% endif %}
PatchEmbedded:
type: object
title: Patch
Expand Down
23 changes: 23 additions & 0 deletions docs/api/schemas/v1.4/patchwork.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2312,6 +2312,11 @@ components:
type: array
items:
$ref: '#/components/schemas/PatchEmbedded'
attention_set:
title: AttentionSet
type: array
items:
$ref: '#/components/schemas/PatchAttentionSet'
PatchDetail:
type: object
title: Patches
Expand Down Expand Up @@ -2390,6 +2395,11 @@ components:
type: array
items:
type: integer
attention_set:
title: Attention Set
type: array
items:
type: integer
Person:
type: object
title: Person
Expand Down Expand Up @@ -2831,6 +2841,19 @@ components:
type: string
format: uri
readOnly: true
PatchAttentionSet:
type: object
title: PatchAttentionSet
description: |
A user interested or with pending actions over a patch
properties:
user:
$ref: '#/components/schemas/UserEmbedded'
last_updated:
title: last_updated
type: string
format: iso8601
readOnly: true
PatchEmbedded:
type: object
title: Patch
Expand Down
24 changes: 24 additions & 0 deletions htdocs/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,18 @@ table.patch-meta tr th, table.patch-meta tr td {
text-decoration: underline;
}

.patchinterest {
display: inline-block;
border-radius: 7px;
min-width: 0.9em;
padding: 0 2px;
text-align: center;
}

.patchinterest.exists {
background-color: #82ca9d;
}

.patchlistchecks {
display: inline-block;
border-radius: 7px;
Expand Down Expand Up @@ -344,6 +356,18 @@ table.patch-meta tr th, table.patch-meta tr td {
font-family: "DejaVu Sans Mono", fixed;
}

.submission-attention-set {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 8px;
}

button[class*=interest-action] {
padding: 0.2em 0.5em;
border-radius: 4px;
}

div[class^="comment-status-bar-"] {
display: flex;
flex-wrap: wrap;
Expand Down
13 changes: 13 additions & 0 deletions patchwork/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
from patchwork.models import State
from patchwork.models import Tag
from patchwork.models import UserProfile
from patchwork.models import PatchAttentionSet


class UserProfileInline(admin.StackedInline):
Expand Down Expand Up @@ -86,6 +87,17 @@ class CoverAdmin(admin.ModelAdmin):
admin.site.register(Cover, CoverAdmin)


class PatchAttentionSetInline(admin.StackedInline):
model = PatchAttentionSet
fields = ('user',)
extra = 0
verbose_name = 'user'
verbose_name_plural = 'attention set users'

def has_change_permission(self, request, obj=None):
return False


class PatchAdmin(admin.ModelAdmin):
list_display = (
'name',
Expand All @@ -99,6 +111,7 @@ class PatchAdmin(admin.ModelAdmin):
list_filter = ('project', 'submitter', 'state', 'archived')
list_select_related = ('submitter', 'project', 'state')
search_fields = ('name', 'submitter__name', 'submitter__email')
inlines = (PatchAttentionSetInline,)
date_hierarchy = 'date'

def is_pull_request(self, patch):
Expand Down
Loading