Add support for repository template, plugin_activity_visibility and plugin_activity_timestamps (#119)

This commit is contained in:
Simon Lecoq
2021-02-10 09:48:31 +01:00
committed by GitHub
parent d784073d61
commit 2cef0d7551
9 changed files with 278 additions and 42 deletions

View File

@@ -30,6 +30,7 @@
}, },
}, },
created_at:faker.date.recent(7), created_at:faker.date.recent(7),
public:true,
}, },
{ {
id:"10000000001", id:"10000000001",
@@ -58,6 +59,7 @@
}, },
}, },
created_at:faker.date.recent(7), created_at:faker.date.recent(7),
public:true,
}, },
{ {
id:"10000000002", id:"10000000002",
@@ -81,6 +83,7 @@
}, },
}, },
created_at:faker.date.recent(7), created_at:faker.date.recent(7),
public:true,
}, },
{ {
id:"10000000003", id:"10000000003",
@@ -103,6 +106,7 @@
], ],
}, },
created_at:faker.date.recent(7), created_at:faker.date.recent(7),
public:true,
}, },
{ {
id:"10000000004", id:"10000000004",
@@ -135,6 +139,7 @@
}, },
}, },
created_at:faker.date.recent(7), created_at:faker.date.recent(7),
public:true,
}, },
{ {
id:"10000000005", id:"10000000005",
@@ -152,6 +157,7 @@
}, },
}, },
created_at:faker.date.recent(7), created_at:faker.date.recent(7),
public:true,
}, },
{ {
id:"10000000006", id:"10000000006",
@@ -181,6 +187,7 @@
}, },
}, },
created_at:faker.date.recent(7), created_at:faker.date.recent(7),
public:true,
}, },
{ {
id:"10000000007", id:"10000000007",
@@ -201,6 +208,7 @@
}, },
}, },
created_at:faker.date.recent(7), created_at:faker.date.recent(7),
public:true,
}, },
{ {
id:"10000000008", id:"10000000008",
@@ -217,6 +225,7 @@
master_branch:"master", master_branch:"master",
}, },
created_at:faker.date.recent(7), created_at:faker.date.recent(7),
public:true,
}, },
{ {
id:"100000000009", id:"100000000009",
@@ -229,6 +238,7 @@
}, },
payload:{action:"started"}, payload:{action:"started"},
created_at:faker.date.recent(7), created_at:faker.date.recent(7),
public:true,
}, },
{ {
id:"10000000010", id:"10000000010",
@@ -244,6 +254,7 @@
ref_type:faker.random.arrayElement(["tag", "branch"]), ref_type:faker.random.arrayElement(["tag", "branch"]),
}, },
created_at:faker.date.recent(7), created_at:faker.date.recent(7),
public:true,
}, },
{ {
id:"10000000011", id:"10000000011",
@@ -266,6 +277,7 @@
], ],
}, },
created_at:faker.date.recent(7), created_at:faker.date.recent(7),
public:true,
}, },
{ {
id:"10000000012", id:"10000000012",
@@ -291,6 +303,7 @@
}, },
}, },
created_at:faker.date.recent(7), created_at:faker.date.recent(7),
public:true,
}, },
{ {
id:"10000000013", id:"10000000013",
@@ -308,6 +321,7 @@
action:"added", action:"added",
}, },
created_at:faker.date.recent(7), created_at:faker.date.recent(7),
public:true,
}, },
{ {
id:"10000000014", id:"10000000014",
@@ -320,6 +334,7 @@
}, },
payload:{}, payload:{},
created_at:faker.date.recent(7), created_at:faker.date.recent(7),
public:true,
}, },
], ],
}) })

View File

@@ -0,0 +1,8 @@
//
import listEventsForAuthenticatedUser from "./listEventsForAuthenticatedUser.mjs"
/**Mocked data */
export default function({faker}, target, that, [{username:login, page, per_page}]) {
console.debug("metrics/compute/mocks > mocking rest api result > rest.activity.listRepoEvents")
return listEventsForAuthenticatedUser(...arguments)
}

View File

