Merge branch 'develop' into enh/hideAllPreviewFile

This commit is contained in:
Lucas Bartholemy 2020-10-21 18:14:37 +02:00 committed by GitHub
commit ba56c764a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
25 changed files with 143 additions and 49 deletions

View File

@ -6,7 +6,13 @@ HumHub Changelog
- Fix #4504: Fix `hasSidebar()` for empty sidebar
- Fix #4526: `HeaderControlsMenu::init` called twice
- Fix #4529: Aligned default dropdown text size
- Fix: Allowing guest like permission
- Fix #4533: Removed "Can Like" permission from permission settings for "Not registered users"
- Fix #4534: In profile checkbox field, `Other:` not translatable
- Fix #4547: Fixed wall stream entry header title text style
- Fix #3980: Empty stream on permalink for content a user is not allowed to access
- Enh #4448: Exclude all media preview files from file list if `excludeMediaFilesPreview` setting is active
- Fix #4542: Ignore displaying `Member Since` for empty created_at membership
1.7.0-beta.1 (October 16, 2020)
-------------------------------
@ -75,4 +81,3 @@ HumHub Changelog
- Chng #4509: Removed `humhub\modules\space\widgets\Picker` which is deprecated since v1.2
- Fix #4396: Submitting only picture in comment results in debug error.
- Enh #4469: Added alias for file uploads folder
- Enh #4448: exclude all media files preview if `excludeMediaFilesPreview` setting is active

View File

@ -34,7 +34,7 @@ class MyMembership extends Widget
return $this->render('myMembership', [
'role' => $this->space->getUserGroup(),
'memberSince' => empty($membership) ? '-' : TimeAgo::widget(['timestamp' => $membership->created_at])
'memberSince' => empty($membership) || empty($membership->created_at) ? null : TimeAgo::widget(['timestamp' => $membership->created_at])
]);
}
}

View File

@ -14,6 +14,8 @@ use humhub\widgets\PanelMenu;
<div class="panel-body">
<p><b><?= Yii::t('SpaceModule.base', 'Role') ?>: </b><?= ucfirst($role) ?></p>
<p><b><?= Yii::t('SpaceModule.base', 'Member since') ?>: </b><?= $memberSince ?></p>
<?php if (!empty($memberSince)): ?>
<p><b><?= Yii::t('SpaceModule.base', 'Member since') ?>: </b><?= $memberSince ?></p>
<?php endif; ?>
</div>
</div>

View File

