Fix conflict

This commit is contained in:
Faeze Moradi 2020-10-07 18:32:06 +02:00
commit 40fa54f0f3
16 changed files with 99 additions and 17 deletions

View File

@ -4,6 +4,9 @@
set -ev
# Install chomedriver
curl -s -L -o chromedriver_linux64.zip https://chromedriver.storage.googleapis.com/84.0.4147.30/chromedriver_linux64.zip \
CHROME_MAIN_VERSION=`google-chrome-stable --version | sed -E 's/(^Google Chrome |\.[0-9]+ )//g'`
CHROMEDRIVER_VERSION=`curl -s "https://chromedriver.storage.googleapis.com/LATEST_RELEASE_$CHROME_MAIN_VERSION"`
curl "https://chromedriver.storage.googleapis.com/${CHROMEDRIVER_VERSION}/chromedriver_linux64.zip" -O \
&& unzip -o -d $HOME chromedriver_linux64.zip \
&& chmod +x $HOME/chromedriver

View File

@ -19,6 +19,7 @@ HumHub Changelog
- Enh #4378: Implemented generic ContentContainerActiveRecord::is() function
- Enh #4310: Add "Can Like" Permission
- Fix #4111: Issues Cropping Images
- Enh #4283: Implemented UserMemberSince and UserLastLogin user's profile virtual fields
- Fix #4385: Tour broken when profile start page is changed
- Enh #3882: Rework of wall stream entry widget design and API
- Enh #3882: Introduction of alternative `WallStreamModuleEntry` widget for collaborative content types
@ -37,6 +38,7 @@ HumHub Changelog
- Fix #3566: Bug in models/filetype/CheckboxList.php
- Enh #4401: Allow to use less variable name in value of another less variable
- Fix #4434: Fix title quoting for space icons in widget “Member in these spaces”
- Fix #4428: Replace db Expression time now with func date('Y-m-d G:i:s')
- Enh #4370: Add "summary" to `Space` model
- Enh #4370: Add `humhub\modules\space\widgets\MyMembership` to manage render user state in a space
- Enh #4370: Add `humhub\modules\space\widgets\AboutPageSidebar` to manage about page sidebar

View File

@ -36,7 +36,7 @@ class ActiveRecord extends \yii\db\ActiveRecord implements \Serializable
{
if ($insert) {
if ($this->hasAttribute('created_at') && $this->created_at == "") {
$this->created_at = new \yii\db\Expression('NOW()');
$this->created_at = date('Y-m-d G:i:s');
}
if (isset(Yii::$app->user) && $this->hasAttribute('created_by') && $this->created_by == "") {
@ -45,7 +45,7 @@ class ActiveRecord extends \yii\db\ActiveRecord implements \Serializable
}
if ($this->hasAttribute('updated_at')) {
$this->updated_at = new \yii\db\Expression('NOW()');
$this->updated_at = date('Y-m-d G:i:s');
}
if (isset(Yii::$app->user) && $this->hasAttribute('updated_by')) {
$this->updated_by = Yii::$app->user->id;

View File

@ -206,7 +206,7 @@ class Content extends ActiveRecord implements Movable, ContentOwner
}
}
$this->stream_sort_date = new \yii\db\Expression('NOW()');
$this->stream_sort_date = date('Y-m-d G:i:s');
if ($this->created_by == "") {
throw new Exception("Could not save content without created_by!");
@ -853,7 +853,7 @@ class Content extends ActiveRecord implements Movable, ContentOwner
*/
public function updateStreamSortTime()
{
$this->updateAttributes(['stream_sort_date' => new \yii\db\Expression('NOW()')]);
$this->updateAttributes(['stream_sort_date' => date('Y-m-d G:i:s')]);
}
/**

View File

@ -47,7 +47,10 @@ class WallEntryControls extends Menu
{
if(!$this->renderOptions && $this->wallEntryWidget instanceof WallStreamEntryWidget) {
$this->renderOptions = $this->wallEntryWidget->renderOptions;
} else if(!$this->renderOptions) {
$this->renderOptions = new WallStreamEntryOptions();
}
parent::init();
}

View File

@ -146,7 +146,7 @@ class Membership extends ActiveRecord
*/
public function updateLastVisit()
{
$this->last_visit = new \yii\db\Expression('NOW()');
$this->last_visit = date('Y-m-d G:i:s');
$this->update(false, ['last_visit']);
}

View File

@ -6,6 +6,7 @@ namespace humhub\modules\stream\actions;
use humhub\modules\content\components\ContentActiveRecord;
use humhub\modules\content\models\Content;
use humhub\modules\content\widgets\stream\StreamEntryWidget;
use humhub\modules\content\widgets\stream\WallStreamEntryWidget;
use Yii;
use yii\base\Exception;
@ -115,7 +116,8 @@ trait LegacyStreamTrait
if(is_subclass_of($record->wallEntryClass, WallStreamEntryWidget::class, true)) {
return $record->getWallOut($options);
// This was added just in case we somehow run this with a new wall entry widget
return StreamEntryWidget::renderStreamEntry($record);
}
return static::renderLegacyWallEntry( $record, $options, $partial);

View File

@ -15,7 +15,6 @@ use humhub\modules\user\events\UserEvent;
use humhub\modules\user\helpers\AuthHelper;
use Yii;
use yii\authclient\ClientInterface;
use yii\db\Expression;
/**
* Description of User
@ -198,7 +197,7 @@ class User extends \yii\web\User
*/
public function afterLogin($identity, $cookieBased, $duration)
{
$identity->updateAttributes(['last_login' => new Expression('NOW()')]);
$identity->updateAttributes(['last_login' => date('Y-m-d G:i:s')]);
parent::afterLogin($identity, $cookieBased, $duration);
}

View File

@ -84,7 +84,7 @@ class RegistrationController extends Controller
// Autologin when user is enabled (no approval required)
if ($registration->getUser()->status === User::STATUS_ENABLED) {
Yii::$app->user->switchIdentity($registration->models['User']);
$registration->models['User']->updateAttributes(['last_login' => new \yii\db\Expression('NOW()')]);
$registration->models['User']->updateAttributes(['last_login' => date('Y-m-d G:i:s')]);
if (Yii::$app->request->getIsAjax()) {
return $this->htmlRedirect(Yii::$app->user->returnUrl);
}

View File

@ -31,7 +31,7 @@ class m140303_125031_password extends Migration
->all();
foreach ($rows as $row) {
$password = str_replace('___enc___', '', $row['password']);
$this->update('user_password', ['user_id' => $row['id'], 'password' => $password, 'algorithm' => $algorithm, 'salt' => Yii::$app->settings->get('secret'), 'created_at' => new \yii\db\Expression('NOW()')]);
$this->update('user_password', ['user_id' => $row['id'], 'password' => $password, 'algorithm' => $algorithm, 'salt' => Yii::$app->settings->get('secret'), 'created_at' => date('Y-m-d G:i:s')]);
}
$this->dropColumn('user', 'password');
}

View File

@ -2,7 +2,6 @@
use yii\db\Schema;
use yii\db\Query;
use yii\db\Expression;
use humhub\components\Migration;
class m160229_162959_multiusergroups extends Migration
@ -41,7 +40,7 @@ class m160229_162959_multiusergroups extends Migration
'is_admin_group' => '1',
'show_at_registration' => '0',
'show_at_directory' => '0',
'created_at' => new Expression('NOW()')
'created_at' => date('Y-m-d G:i:s')
]);
// Determine administration group id

