Spaces:
Sleeping
Sleeping
Commit
·
cfcca52
1
Parent(s):
1e04309
demote
Browse files- app.py +5 -1
- templates/dashboard.html +10 -1
app.py
CHANGED
|
@@ -135,7 +135,10 @@ def get_discussions_feed(username, token=None):
|
|
| 135 |
discussions = fetch_space_discussions(space_id, token)
|
| 136 |
|
| 137 |
for d in discussions:
|
| 138 |
-
|
|
|
|
|
|
|
|
|
|
| 139 |
all_discussions.append({
|
| 140 |
"space_id": space_id,
|
| 141 |
"space_name": space_id.split("/")[-1] if "/" in space_id else space_id,
|
|
@@ -150,6 +153,7 @@ def get_discussions_feed(username, token=None):
|
|
| 150 |
"num_reactions": d.get("numReactionUsers", 0),
|
| 151 |
"top_reactions": d.get("topReactions", []),
|
| 152 |
"score": score,
|
|
|
|
| 153 |
"url": f"https://huggingface.co/spaces/{space_id}/discussions/{d.get('num')}",
|
| 154 |
})
|
| 155 |
|
|
|
|
| 135 |
discussions = fetch_space_discussions(space_id, token)
|
| 136 |
|
| 137 |
for d in discussions:
|
| 138 |
+
owner_responded = d.get("repoOwner", {}).get("isParticipating", False)
|
| 139 |
+
base_score = d.get("numComments", 0) + d.get("numReactionUsers", 0) * 2
|
| 140 |
+
# Demote if owner has responded
|
| 141 |
+
score = base_score - 100 if owner_responded else base_score
|
| 142 |
all_discussions.append({
|
| 143 |
"space_id": space_id,
|
| 144 |
"space_name": space_id.split("/")[-1] if "/" in space_id else space_id,
|
|
|
|
| 153 |
"num_reactions": d.get("numReactionUsers", 0),
|
| 154 |
"top_reactions": d.get("topReactions", []),
|
| 155 |
"score": score,
|
| 156 |
+
"owner_responded": owner_responded,
|
| 157 |
"url": f"https://huggingface.co/spaces/{space_id}/discussions/{d.get('num')}",
|
| 158 |
})
|
| 159 |
|
templates/dashboard.html
CHANGED
|
@@ -253,6 +253,14 @@
|
|
| 253 |
.feed-item.is-report .feed-title {
|
| 254 |
color: #ef4444;
|
| 255 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 256 |
</style>
|
| 257 |
</head>
|
| 258 |
<body>
|
|
@@ -312,13 +320,14 @@
|
|
| 312 |
{% if discussions %}
|
| 313 |
<div class="feed">
|
| 314 |
{% for d in discussions %}
|
| 315 |
-
<a href="{{ d.url }}" target="_blank" class="feed-item status-{{ d.status }}{{ ' is-report' if 'report' in d.title|lower else '' }}">
|
| 316 |
<div class="feed-meta">
|
| 317 |
<span class="feed-space">{{ d.space_name }}</span>
|
| 318 |
<span class="feed-type {{ 'pr' if d.is_pr else 'discussion' }}">
|
| 319 |
{{ 'PR' if d.is_pr else 'Discussion' }}
|
| 320 |
</span>
|
| 321 |
<span class="feed-status {{ d.status }}">{{ d.status }}</span>
|
|
|
|
| 322 |
</div>
|
| 323 |
<div class="feed-title">{{ d.title }}</div>
|
| 324 |
<div class="feed-stats">
|
|
|
|
| 253 |
.feed-item.is-report .feed-title {
|
| 254 |
color: #ef4444;
|
| 255 |
}
|
| 256 |
+
.feed-item.responded {
|
| 257 |
+
opacity: 0.5;
|
| 258 |
+
}
|
| 259 |
+
.responded-badge {
|
| 260 |
+
font-size: 0.625rem;
|
| 261 |
+
color: #555;
|
| 262 |
+
margin-left: 0.25rem;
|
| 263 |
+
}
|
| 264 |
</style>
|
| 265 |
</head>
|
| 266 |
<body>
|
|
|
|
| 320 |
{% if discussions %}
|
| 321 |
<div class="feed">
|
| 322 |
{% for d in discussions %}
|
| 323 |
+
<a href="{{ d.url }}" target="_blank" class="feed-item status-{{ d.status }}{{ ' is-report' if 'report' in d.title|lower else '' }}{{ ' responded' if d.owner_responded else '' }}">
|
| 324 |
<div class="feed-meta">
|
| 325 |
<span class="feed-space">{{ d.space_name }}</span>
|
| 326 |
<span class="feed-type {{ 'pr' if d.is_pr else 'discussion' }}">
|
| 327 |
{{ 'PR' if d.is_pr else 'Discussion' }}
|
| 328 |
</span>
|
| 329 |
<span class="feed-status {{ d.status }}">{{ d.status }}</span>
|
| 330 |
+
{% if d.owner_responded %}<span class="responded-badge">replied</span>{% endif %}
|
| 331 |
</div>
|
| 332 |
<div class="feed-title">{{ d.title }}</div>
|
| 333 |
<div class="feed-stats">
|