@@ -511,13 +511,15 @@
//Activity //Activity
...(set.plugins.enabled.activity ? ({ ...(set.plugins.enabled.activity ? ({
activity:{ activity:{
timestamps:options["activity.timestamps"],
events:new Array(Number(options["activity.limit"])).fill(null).map(_ => [ events:new Array(Number(options["activity.limit"])).fill(null).map(_ => [
{ {
type:"push", type:"push",
repo:`${faker.random.word()}/${faker.random.word()}`, repo:`${faker.random.word()}/${faker.random.word()}`,
size:1, size:1,
branch:"master", branch:"master",
commits: [ { sha:faker.git.shortSha(), message:faker.lorem.sentence()} ] commits: [ { sha:faker.git.shortSha(), message:faker.lorem.sentence()} ],
timestamp:faker.date.recent(),
}, },
{ {
type:"comment", type:"comment",
@@ -528,6 +530,7 @@
mobile:null, mobile:null,
number:faker.git.shortSha(), number:faker.git.shortSha(),
title:"", title:"",
timestamp:faker.date.recent(),
}, },
{ {
type:"comment", type:"comment",
@@ -538,6 +541,7 @@
mobile:null, mobile:null,
number:faker.random.number(100), number:faker.random.number(100),
title:faker.lorem.sentence(), title:faker.lorem.sentence(),
timestamp:faker.date.recent(),
}, },
{ {
type:"comment", type:"comment",
@@ -548,6 +552,7 @@
mobile:null, mobile:null,
number:faker.random.number(100), number:faker.random.number(100),
title:faker.lorem.sentence(), title:faker.lorem.sentence(),
timestamp:faker.date.recent(),
}, },
{ {
type:"issue", type:"issue",
@@ -556,6 +561,7 @@
user:set.user, user:set.user,
number:faker.random.number(100), number:faker.random.number(100),
title:faker.lorem.sentence(), title:faker.lorem.sentence(),
timestamp:faker.date.recent(),
}, },
{ {
type:"pr", type:"pr",
@@ -564,16 +570,19 @@
user:set.user, user:set.user,
number:faker.random.number(100), number:faker.random.number(100),
title:faker.lorem.sentence(), title:faker.lorem.sentence(),
lines:{added:faker.random.number(1000), deleted:faker.random.number(1000)}, files:{changed:faker.random.number(10)} lines:{added:faker.random.number(1000), deleted:faker.random.number(1000)}, files:{changed:faker.random.number(10)},
timestamp:faker.date.recent(),
}, },
{ {
type:"wiki", type:"wiki",
repo:`${faker.random.word()}/${faker.random.word()}`, repo:`${faker.random.word()}/${faker.random.word()}`,
pages:[faker.lorem.sentence(), faker.lorem.sentence()] pages:[faker.lorem.sentence(), faker.lorem.sentence()],
timestamp:faker.date.recent(),
}, },
{ {
type:"fork", type:"fork",
repo:`${faker.random.word()}/${faker.random.word()}`, repo:`${faker.random.word()}/${faker.random.word()}`,
timestamp:faker.date.recent(),
}, },
{ {
type:"review", type:"review",
@@ -581,6 +590,7 @@
user:set.user, user:set.user,
number:faker.random.number(100), number:faker.random.number(100),
title:faker.lorem.sentence(), title:faker.lorem.sentence(),
timestamp:faker.date.recent(),
}, },
{ {
type:"release", type:"release",
@@ -589,30 +599,36 @@
name:faker.random.words(4), name:faker.random.words(4),
draft:faker.random.boolean(), draft:faker.random.boolean(),
prerelease:faker.random.boolean(), prerelease:faker.random.boolean(),
timestamp:faker.date.recent(),
}, },
{ {
type:"ref/create", type:"ref/create",
repo:`${faker.random.word()}/${faker.random.word()}`, repo:`${faker.random.word()}/${faker.random.word()}`,
ref:{name:faker.lorem.slug(), type:faker.random.arrayElement(["tag", "branch"]),} ref:{name:faker.lorem.slug(), type:faker.random.arrayElement(["tag", "branch"])},
timestamp:faker.date.recent(),
}, },
{ {
type:"ref/delete", type:"ref/delete",
repo:`${faker.random.word()}/${faker.random.word()}`, repo:`${faker.random.word()}/${faker.random.word()}`,
ref:{name:faker.lorem.slug(), type:faker.random.arrayElement(["tag", "branch"]),} ref:{name:faker.lorem.slug(), type:faker.random.arrayElement(["tag", "branch"])},
timestamp:faker.date.recent(),
}, },
{ {
type:"member", type:"member",
repo:`${faker.random.word()}/${faker.random.word()}`, repo:`${faker.random.word()}/${faker.random.word()}`,
user:set.user user:set.user,
timestamp:faker.date.recent(),
}, },
{ {
type:"public", type:"public",
repo:`${faker.random.word()}/${faker.random.word()}`, repo:`${faker.random.word()}/${faker.random.word()}`,
timestamp:faker.date.recent(),
}, },
{ {
type:"star", type:"star",
repo:`${faker.random.word()}/${faker.random.word()}`, repo:`${faker.random.word()}/${faker.random.word()}`,
action:"started" action:"started",
timestamp:faker.date.recent(),
}, },
][Math.floor(Math.random()*15)]) ][Math.floor(Math.random()*15)])
} }
@@ -647,6 +663,9 @@
return text return text
return `${text.substring(0, length)}` return `${text.substring(0, length)}`
} }
data.f.date = function (string, options) {
return new Intl.DateTimeFormat("en-GB", options).format(new Date(string))
}
//Render //Render
return await ejs.render(image, data, {async:true, rmWhitespace:true}) return await ejs.render(image, data, {async:true, rmWhitespace:true})
} }

View File

@@ -6,111 +6,121 @@
if ((!enabled)||(!q.activity)) if ((!enabled)||(!q.activity))
return null return null
//Context
let context = {mode:"user"}
if (q.repo) {
console.debug(`metrics/compute/${login}/plugins > activity > switched to repository mode`)
const {owner, repo} = data.user.repositories.nodes.map(({name:repo, owner:{login:owner}}) => ({repo, owner})).shift()
context = {...context, mode:"repository", owner, repo}
}
//Load inputs //Load inputs
let {limit, days, filter} = imports.metadata.plugins.activity.inputs({data, q, account}) let {limit, days, filter, visibility, timestamps} = imports.metadata.plugins.activity.inputs({data, q, account})
if (!days) if (!days)
days = Infinity days = Infinity
//Get user recent activity //Get user recent activity
console.debug(`metrics/compute/${login}/plugins > activity > querying api`) console.debug(`metrics/compute/${login}/plugins > activity > querying api`)
const {data:events} = await rest.activity.listEventsForAuthenticatedUser({username:login, per_page:100}) const {data:events} = context.mode === "repository" ? await rest.activity.listRepoEvents({owner:context.owner, repo:context.repo}) : await rest.activity.listEventsForAuthenticatedUser({username:login, per_page:100})
console.debug(`metrics/compute/${login}/plugins > activity > ${events.length} events loaded`) console.debug(`metrics/compute/${login}/plugins > activity > ${events.length} events loaded`)
//Extract activity events //Extract activity events
const activity = events const activity = events
.filter(({actor}) => account === "organization" ? true : actor.login === login) .filter(({actor}) => account === "organization" ? true : actor.login === login)
.filter(({created_at}) => Number.isFinite(days) ? new Date(created_at) > new Date(Date.now()-days*24*60*60*1000) : true) .filter(({created_at}) => Number.isFinite(days) ? new Date(created_at) > new Date(Date.now()-days*24*60*60*1000) : true)
.map(({type, payload, repo:{name:repo}}) => { .filter(event => visibility === "public" ? event.public : true)
.map(({type, payload, actor:{login:actor}, repo:{name:repo}, created_at}) => {
//See https://docs.github.com/en/free-pro-team@latest/developers/webhooks-and-events/github-event-types //See https://docs.github.com/en/free-pro-team@latest/developers/webhooks-and-events/github-event-types
const timestamp = new Date(created_at)
switch (type) { switch (type) {
//Commented on a commit //Commented on a commit
case "CommitCommentEvent":{ case "CommitCommentEvent":{
if (!["created"].includes(payload.action)) if (!["created"].includes(payload.action))
return null return null
const {comment:{user:{login:user}, commit_id:sha, body:content}} = payload const {comment:{user:{login:user}, commit_id:sha, body:content}} = payload
return {type:"comment", on:"commit", repo, content, user, mobile:null, number:sha.substring(0, 7), title:""} return {type:"comment", on:"commit", actor, timestamp, repo, content, user, mobile:null, number:sha.substring(0, 7), title:""}
} }
//Created a git branch or tag //Created a git branch or tag
case "CreateEvent":{ case "CreateEvent":{
const {ref:name, ref_type:type} = payload const {ref:name, ref_type:type} = payload
return {type:"ref/create", repo, ref:{name, type}} return {type:"ref/create", actor, timestamp, repo, ref:{name, type}}
} }
//Deleted a git branch or tag //Deleted a git branch or tag
case "DeleteEvent":{ case "DeleteEvent":{
const {ref:name, ref_type:type} = payload const {ref:name, ref_type:type} = payload
return {type:"ref/delete", repo, ref:{name, type}} return {type:"ref/delete", actor, timestamp, repo, ref:{name, type}}
} }
//Forked repository //Forked repository
case "ForkEvent":{ case "ForkEvent":{
return {type:"fork", repo} return {type:"fork", actor, timestamp, repo}
} }
//Wiki editions //Wiki editions
case "GollumEvent":{ case "GollumEvent":{
const {pages} = payload const {pages} = payload
return {type:"wiki", repo, pages:pages.map(({title}) => title)} return {type:"wiki", actor, timestamp, repo, pages:pages.map(({title}) => title)}
} }
//Commented on an issue //Commented on an issue
case "IssueCommentEvent":{ case "IssueCommentEvent":{
if (!["created"].includes(payload.action)) if (!["created"].includes(payload.action))
return null return null
const {issue:{user:{login:user}, title, number}, comment:{body:content, performed_via_github_app:mobile}} = payload const {issue:{user:{login:user}, title, number}, comment:{body:content, performed_via_github_app:mobile}} = payload
return {type:"comment", on:"issue", repo, content, user, mobile, number, title} return {type:"comment", on:"issue", actor, timestamp, repo, content, user, mobile, number, title}
} }
//Issue event //Issue event
case "IssuesEvent":{ case "IssuesEvent":{
if (!["opened", "closed", "reopened"].includes(payload.action)) if (!["opened", "closed", "reopened"].includes(payload.action))
return null return null
const {action, issue:{user:{login:user}, title, number}} = payload const {action, issue:{user:{login:user}, title, number}} = payload
return {type:"issue", repo, action, user, number, title} return {type:"issue", actor, timestamp, repo, action, user, number, title}
} }
//Activity from repository collaborators //Activity from repository collaborators
case "MemberEvent":{ case "MemberEvent":{
if (!["added"].includes(payload.action)) if (!["added"].includes(payload.action))
return null return null
const {member:{login:user}} = payload const {member:{login:user}} = payload
return {type:"member", repo, user} return {type:"member", actor, timestamp, repo, user}
} }
//Made repository public //Made repository public
case "PublicEvent":{ case "PublicEvent":{
return {type:"public", repo} return {type:"public", actor, timestamp, repo}
} }
//Pull requests events //Pull requests events
case "PullRequestEvent":{ case "PullRequestEvent":{
if (!["opened", "closed"].includes(payload.action)) if (!["opened", "closed"].includes(payload.action))
return null return null
const {action, pull_request:{user:{login:user}, title, number, additions:added, deletions:deleted, changed_files:changed}} = payload const {action, pull_request:{user:{login:user}, title, number, additions:added, deletions:deleted, changed_files:changed}} = payload
return {type:"pr", repo, action, user, title, number, lines:{added, deleted}, files:{changed}} return {type:"pr", actor, timestamp, repo, action, user, title, number, lines:{added, deleted}, files:{changed}}
} }
//Reviewed a pull request //Reviewed a pull request
case "PullRequestReviewEvent":{ case "PullRequestReviewEvent":{
const {review:{state:review}, pull_request:{user:{login:user}, number, title}} = payload const {review:{state:review}, pull_request:{user:{login:user}, number, title}} = payload
return {type:"review", repo, review, user, number, title} return {type:"review", actor, timestamp, repo, review, user, number, title}
} }
//Commented on a pull request //Commented on a pull request
case "PullRequestReviewCommentEvent":{ case "PullRequestReviewCommentEvent":{
if (!["created"].includes(payload.action)) if (!["created"].includes(payload.action))
return null return null
const {pull_request:{user:{login:user}, title, number}, comment:{body:content, performed_via_github_app:mobile}} = payload const {pull_request:{user:{login:user}, title, number}, comment:{body:content, performed_via_github_app:mobile}} = payload
return {type:"comment", on:"pr", repo, content, user, mobile, number, title} return {type:"comment", on:"pr", actor, timestamp, repo, content, user, mobile, number, title}
} }
//Pushed commits //Pushed commits
case "PushEvent":{ case "PushEvent":{
const {size, commits, ref} = payload const {size, commits, ref} = payload
return {type:"push", repo, size, branch:ref.match(/refs.heads.(?<branch>.*)/)?.groups?.branch ?? null, commits:commits.map(({sha, message}) => ({sha:sha.substring(0, 7), message}))} return {type:"push", actor, timestamp, repo, size, branch:ref.match(/refs.heads.(?<branch>.*)/)?.groups?.branch ?? null, commits:commits.map(({sha, message}) => ({sha:sha.substring(0, 7), message}))}
} }
//Released //Released
case "ReleaseEvent":{ case "ReleaseEvent":{
if (!["published"].includes(payload.action)) if (!["published"].includes(payload.action))
return null return null
const {action, release:{name, prerelease, draft}} = payload const {action, release:{name, prerelease, draft}} = payload
return {type:"release", repo, action, name, prerelease, draft} return {type:"release", actor, timestamp, repo, action, name, prerelease, draft}
} }
//Starred a repository //Starred a repository
case "WatchEvent":{ case "WatchEvent":{
if (!["started"].includes(payload.action)) if (!["started"].includes(payload.action))
return null return null
const {action} = payload const {action} = payload
return {type:"star", repo, action} return {type:"star", actor, timestamp, repo, action}
} }
//Unknown event //Unknown event
default:{ default:{
@@ -123,7 +133,7 @@
.slice(0, limit) .slice(0, limit)
//Results //Results
return {events:activity} return {timestamps, events:activity}
} }
//Handle errors //Handle errors
catch (error) { catch (error) {

View File

@@ -4,6 +4,7 @@ categorie: github
supports: supports:
- user - user
- organization - organization
- repository
inputs: inputs:
# Enable or disable plugin # Enable or disable plugin
@@ -51,3 +52,18 @@ inputs:
- star # Display starred repositories - star # Display starred repositories
- member # Display collaborators additions - member # Display collaborators additions
- public # Display repositories made public - public # Display repositories made public
# Set events visibility (use this to restrict events when using a "repo" token)
plugin_activity_visibility:
description: Set events visibility
type: string
default: all
values:
- public
- all
# Display events timestamps
plugin_activity_timestamps:
description: Display events timestamps
type: boolean
default: no

View File

@@ -18,7 +18,7 @@
No recent activity No recent activity
</div> </div>
<% } %> <% } %>
<% for (const {type, repo, ...event} of plugins.activity.events) { %> <% for (const {actor, type, repo, timestamp, ...event} of plugins.activity.events) { const _ = letter => account === "organization" ? `<div class="user">${actor}</div> ${letter.toLocaleLowerCase()}` : letter %>
<div class="row fill-width"> <div class="row fill-width">
<section class="activity"> <section class="activity">
<% if (/^ref/.test(type)) { %> <% if (/^ref/.test(type)) { %>
@@ -28,7 +28,7 @@
<% } else { %> <% } 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> <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>
<% } %> <% } %>
<%= /create/.test(type) ? "Created new" : "Deleted" %> <%- /create/.test(type) ? `${_("C")}reated new` : `${_("D")}eleted` %>
<%= event.ref.type %> <div class="code"><%= event.ref.name %></div> in <div class="repo"><%= repo %></div> <%= event.ref.type %> <div class="code"><%= event.ref.name %></div> in <div class="repo"><%= repo %></div>
</div> </div>
<% } %> <% } %>
@@ -39,7 +39,7 @@
<% } else if ((event.on === "issue")||(event.on === "commit")) { %> <% } else if ((event.on === "issue")||(event.on === "commit")) { %>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M2.75 2.5a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h2a.75.75 0 01.75.75v2.19l2.72-2.72a.75.75 0 01.53-.22h4.5a.25.25 0 00.25-.25v-7.5a.25.25 0 00-.25-.25H2.75zM1 2.75C1 1.784 1.784 1 2.75 1h10.5c.966 0 1.75.784 1.75 1.75v7.5A1.75 1.75 0 0113.25 12H9.06l-2.573 2.573A1.457 1.457 0 014 13.543V12H2.75A1.75 1.75 0 011 10.25v-7.5z"></path></svg> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M2.75 2.5a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h2a.75.75 0 01.75.75v2.19l2.72-2.72a.75.75 0 01.53-.22h4.5a.25.25 0 00.25-.25v-7.5a.25.25 0 00-.25-.25H2.75zM1 2.75C1 1.784 1.784 1 2.75 1h10.5c.966 0 1.75.784 1.75 1.75v7.5A1.75 1.75 0 0113.25 12H9.06l-2.573 2.573A1.457 1.457 0 014 13.543V12H2.75A1.75 1.75 0 011 10.25v-7.5z"></path></svg>
<% } %> <% } %>
Commented on <div class="issue">#<%= event.number %> <%= event.title %></div> <%- _("C") %>ommented on <div class="issue">#<%= event.number %> <%= event.title %></div>
</div> </div>
<div class="details"> <div class="details">
<div><%= event.on === "commit" ? "committed" : "opened" %> by <%= event.user %> in <div class="repo"><%= repo %></div></div> <div><%= event.on === "commit" ? "committed" : "opened" %> by <%= event.user %> in <div class="repo"><%= repo %></div></div>
@@ -49,7 +49,7 @@
<% if (type === "wiki") { %> <% if (type === "wiki") { %>
<div class="field"> <div class="field">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M0 1.75A.75.75 0 01.75 1h4.253c1.227 0 2.317.59 3 1.501A3.744 3.744 0 0111.006 1h4.245a.75.75 0 01.75.75v10.5a.75.75 0 01-.75.75h-4.507a2.25 2.25 0 00-1.591.659l-.622.621a.75.75 0 01-1.06 0l-.622-.621A2.25 2.25 0 005.258 13H.75a.75.75 0 01-.75-.75V1.75zm8.755 3a2.25 2.25 0 012.25-2.25H14.5v9h-3.757c-.71 0-1.4.201-1.992.572l.004-7.322zm-1.504 7.324l.004-5.073-.002-2.253A2.25 2.25 0 005.003 2.5H1.5v9h3.757a3.75 3.75 0 011.994.574z"></path></svg> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M0 1.75A.75.75 0 01.75 1h4.253c1.227 0 2.317.59 3 1.501A3.744 3.744 0 0111.006 1h4.245a.75.75 0 01.75.75v10.5a.75.75 0 01-.75.75h-4.507a2.25 2.25 0 00-1.591.659l-.622.621a.75.75 0 01-1.06 0l-.622-.621A2.25 2.25 0 005.258 13H.75a.75.75 0 01-.75-.75V1.75zm8.755 3a2.25 2.25 0 012.25-2.25H14.5v9h-3.757c-.71 0-1.4.201-1.992.572l.004-7.322zm-1.504 7.324l.004-5.073-.002-2.253A2.25 2.25 0 005.003 2.5H1.5v9h3.757a3.75 3.75 0 011.994.574z"></path></svg>
Updated <%= event.pages.length %> wiki page<%= s(event.pages.length) %> in <div class="repo"><%= repo %></div> <%- _("U") %>pdated <%= event.pages.length %> wiki page<%= s(event.pages.length) %> in <div class="repo"><%= repo %></div>
</div> </div>
<div class="details"> <div class="details">
<% for (const page of event.pages) { %> <% for (const page of event.pages) { %>
@@ -62,7 +62,7 @@
<% if (type === "pr") { %> <% if (type === "pr") { %>
<div class="field"> <div class="field">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.177 3.073L9.573.677A.25.25 0 0110 .854v4.792a.25.25 0 01-.427.177L7.177 3.427a.25.25 0 010-.354zM3.75 2.5a.75.75 0 100 1.5.75.75 0 000-1.5zm-2.25.75a2.25 2.25 0 113 2.122v5.256a2.251 2.251 0 11-1.5 0V5.372A2.25 2.25 0 011.5 3.25zM11 2.5h-1V4h1a1 1 0 011 1v5.628a2.251 2.251 0 101.5 0V5A2.5 2.5 0 0011 2.5zm1 10.25a.75.75 0 111.5 0 .75.75 0 01-1.5 0zM3.75 12a.75.75 0 100 1.5.75.75 0 000-1.5z"></path></svg> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.177 3.073L9.573.677A.25.25 0 0110 .854v4.792a.25.25 0 01-.427.177L7.177 3.427a.25.25 0 010-.354zM3.75 2.5a.75.75 0 100 1.5.75.75 0 000-1.5zm-2.25.75a2.25 2.25 0 113 2.122v5.256a2.251 2.251 0 11-1.5 0V5.372A2.25 2.25 0 011.5 3.25zM11 2.5h-1V4h1a1 1 0 011 1v5.628a2.251 2.251 0 101.5 0V5A2.5 2.5 0 0011 2.5zm1 10.25a.75.75 0 111.5 0 .75.75 0 01-1.5 0zM3.75 12a.75.75 0 100 1.5.75.75 0 000-1.5z"></path></svg>
<%= event.action === "opened" ? "Opened" : "Merged" %> <div class="issue">#<%= event.number %> <%= event.title %></div> <%- event.action === "opened" ? `${_("O")}pened` : `${_("M")}erged` %> <div class="issue">#<%= event.number %> <%= event.title %></div>
</div> </div>
<div class="details"> <div class="details">
<div>opened <%= user.login !== event.user ? `by ${event.user}` : "" %> in <div class="repo"><%= repo %></div></div> <div>opened <%= user.login !== event.user ? `by ${event.user}` : "" %> in <div class="repo"><%= repo %></div></div>
@@ -72,7 +72,7 @@
<% if (type === "issue") { %> <% if (type === "issue") { %>
<div class="field"> <div class="field">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M8 1.5a6.5 6.5 0 100 13 6.5 6.5 0 000-13zM0 8a8 8 0 1116 0A8 8 0 010 8zm9 3a1 1 0 11-2 0 1 1 0 012 0zm-.25-6.25a.75.75 0 00-1.5 0v3.5a.75.75 0 001.5 0v-3.5z"></path></svg> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M8 1.5a6.5 6.5 0 100 13 6.5 6.5 0 000-13zM0 8a8 8 0 1116 0A8 8 0 010 8zm9 3a1 1 0 11-2 0 1 1 0 012 0zm-.25-6.25a.75.75 0 00-1.5 0v3.5a.75.75 0 001.5 0v-3.5z"></path></svg>
<%= event.action === "opened" ? "Opened" : event.action === "reopened" ? "Reopened" : "Closed" %> <div class="issue">#<%= event.number %> <%= event.title %></div> <%- event.action === "opened" ? `${_("O")}pened` : event.action === "reopened" ? `${_("R")}eopened` : `${_("C")}losed` %> <div class="issue">#<%= event.number %> <%= event.title %></div>
</div> </div>
<div class="details"> <div class="details">
<div>opened <%= user.login !== event.user ? `by ${event.user}` : "" %> in <div class="repo"><%= repo %></div></div> <div>opened <%= user.login !== event.user ? `by ${event.user}` : "" %> in <div class="repo"><%= repo %></div></div>
@@ -81,19 +81,19 @@
<% if (type === "fork") { %> <% if (type === "fork") { %>
<div class="field"> <div class="field">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M5 3.25a.75.75 0 11-1.5 0 .75.75 0 011.5 0zm0 2.122a2.25 2.25 0 10-1.5 0v.878A2.25 2.25 0 005.75 8.5h1.5v2.128a2.251 2.251 0 101.5 0V8.5h1.5a2.25 2.25 0 002.25-2.25v-.878a2.25 2.25 0 10-1.5 0v.878a.75.75 0 01-.75.75h-4.5A.75.75 0 015 6.25v-.878zm3.75 7.378a.75.75 0 11-1.5 0 .75.75 0 011.5 0zm3-8.75a.75.75 0 100-1.5.75.75 0 000 1.5z"></path></svg> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M5 3.25a.75.75 0 11-1.5 0 .75.75 0 011.5 0zm0 2.122a2.25 2.25 0 10-1.5 0v.878A2.25 2.25 0 005.75 8.5h1.5v2.128a2.251 2.251 0 101.5 0V8.5h1.5a2.25 2.25 0 002.25-2.25v-.878a2.25 2.25 0 10-1.5 0v.878a.75.75 0 01-.75.75h-4.5A.75.75 0 015 6.25v-.878zm3.75 7.378a.75.75 0 11-1.5 0 .75.75 0 011.5 0zm3-8.75a.75.75 0 100-1.5.75.75 0 000 1.5z"></path></svg>
Forked <div class="repo"><%= repo %></div> <%- _("F") %>orked <div class="repo"><%= repo %></div>
</div> </div>
<% } %> <% } %>
<% if (type === "public") { %> <% if (type === "public") { %>
<div class="field"> <div class="field">
<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> <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>
Made <div class="repo"><%= repo %></div> public <%- _("M") %>ade <div class="repo"><%= repo %></div> public
</div> </div>
<% } %> <% } %>
<% if (type === "review") { %> <% if (type === "review") { %>
<div class="field"> <div class="field">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M2.5 1.75a.25.25 0 01.25-.25h8.5a.25.25 0 01.25.25v7.736a.75.75 0 101.5 0V1.75A1.75 1.75 0 0011.25 0h-8.5A1.75 1.75 0 001 1.75v11.5c0 .966.784 1.75 1.75 1.75h3.17a.75.75 0 000-1.5H2.75a.25.25 0 01-.25-.25V1.75zM4.75 4a.75.75 0 000 1.5h4.5a.75.75 0 000-1.5h-4.5zM4 7.75A.75.75 0 014.75 7h2a.75.75 0 010 1.5h-2A.75.75 0 014 7.75zm11.774 3.537a.75.75 0 00-1.048-1.074L10.7 14.145 9.281 12.72a.75.75 0 00-1.062 1.058l1.943 1.95a.75.75 0 001.055.008l4.557-4.45z"></path></svg> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M2.5 1.75a.25.25 0 01.25-.25h8.5a.25.25 0 01.25.25v7.736a.75.75 0 101.5 0V1.75A1.75 1.75 0 0011.25 0h-8.5A1.75 1.75 0 001 1.75v11.5c0 .966.784 1.75 1.75 1.75h3.17a.75.75 0 000-1.5H2.75a.25.25 0 01-.25-.25V1.75zM4.75 4a.75.75 0 000 1.5h4.5a.75.75 0 000-1.5h-4.5zM4 7.75A.75.75 0 014.75 7h2a.75.75 0 010 1.5h-2A.75.75 0 014 7.75zm11.774 3.537a.75.75 0 00-1.048-1.074L10.7 14.145 9.281 12.72a.75.75 0 00-1.062 1.058l1.943 1.95a.75.75 0 001.055.008l4.557-4.45z"></path></svg>
Reviewed <div class="issue">#<%= event.number %> <%= event.title %></div> <%- _("R") %>eviewed <div class="issue">#<%= event.number %> <%= event.title %></div>
</div> </div>
<div class="details"> <div class="details">
<div>opened <%= user.login !== event.user ? `by ${event.user}` : "" %> in <div class="repo"><%= repo %></div></div> <div>opened <%= user.login !== event.user ? `by ${event.user}` : "" %> in <div class="repo"><%= repo %></div></div>
@@ -102,7 +102,7 @@
<% if (type === "push") { %> <% if (type === "push") { %>
<div class="field"> <div class="field">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M10.5 7.75a2.5 2.5 0 11-5 0 2.5 2.5 0 015 0zm1.43.75a4.002 4.002 0 01-7.86 0H.75a.75.75 0 110-1.5h3.32a4.001 4.001 0 017.86 0h3.32a.75.75 0 110 1.5h-3.32z"></path></svg> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M10.5 7.75a2.5 2.5 0 11-5 0 2.5 2.5 0 015 0zm1.43.75a4.002 4.002 0 01-7.86 0H.75a.75.75 0 110-1.5h3.32a4.001 4.001 0 017.86 0h3.32a.75.75 0 110 1.5h-3.32z"></path></svg>
Pushed <%= event.size %> commit<%= s(event.size) %> in <div class="repo"><%= repo %></div> <%- _("P") %>ushed <%= event.size %> commit<%= s(event.size) %> in <div class="repo"><%= repo %></div>
</div> </div>
<div class="details"> <div class="details">
<% if (event.branch) { %> <% if (event.branch) { %>
@@ -119,20 +119,25 @@
<% if (type === "release") { %> <% if (type === "release") { %>
<div class="field"> <div class="field">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M8.878.392a1.75 1.75 0 00-1.756 0l-5.25 3.045A1.75 1.75 0 001 4.951v6.098c0 .624.332 1.2.872 1.514l5.25 3.045a1.75 1.75 0 001.756 0l5.25-3.045c.54-.313.872-.89.872-1.514V4.951c0-.624-.332-1.2-.872-1.514L8.878.392zM7.875 1.69a.25.25 0 01.25 0l4.63 2.685L8 7.133 3.245 4.375l4.63-2.685zM2.5 5.677v5.372c0 .09.047.171.125.216l4.625 2.683V8.432L2.5 5.677zm6.25 8.271l4.625-2.683a.25.25 0 00.125-.216V5.677L8.75 8.432v5.516z"></path></svg> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M8.878.392a1.75 1.75 0 00-1.756 0l-5.25 3.045A1.75 1.75 0 001 4.951v6.098c0 .624.332 1.2.872 1.514l5.25 3.045a1.75 1.75 0 001.756 0l5.25-3.045c.54-.313.872-.89.872-1.514V4.951c0-.624-.332-1.2-.872-1.514L8.878.392zM7.875 1.69a.25.25 0 01.25 0l4.63 2.685L8 7.133 3.245 4.375l4.63-2.685zM2.5 5.677v5.372c0 .09.047.171.125.216l4.625 2.683V8.432L2.5 5.677zm6.25 8.271l4.625-2.683a.25.25 0 00.125-.216V5.677L8.75 8.432v5.516z"></path></svg>
<%= event.draft ? "Drafted release" : event.prerelease ? "Pre-released" : "Released" %> <%- event.draft ? `${_("D")}rafted release` : event.prerelease ? `${_("P")}re-released` : `${_("R")}eleased` %>
<div class="bold"><%= event.name %></div> of <div class="repo"><%= repo %></div> <div class="bold"><%= event.name %></div> of <div class="repo"><%= repo %></div>
</div> </div>
<% } %> <% } %>
<% if (type === "star") { %> <% if (type === "star") { %>
<div class="field"> <div class="field">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M8 .25a.75.75 0 01.673.418l1.882 3.815 4.21.612a.75.75 0 01.416 1.279l-3.046 2.97.719 4.192a.75.75 0 01-1.088.791L8 12.347l-3.766 1.98a.75.75 0 01-1.088-.79l.72-4.194L.818 6.374a.75.75 0 01.416-1.28l4.21-.611L7.327.668A.75.75 0 018 .25zm0 2.445L6.615 5.5a.75.75 0 01-.564.41l-3.097.45 2.24 2.184a.75.75 0 01.216.664l-.528 3.084 2.769-1.456a.75.75 0 01.698 0l2.77 1.456-.53-3.084a.75.75 0 01.216-.664l2.24-2.183-3.096-.45a.75.75 0 01-.564-.41L8 2.694v.001z"></path></svg> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M8 .25a.75.75 0 01.673.418l1.882 3.815 4.21.612a.75.75 0 01.416 1.279l-3.046 2.97.719 4.192a.75.75 0 01-1.088.791L8 12.347l-3.766 1.98a.75.75 0 01-1.088-.79l.72-4.194L.818 6.374a.75.75 0 01.416-1.28l4.21-.611L7.327.668A.75.75 0 018 .25zm0 2.445L6.615 5.5a.75.75 0 01-.564.41l-3.097.45 2.24 2.184a.75.75 0 01.216.664l-.528 3.084 2.769-1.456a.75.75 0 01.698 0l2.77 1.456-.53-3.084a.75.75 0 01.216-.664l2.24-2.183-3.096-.45a.75.75 0 01-.564-.41L8 2.694v.001z"></path></svg>
Starred <div class="repo"><%= repo %></div> <%- _("S") %>tarred <div class="repo"><%= repo %></div>
</div> </div>
<% } %> <% } %>
<% if (type === "member") { %> <% if (type === "member") { %>
<div class="field"> <div class="field">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M10.5 5a2.5 2.5 0 11-5 0 2.5 2.5 0 015 0zm.061 3.073a4 4 0 10-5.123 0 6.004 6.004 0 00-3.431 5.142.75.75 0 001.498.07 4.5 4.5 0 018.99 0 .75.75 0 101.498-.07 6.005 6.005 0 00-3.432-5.142z"></path></svg> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M10.5 5a2.5 2.5 0 11-5 0 2.5 2.5 0 015 0zm.061 3.073a4 4 0 10-5.123 0 6.004 6.004 0 00-3.431 5.142.75.75 0 001.498.07 4.5 4.5 0 018.99 0 .75.75 0 101.498-.07 6.005 6.005 0 00-3.432-5.142z"></path></svg>
Added <%= event.user %> as collaborator in <div class="repo"><%= repo %></div> <%- _("A") %>dded <%= event.user %> as collaborator in <div class="repo"><%= repo %></div>
</div>
<% } %>
<% if (plugins.activity.timestamps) { %>
<div class="timestamp">
<%= f.date(timestamp, {timeStyle:"short", dateStyle:"short"}) %>
</div> </div>
<% } %> <% } %>
</section> </section>

View File

@@ -473,6 +473,13 @@
margin: 0 4px; margin: 0 4px;
} }
.activity .issue {
flex-grow: 1;
width: 0%;
text-overflow: ellipsis;
overflow: hidden;
}
.activity .code { .activity .code {
background-color: #7777771F; background-color: #7777771F;
padding: 1px 5px; padding: 1px 5px;
@@ -483,12 +490,12 @@
margin: 0 4px -3px; margin: 0 4px -3px;
} }
.activity .bold { .activity .bold, .activity .user {
font-weight: 600; font-weight: 600;
margin: 0 4px; margin: 0 4px;
} }
.activity .details { .activity .details, .activity .timestamp {
padding-left: 42px; padding-left: 42px;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
@@ -496,6 +503,11 @@
color: #666666; color: #666666;
} }
.activity .timestamp {
font-size: 10px;
margin-top: 4px;
}
.activity .details > div { .activity .details > div {
display: flex; display: flex;
align-items: center; align-items: center;

View File

@@ -5,5 +5,6 @@
"projects", "projects",
"pagespeed", "pagespeed",
"stargazers", "stargazers",
"people" "people",
"activity"
] ]

View File

@@ -0,0 +1,150 @@
<% if (plugins.activity) { %>
<section>
<h2 class="field">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M0 8a8 8 0 1116 0v5.25a.75.75 0 01-1.5 0V8a6.5 6.5 0 10-13 0v5.25a.75.75 0 01-1.5 0V8zm5.5 4.25a.75.75 0 01.75-.75h3.5a.75.75 0 010 1.5h-3.5a.75.75 0 01-.75-.75zM3 6.75C3 5.784 3.784 5 4.75 5h6.5c.966 0 1.75.784 1.75 1.75v1.5A1.75 1.75 0 0111.25 10h-6.5A1.75 1.75 0 013 8.25v-1.5zm1.47-.53a.75.75 0 011.06 0l.97.97.97-.97a.75.75 0 011.06 0l.97.97.97-.97a.75.75 0 111.06 1.06l-1.5 1.5a.75.75 0 01-1.06 0L8 7.81l-.97.97a.75.75 0 01-1.06 0l-1.5-1.5a.75.75 0 010-1.06z"></path></svg>
Recent activity
</h2>
<div class="row">
<section>
<% if (plugins.activity.error) { %>
<div class="field error">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M2.343 13.657A8 8 0 1113.657 2.343 8 8 0 012.343 13.657zM6.03 4.97a.75.75 0 00-1.06 1.06L6.94 8 4.97 9.97a.75.75 0 101.06 1.06L8 9.06l1.97 1.97a.75.75 0 101.06-1.06L9.06 8l1.97-1.97a.75.75 0 10-1.06-1.06L8 6.94 6.03 4.97z"></path></svg>
<%= plugins.activity.error.message %>
</div>
<% } else { %>
<% if (!plugins.activity.events.length) { %>
<div class="field">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M1.75 1.5a.25.25 0 00-.25.25v9.5c0 .138.112.25.25.25h2a.75.75 0 01.75.75v2.19l2.72-2.72a.75.75 0 01.53-.22h6.5a.25.25 0 00.25-.25v-9.5a.25.25 0 00-.25-.25H1.75zM0 1.75C0 .784.784 0 1.75 0h12.5C15.216 0 16 .784 16 1.75v9.5A1.75 1.75 0 0114.25 13H8.06l-2.573 2.573A1.457 1.457 0 013 14.543V13H1.75A1.75 1.75 0 010 11.25v-9.5zM9 9a1 1 0 11-2 0 1 1 0 012 0zm-.25-5.25a.75.75 0 00-1.5 0v2.5a.75.75 0 001.5 0v-2.5z"></path></svg>
No recent activity
</div>
<% } %>
<% for (const {actor, type, repo, timestamp, ...event} of plugins.activity.events) { const _ = letter => `<div class="user">${actor}</div> ${letter.toLocaleLowerCase()}` %>
<div class="row fill-width">
<section class="activity">
<% if (/^ref/.test(type)) { %>
<div class="field">
<% 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>
<% } %>
<%- /create/.test(type) ? `${_("C")}reated new` : `${_("D")}eleted` %>
<%= event.ref.type %> <div class="code"><%= event.ref.name %></div> in <div class="repo"><%= repo %></div>
</div>
<% } %>
<% if (type === "comment") { %>
<div class="field">
<% if (event.on === "pr") { %>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M1.5 2.75a.25.25 0 01.25-.25h12.5a.25.25 0 01.25.25v8.5a.25.25 0 01-.25.25h-6.5a.75.75 0 00-.53.22L4.5 14.44v-2.19a.75.75 0 00-.75-.75h-2a.25.25 0 01-.25-.25v-8.5zM1.75 1A1.75 1.75 0 000 2.75v8.5C0 12.216.784 13 1.75 13H3v1.543a1.457 1.457 0 002.487 1.03L8.061 13h6.189A1.75 1.75 0 0016 11.25v-8.5A1.75 1.75 0 0014.25 1H1.75zm5.03 3.47a.75.75 0 010 1.06L5.31 7l1.47 1.47a.75.75 0 01-1.06 1.06l-2-2a.75.75 0 010-1.06l2-2a.75.75 0 011.06 0zm2.44 0a.75.75 0 000 1.06L10.69 7 9.22 8.47a.75.75 0 001.06 1.06l2-2a.75.75 0 000-1.06l-2-2a.75.75 0 00-1.06 0z"></path></svg>
<% } else if ((event.on === "issue")||(event.on === "commit")) { %>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M2.75 2.5a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h2a.75.75 0 01.75.75v2.19l2.72-2.72a.75.75 0 01.53-.22h4.5a.25.25 0 00.25-.25v-7.5a.25.25 0 00-.25-.25H2.75zM1 2.75C1 1.784 1.784 1 2.75 1h10.5c.966 0 1.75.784 1.75 1.75v7.5A1.75 1.75 0 0113.25 12H9.06l-2.573 2.573A1.457 1.457 0 014 13.543V12H2.75A1.75 1.75 0 011 10.25v-7.5z"></path></svg>
<% } %>
<%- _("C") %>ommented on <div class="issue">#<%= event.number %> <%= event.title %></div>
</div>
<div class="details">
<div><%= event.on === "commit" ? "committed" : "opened" %> by <%= event.user %> in <div class="repo"><%= repo %></div></div>
<div class="comment"><%= event.content %></div>
</div>
<% } %>
<% if (type === "wiki") { %>
<div class="field">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M0 1.75A.75.75 0 01.75 1h4.253c1.227 0 2.317.59 3 1.501A3.744 3.744 0 0111.006 1h4.245a.75.75 0 01.75.75v10.5a.75.75 0 01-.75.75h-4.507a2.25 2.25 0 00-1.591.659l-.622.621a.75.75 0 01-1.06 0l-.622-.621A2.25 2.25 0 005.258 13H.75a.75.75 0 01-.75-.75V1.75zm8.755 3a2.25 2.25 0 012.25-2.25H14.5v9h-3.757c-.71 0-1.4.201-1.992.572l.004-7.322zm-1.504 7.324l.004-5.073-.002-2.253A2.25 2.25 0 005.003 2.5H1.5v9h3.757a3.75 3.75 0 011.994.574z"></path></svg>
<%- _("U") %>pdated <%= event.pages.length %> wiki page<%= s(event.pages.length) %> in <div class="repo"><%= repo %></div>
</div>
<div class="details">
<% for (const page of event.pages) { %>
<div class="page">
<%= page %>
</div>
<% } %>
</div>
<% } %>
<% if (type === "pr") { %>
<div class="field">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.177 3.073L9.573.677A.25.25 0 0110 .854v4.792a.25.25 0 01-.427.177L7.177 3.427a.25.25 0 010-.354zM3.75 2.5a.75.75 0 100 1.5.75.75 0 000-1.5zm-2.25.75a2.25 2.25 0 113 2.122v5.256a2.251 2.251 0 11-1.5 0V5.372A2.25 2.25 0 011.5 3.25zM11 2.5h-1V4h1a1 1 0 011 1v5.628a2.251 2.251 0 101.5 0V5A2.5 2.5 0 0011 2.5zm1 10.25a.75.75 0 111.5 0 .75.75 0 01-1.5 0zM3.75 12a.75.75 0 100 1.5.75.75 0 000-1.5z"></path></svg>
<%- event.action === "opened" ? `${_("O")}pened` : `${_("M")}erged` %> <div class="issue">#<%= event.number %> <%= event.title %></div>
</div>
<div class="details">
<div>opened <%= user.login !== event.user ? `by ${event.user}` : "" %> in <div class="repo"><%= repo %></div></div>
<div><%= event.files.changed %> file<%= s(event.files.changed) %> changed <div class="code">++<%= event.lines.added %> --<%= event.lines.deleted%></div></div>
</div>
<% } %>
<% if (type === "issue") { %>
<div class="field">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M8 1.5a6.5 6.5 0 100 13 6.5 6.5 0 000-13zM0 8a8 8 0 1116 0A8 8 0 010 8zm9 3a1 1 0 11-2 0 1 1 0 012 0zm-.25-6.25a.75.75 0 00-1.5 0v3.5a.75.75 0 001.5 0v-3.5z"></path></svg>
<%- event.action === "opened" ? `${_("O")}pened` : event.action === "reopened" ? `${_("R")}eopened` : `${_("C")}losed` %> <div class="issue">#<%= event.number %> <%= event.title %></div>
</div>
<div class="details">
<div>opened <%= user.login !== event.user ? `by ${event.user}` : "" %> in <div class="repo"><%= repo %></div></div>
</div>
<% } %>
<% if (type === "fork") { %>
<div class="field">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M5 3.25a.75.75 0 11-1.5 0 .75.75 0 011.5 0zm0 2.122a2.25 2.25 0 10-1.5 0v.878A2.25 2.25 0 005.75 8.5h1.5v2.128a2.251 2.251 0 101.5 0V8.5h1.5a2.25 2.25 0 002.25-2.25v-.878a2.25 2.25 0 10-1.5 0v.878a.75.75 0 01-.75.75h-4.5A.75.75 0 015 6.25v-.878zm3.75 7.378a.75.75 0 11-1.5 0 .75.75 0 011.5 0zm3-8.75a.75.75 0 100-1.5.75.75 0 000 1.5z"></path></svg>
<%- _("F") %>orked <div class="repo"><%= repo %></div>
</div>
<% } %>
<% if (type === "public") { %>
<div class="field">
<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>
<%- _("M") %>ade <div class="repo"><%= repo %></div> public
</div>
<% } %>
<% if (type === "review") { %>
<div class="field">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M2.5 1.75a.25.25 0 01.25-.25h8.5a.25.25 0 01.25.25v7.736a.75.75 0 101.5 0V1.75A1.75 1.75 0 0011.25 0h-8.5A1.75 1.75 0 001 1.75v11.5c0 .966.784 1.75 1.75 1.75h3.17a.75.75 0 000-1.5H2.75a.25.25 0 01-.25-.25V1.75zM4.75 4a.75.75 0 000 1.5h4.5a.75.75 0 000-1.5h-4.5zM4 7.75A.75.75 0 014.75 7h2a.75.75 0 010 1.5h-2A.75.75 0 014 7.75zm11.774 3.537a.75.75 0 00-1.048-1.074L10.7 14.145 9.281 12.72a.75.75 0 00-1.062 1.058l1.943 1.95a.75.75 0 001.055.008l4.557-4.45z"></path></svg>
<%- _("R") %>eviewed <div class="issue">#<%= event.number %> <%= event.title %></div>
</div>
<div class="details">
<div>opened <%= user.login !== event.user ? `by ${event.user}` : "" %> in <div class="repo"><%= repo %></div></div>
</div>
<% } %>
<% if (type === "push") { %>
<div class="field">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M10.5 7.75a2.5 2.5 0 11-5 0 2.5 2.5 0 015 0zm1.43.75a4.002 4.002 0 01-7.86 0H.75a.75.75 0 110-1.5h3.32a4.001 4.001 0 017.86 0h3.32a.75.75 0 110 1.5h-3.32z"></path></svg>
<%- _("P") %>ushed <%= event.size %> commit<%= s(event.size) %> in <div class="repo"><%= repo %></div>
</div>
<div class="details">
<% if (event.branch) { %>
<div>on branch <div class="code"><%= event.branch %></div></div>
<% } %>
<% for (const commit of event.commits) { %>
<div class="commit">
<div class="sha">#<%= commit.sha %></div>
<div class="message"><%= commit.message %></div>
</div>
<% } %>
</div>
<% } %>
<% if (type === "release") { %>
<div class="field">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M8.878.392a1.75 1.75 0 00-1.756 0l-5.25 3.045A1.75 1.75 0 001 4.951v6.098c0 .624.332 1.2.872 1.514l5.25 3.045a1.75 1.75 0 001.756 0l5.25-3.045c.54-.313.872-.89.872-1.514V4.951c0-.624-.332-1.2-.872-1.514L8.878.392zM7.875 1.69a.25.25 0 01.25 0l4.63 2.685L8 7.133 3.245 4.375l4.63-2.685zM2.5 5.677v5.372c0 .09.047.171.125.216l4.625 2.683V8.432L2.5 5.677zm6.25 8.271l4.625-2.683a.25.25 0 00.125-.216V5.677L8.75 8.432v5.516z"></path></svg>
<%- event.draft ? `${_("D")}rafted release` : event.prerelease ? `${_("P")}re-released` : `${_("R")}eleased` %>
<div class="bold"><%= event.name %></div> of <div class="repo"><%= repo %></div>
</div>
<% } %>
<% if (type === "star") { %>
<div class="field">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M8 .25a.75.75 0 01.673.418l1.882 3.815 4.21.612a.75.75 0 01.416 1.279l-3.046 2.97.719 4.192a.75.75 0 01-1.088.791L8 12.347l-3.766 1.98a.75.75 0 01-1.088-.79l.72-4.194L.818 6.374a.75.75 0 01.416-1.28l4.21-.611L7.327.668A.75.75 0 018 .25zm0 2.445L6.615 5.5a.75.75 0 01-.564.41l-3.097.45 2.24 2.184a.75.75 0 01.216.664l-.528 3.084 2.769-1.456a.75.75 0 01.698 0l2.77 1.456-.53-3.084a.75.75 0 01.216-.664l2.24-2.183-3.096-.45a.75.75 0 01-.564-.41L8 2.694v.001z"></path></svg>
<%- _("S") %>tarred <div class="repo"><%= repo %></div>
</div>
<% } %>
<% if (type === "member") { %>
<div class="field">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M10.5 5a2.5 2.5 0 11-5 0 2.5 2.5 0 015 0zm.061 3.073a4 4 0 10-5.123 0 6.004 6.004 0 00-3.431 5.142.75.75 0 001.498.07 4.5 4.5 0 018.99 0 .75.75 0 101.498-.07 6.005 6.005 0 00-3.432-5.142z"></path></svg>
<%- _("A") %>dded <%= event.user %> as collaborator in <div class="repo"><%= repo %></div>
</div>
<% } %>
<% if (plugins.activity.timestamps) { %>
<div class="timestamp">
<%= f.date(timestamp, {timeStyle:"short", dateStyle:"short"}) %>
</div>
<% } %>
</section>
</div>
<% } %>
<% } %>
</section>
</div>
</section>
<% } %>