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

Readd time to mail for non-expiry activities #1181

Open
wants to merge 3 commits into
base: master
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
58 changes: 2 additions & 56 deletions .drone.star
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
BANST_AWS_CLI = "banst/awscli"
DRONE_CLI = "drone/cli:alpine"
INBUCKET_INBUCKET = "inbucket/inbucket"
MINIO_MC = "minio/mc:RELEASE.2020-12-18T10-53-53Z"
OC_CI_ALPINE = "owncloudci/alpine:latest"
OC_CI_BAZEL_BUILDIFIER = "owncloudci/bazel-buildifier"
OC_CI_CEPH = "owncloudci/ceph:tag-build-master-jewel-ubuntu-16.04"
OC_CI_CORE = "owncloudci/core"
OC_CI_DRONE_CANCEL_PREVIOUS_BUILDS = "owncloudci/drone-cancel-previous-builds"
OC_CI_DRONE_SKIP_PIPELINE = "owncloudci/drone-skip-pipeline"
OC_CI_NODEJS = "owncloudci/nodejs:%s"
OC_CI_ORACLE_XE = "owncloudci/oracle-xe:latest"
Expand Down Expand Up @@ -207,7 +205,7 @@ def main(ctx):
return before + coverageTests + afterCoverageTests + nonCoverageTests + stages + after

def beforePipelines(ctx):
return validateDailyTarballBuild() + codestyle(ctx) + jscodestyle(ctx) + cancelPreviousBuilds() + phpstan(ctx) + phan(ctx) + phplint(ctx) + checkStarlark()
return validateDailyTarballBuild() + codestyle(ctx) + jscodestyle(ctx) + phpstan(ctx) + phan(ctx) + phplint(ctx) + checkStarlark()

def coveragePipelines(ctx):
# All unit test pipelines that have coverage or other test analysis reported
Expand Down Expand Up @@ -361,31 +359,6 @@ def jscodestyle(ctx):

return pipelines

def cancelPreviousBuilds():
return [{
"kind": "pipeline",
"type": "docker",
"name": "cancel-previous-builds",
"clone": {
"disable": True,
},
"steps": [{
"name": "cancel-previous-builds",
"image": OC_CI_DRONE_CANCEL_PREVIOUS_BUILDS,
"settings": {
"DRONE_TOKEN": {
"from_secret": "drone_token",
},
},
}],
"depends_on": [],
"trigger": {
"ref": [
"refs/pull/**",
],
},
}]

def phpstan(ctx):
pipelines = []

Expand Down Expand Up @@ -1265,7 +1238,7 @@ def acceptance(ctx):
"path": "%s/downloads" % dir["server"],
}],
}),
] + testConfig["extraTeardown"] + githubComment(params["earlyFail"]) + stopBuild(ctx, params["earlyFail"]),
] + testConfig["extraTeardown"] + githubComment(params["earlyFail"]),
"services": databaseService(testConfig["database"]) +
browserService(testConfig["browser"]) +
emailService(testConfig["emailNeeded"]) +
Expand Down Expand Up @@ -2098,33 +2071,6 @@ def buildTestConfig(params):
configs.append(config)
return configs

def stopBuild(ctx, earlyFail):
if (earlyFail):
return [{
"name": "stop-build",
"image": DRONE_CLI,
"environment": {
"DRONE_SERVER": "https://drone.owncloud.com",
"DRONE_TOKEN": {
"from_secret": "drone_token",
},
},
"commands": [
"drone build stop owncloud/%s ${DRONE_BUILD_NUMBER}" % ctx.repo.name,
],
"when": {
"status": [
"failure",
],
"event": [
"pull_request",
],
},
}]

else:
return []

def githubComment(earlyFail):
if (earlyFail):
return [{
Expand Down
36 changes: 27 additions & 9 deletions lib/MailQueueHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -257,27 +257,45 @@ protected function sendMail($user, $email, $lang, $timezone, $mailData, $skipped
->setTimestamp($activity['amq_timestamp'])
->setSubject($activity['amq_subject'], []);

$relativeDateTime = $this->dateFormatter->formatDateRelativeDay(
$relativeDate = $this->dateFormatter->formatDateRelativeDay(
$activity['amq_timestamp'],
'long',
new \DateTimeZone($timezone),
$l
);
$relativeDateTime = $this->dateFormatter->formatDateTimeRelativeDay(
$activity['amq_timestamp'],
'long',
'short',
new \DateTimeZone($timezone),
$l
);

$message = $this->dataHelper->translation(
$activity['amq_appid'],
$activity['amq_subject'],
$this->dataHelper->getParameters($event, 'subject', $activity['amq_subjectparams'])
);

$activityListPlain[] = [
$plainParser->parseMessage($message),
$relativeDateTime,
];
$activityListHtml[] = [
$htmlParser->parseMessage($message),
$relativeDateTime,
];
if ((strpos($activity['amq_subjectparams'], 'shareExpired') !== false)) {
$activityListPlain[] = [
$plainParser->parseMessage($message),
$relativeDate,
];
$activityListHtml[] = [
$htmlParser->parseMessage($message),
$relativeDate,
];
} else {
$activityListPlain[] = [
$plainParser->parseMessage($message),
$relativeDateTime,
];
$activityListHtml[] = [
$htmlParser->parseMessage($message),
$relativeDateTime,
];
}
}

$alttext = new Template('activity', 'email.notification', '', false);
Expand Down