@ -320,11 +320,12 @@ abstract class Stream extends Action
{
$response = new StreamResponse($this->streamQuery);
foreach ($this->streamQuery->all() as $content) {
$streamEntry = $this->getStreamEntryResult($content, $this->streamEntryOptions);
if($streamEntry) {
$response->addEntry($streamEntry);
}
$entries = $this->streamQuery->all();
if(!empty($entries)) {
$this->addResponseEntries($entries, $response);
} else {
$this->handleEmptyResponse($response);
}
$this->trigger(static::EVENT_AFTER_FETCH, new StreamResponseEvent(['response' => $response]));
@ -332,6 +333,45 @@ abstract class Stream extends Action
return $response->asJson();
}
/**
* Adds entries to the response.
*
* @param StreamResponse $response
* @throws Exception
* @throws \Throwable
* @since 1.7
*/
private function addResponseEntries($entries, StreamResponse $response)
{
foreach ($entries as $content) {
$streamEntry = $this->getStreamEntryResult($content, $this->streamEntryOptions);
if($streamEntry) {
$response->addEntry($streamEntry);
}
}
}
/**
* Adds an error message to the stream response in certain cases.
*
* @param StreamResponse $response
* @throws Exception
* @throws \Throwable
* @since 1.7
*/
private function handleEmptyResponse(StreamResponse $response)
{
if($this->streamQuery->isSingleContentQuery()) {
$content = Content::findOne(['id' => $this->streamQuery->contentId]);
if(!$content) {
$response->setError(400, Yii::t('StreamModule.base', 'The content could not be found.'));
} elseif (!$content->canView()) {
$response->setError(403, Yii::t('StreamModule.base', 'You are not allowed to view this content.'));
}
}
// Otherwise the content could not be found due to active filter
}
/**
* @param Content $content
* @param StreamEntryOptions|null $options

View File

@ -42,6 +42,16 @@ class StreamResponse
*/
private $lastContentId;
/**
* @var string
*/
public $error;
/**
* @var int
*/
public $errorCode;
/**
* StreamResponse constructor.
* @param StreamQuery $streamQuery
@ -81,6 +91,18 @@ class StreamResponse
}
}
/**
* Can be used to set error information.
* @param $code int
* @param $msg string
*/
public function setError($code, $msg)
{
$this->error = $msg;
$this->errorCode = $code;
}
/**
* Returns the stream response array.
* @return array
@ -97,6 +119,15 @@ class StreamResponse
$this->result['contentSuppressions'] = $this->streamQuery->getSuppressions();
$this->result['lastContentId'] = $this->streamQuery->getLastContentId();
}
if($this->error) {
$this->result['error'] = $this->error;
}
if($this->errorCode) {
$this->result['errorCode'] = $this->errorCode;
}
return $this->result;
}

View File

@ -366,8 +366,8 @@ humhub.module('stream.Stream', function (module, require, $) {
*
* If no specific options is set, the entries are just appended to the bottom of the stream content.
*
* @param {type} response
* @returns {unresolved}
* @param request
* @param options
*/
Stream.prototype.addResponseEntries = function (request, options) {
options = $.extend(request.options, options || {});
@ -377,6 +377,7 @@ humhub.module('stream.Stream', function (module, require, $) {
var $result = $(request.getResultHtml());
if(!$result.length) {
that.onChange(request);
return Promise.resolve();
}
@ -545,15 +546,20 @@ humhub.module('stream.Stream', function (module, require, $) {
});
};
Stream.prototype.onChange = function () {
Stream.prototype.onChange = function (request) {
var hasEntries = this.hasEntries();
this.$.find('.streamMessage').remove();
if(!hasEntries && this.isShowSingleEntry()) {
// e.g. after content deletion in single entry stream
var that = this;
setTimeout(function() {that.init()}, 50);
// we only show an error if we load a single entry we are not allowed to view, otherwise just reload the stream
if(request && request.response && request.response.errorCode && request.response.errorCode === 403) {
this.setStreamMessage(request.response.error);
} else {
// e.g. after content deletion in single entry stream
var that = this;
setTimeout(function() {that.init()}, 50);
}
} else if (!hasEntries) {
this.onEmptyStream();
} else if (this.isShowSingleEntry()) {
@ -572,10 +578,8 @@ humhub.module('stream.Stream', function (module, require, $) {
this.$.find('.streamMessage').remove();
if(!this.isShowSingleEntry()) {
this.$content.append(string.template(this.static('templates').streamMessage, {
message: (hasActiveFilters) ? this.options.streamEmptyFilterMessage : this.options.streamEmptyMessage,
cssClass: (hasActiveFilters) ? this.options.streamEmptyFilterClass : this.options.streamEmptyClass,
}));
let message = (hasActiveFilters) ? this.options.streamEmptyFilterMessage : this.options.streamEmptyMessage;
this.setStreamMessage(message, hasActiveFilters);
}
if(!hasActiveFilters) {
@ -585,6 +589,13 @@ humhub.module('stream.Stream', function (module, require, $) {
}
};
Stream.prototype.setStreamMessage = function (message, $filter) {
this.$content.append(string.template(this.static('templates').streamMessage, {
message: message,
cssClass: ($filter) ? this.options.streamEmptyFilterClass : this.options.streamEmptyClass,
}));
};
Stream.prototype.onSingleEntryStream = function () {
this.filter.hide();
};

View File

@ -165,7 +165,7 @@ class CheckboxList extends BaseType
}
if ($this->allowOther) {
$items['other'] = Yii::t($this->profileField->getTranslationCategory(), 'Other:');
$items['other'] = Yii::t('UserModule.profile', 'Other:');
}
return $items;

View File

@ -121,10 +121,16 @@ input[type=select] {
}
}
// Todo find better place for this selector
span.likeLinkContainer .like.disabled, span.likeLinkContainer .unlike.disabled {
pointer-events: none;
cursor: default;
text-decoration: none;
color: lightgrey;
}
.panel-body a[data-toggle], .modal-body a[data-toggle] {
color:@link;
}

View File

@ -47,12 +47,6 @@
background: #cacaca;
}
.content {
a {
color: darken(@info, 20%);
}
}
.post-file-list {
background-color: @background-color-page;
}

View File

@ -53,6 +53,7 @@
a {
color: @text-color-highlight;
font-size: 13px;
font-weight: 600;
padding: 4px 15px;
i {

View File

@ -24,7 +24,7 @@
}
.panel a {
color: @info;
color: @link;
}
h1,

View File

@ -50,7 +50,7 @@
a:visited {
background-color: inherit;
text-decoration: none;
color: @info !important;
color: @link !important;
}
a.header-anchor {

View File

@ -109,14 +109,14 @@
font-size: 85%;
a {
color: @info;
color: @link;
}
}
}
.content {
a {
color: @info;
color: @link;
}
}

View File

@ -107,11 +107,11 @@
.atwho-user,
.atwho-space,
.atwho-input a {
color: @info;
color: @link;
}
.atwho-input a:hover {
color: @info;
color: @link;
}
.atwho-view strong {

View File

@ -47,6 +47,11 @@
border-color: @info !important;
}
/* Info */
.colorLink {
color: @link !important;
}
/* Success */
.colorSuccess {
color: @success !important;

View File

@ -215,7 +215,7 @@ ul.tab-menu-settings {
.tab-content .tab-pane {
a {
color: @info;
color: @link;
}
.form-group {

View File

@ -56,7 +56,7 @@
font-size: 12px;
.count {
color: @info;
color: @link;
font-weight: 600;
font-size: 20px;
line-height: 0.8em;
@ -70,7 +70,7 @@
}
small a {
color: @info;
color: @link;
}
}
}

View File

@ -23,7 +23,7 @@
color: @text-color-highlight;
a {
color: @info;
color: @link;
}
img {

View File

@ -454,7 +454,7 @@
}
.ProseMirror [data-mention] {
color: @info
color: @link
}
.ProseMirror {
@ -646,7 +646,7 @@
overflow-wrap: break-word;
a {
color: @info
color: @link
}
}

View File

@ -115,10 +115,9 @@
width: 100%;
.media-heading {
font-size: 14px;
font-size: 15px;
padding-top: 1px;
margin-bottom: 3px;
font-weight: 600;
}
i.archived {

View File

@ -2,7 +2,7 @@
// Tables
// --------------------------------------------------
table {
margin-bottom: 0px !important;
margin-bottom: 0 !important;
th {
font-size: 11px;
@ -20,7 +20,7 @@ table {
td {
a:hover {
color: @info;
color: @link;
}
}
}

View File

@ -40,7 +40,7 @@
right: 10px;
a {
color: @info !important;
color: @link !important;
font-size: 12px;
font-weight: normal;
}
@ -242,7 +242,7 @@
color: @text-color-highlight;
i.accepted {
color: @info !important;
color: @link !important;
}
i.declined {

View File

@ -8,7 +8,7 @@ ul.tour-list {
padding-top: 5px;
a {
color: @info;
color: @link;
.fa {
width: 16px;

View File

@ -37,7 +37,7 @@
}
.status-bar-content .showMore {
color: @info;
color: @link;
float: right;
margin-left: 10px;
font-size: 0.7em;
@ -119,7 +119,7 @@
// --------------------------------------------------
.data-saved {
padding-left: 10px;
color: @info;
color: @link;
}
img.bounceIn {

File diff suppressed because one or more lines are too long