Skip to content

Commit

Permalink
Improve activity text when creating repository #284
Browse files Browse the repository at this point in the history
  • Loading branch information
lowlighter committed May 5, 2021
1 parent 0331adc commit 348827c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions source/plugins/activity/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@ export default async function({login, data, rest, q, account, imports}, {enabled
case "ReleaseEvent": {
if (!["published"].includes(payload.action))
return null
const {action, release:{name, prerelease, draft, body:content}} = payload
return {type:"release", actor, timestamp, repo, action, name, prerelease, draft, content:await imports.markdown(content, {mode:markdown, codelines})}
const {action, release:{name, tag_name, prerelease, draft, body:content}} = payload
return {type:"release", actor, timestamp, repo, action, name:name || tag_name, prerelease, draft, content:await imports.markdown(content, {mode:markdown, codelines})}
}
//Starred a repository
case "WatchEvent": {
Expand Down
6 changes: 4 additions & 2 deletions source/templates/classic/partials/activity.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,16 @@
<section class="activity">
<% if (/^ref/.test(type)) { %>
<div class="field">
<% if (event.ref.type === "branch") { %>
<% if (event.ref.type === "repository") { %>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M2 2.5A2.5 2.5 0 014.5 0h8.75a.75.75 0 01.75.75v12.5a.75.75 0 01-.75.75h-2.5a.75.75 0 110-1.5h1.75v-2h-8a1 1 0 00-.714 1.7.75.75 0 01-1.072 1.05A2.495 2.495 0 012 11.5v-9zm10.5-1V9h-8c-.356 0-.694.074-1 .208V2.5a1 1 0 011-1h8zM5 12.25v3.25a.25.25 0 00.4.2l1.45-1.087a.25.25 0 01.3 0L8.6 15.7a.25.25 0 00.4-.2v-3.25a.25.25 0 00-.25-.25h-3.5a.25.25 0 00-.25.25z"></path></svg>
<% } else if (event.ref.type === "branch") { %>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M11.75 2.5a.75.75 0 100 1.5.75.75 0 000-1.5zm-2.25.75a2.25 2.25 0 113 2.122V6A2.5 2.5 0 0110 8.5H6a1 1 0 00-1 1v1.128a2.251 2.251 0 11-1.5 0V5.372a2.25 2.25 0 111.5 0v1.836A2.492 2.492 0 016 7h4a1 1 0 001-1v-.628A2.25 2.25 0 019.5 3.25zM4.25 12a.75.75 0 100 1.5.75.75 0 000-1.5zM3.5 3.25a.75.75 0 111.5 0 .75.75 0 01-1.5 0z"></path></svg>
<% } else { %>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M2.5 7.775V2.75a.25.25 0 01.25-.25h5.025a.25.25 0 01.177.073l6.25 6.25a.25.25 0 010 .354l-5.025 5.025a.25.25 0 01-.354 0l-6.25-6.25a.25.25 0 01-.073-.177zm-1.5 0V2.75C1 1.784 1.784 1 2.75 1h5.025c.464 0 .91.184 1.238.513l6.25 6.25a1.75 1.75 0 010 2.474l-5.026 5.026a1.75 1.75 0 01-2.474 0l-6.25-6.25A1.75 1.75 0 011 7.775zM6 5a1 1 0 100 2 1 1 0 000-2z"></path></svg>
<% } %>
<div class="content">
<%- /create/.test(type) ? `${_("C")}reated new` : `${_("D")}eleted` %>
<%= event.ref.type %> <span class="code"><%= event.ref.name %></span> in <span class="repo"><%= repo %></span>
<%= event.ref.type %> <% if (event.ref.type !== "repository") { %> <span class="code"><%= event.ref.name %></span> in <% } %> <span class="repo"><%= repo %></span>
</div>
</div>
<% } %>
Expand Down

0 comments on commit 348827c

Please sign in to comment.