View File

@ -220,11 +220,12 @@ class Group extends ActiveRecord
* @param User $user user id or user model
* @param bool $isManager mark as group manager
* @throws \yii\base\InvalidConfigException
* @return bool true - on success adding user, false - if already member or cannot be added by some reason
*/
public function addUser($user, $isManager = false)
{
if ($this->isMember($user)) {
return;
return false;
}
$userId = ($user instanceof User) ? $user->id : $user;
@ -232,7 +233,7 @@ class Group extends ActiveRecord
$newGroupUser = new GroupUser();
$newGroupUser->user_id = $userId;
$newGroupUser->group_id = $this->id;
$newGroupUser->created_at = new \yii\db\Expression('NOW()');
$newGroupUser->created_at = date('Y-m-d G:i:s');
$newGroupUser->created_by = Yii::$app->user->id;
$newGroupUser->is_group_manager = $isManager;
if ($newGroupUser->save() && !Yii::$app->user->isGuest) {
@ -240,7 +241,10 @@ class Group extends ActiveRecord
->about($this)
->from(Yii::$app->user->identity)
->send(User::findOne(['id' => $userId]));
return true;
}
return false;
}
/**

View File

@ -12,7 +12,6 @@ use Yii;
use yii\base\ErrorException;
use yii\db\ActiveRecord;
use yii\base\Exception;
use yii\db\Expression;
use humhub\libs\UUID;
use humhub\modules\user\components\CheckPasswordValidator;
@ -55,7 +54,7 @@ class Password extends ActiveRecord
public function beforeSave($insert)
{
$this->created_at = new Expression('NOW()');
$this->created_at = date('Y-m-d G:i:s');
return parent::beforeSave($insert);
}

View File

@ -86,6 +86,8 @@ class BaseType extends Model
CheckboxList::class => Yii::t('UserModule.profile', 'Checkbox List'),
UserEmail::class => Yii::t('UserModule.profile', 'E-mail address of the user'),
UserName::class => Yii::t('UserModule.profile', 'Username'),
UserMemberSince::class => Yii::t('UserModule.profile', 'Creation date of the user'),
UserLastLogin::class => Yii::t('UserModule.profile', 'Last login date of the user'),
], $this->fieldTypes);
return $fieldTypes;

View File

@ -0,0 +1,35 @@
<?php
/**
* @link https://www.humhub.org/
* @copyright Copyright (c) 2020 HumHub GmbH & Co. KG
* @license https://www.humhub.com/licences
*/
namespace humhub\modules\user\models\fieldtype;
use humhub\libs\Html;
use Yii;
/**
* UserLastLogin is a virtual profile field
* that displays the user last login dati
*
* @since 1.6
*/
class UserLastLogin extends BaseTypeVirtual
{
/**
* @inheritDoc
* @throws \yii\base\InvalidConfigException
*/
public function getVirtualUserValue($user, $raw = true)
{
if (empty($user->last_login)) {
return '-';
}
return Yii::$app->formatter->asDate($user->last_login,'long');
}
}

View File

@ -0,0 +1,34 @@
<?php
/**
* @link https://www.humhub.org/
* @copyright Copyright (c) 2020 HumHub GmbH & Co. KG
* @license https://www.humhub.com/licences
*/
namespace humhub\modules\user\models\fieldtype;
use humhub\libs\Html;
use Yii;
/**
* UserMemberSince is a virtual profile field
* that displays the user member since information
*
* @since 1.6
*/
class UserMemberSince extends BaseTypeVirtual
{
/**
* @inheritDoc
*/
public function getVirtualUserValue($user, $raw = true)
{
if (empty($user->created_at)) {
return '';
}
return Yii::$app->formatter->asDate($user->created_at,'long');
}
}