Skip to content

Commit

Permalink
🌟 Update main to 2021.Q2.481
Browse files Browse the repository at this point in the history
  • Loading branch information
RomaricMourgues authored Apr 15, 2021
2 parents 19bb6f2 + 2d90c28 commit c9b67d7
Show file tree
Hide file tree
Showing 297 changed files with 1,514 additions and 1,268 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/saas-update-backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
deploy-php:
runs-on: ubuntu-20.04
steps:
- run: 'echo "DOCKERTAGVERSION=2021.Q1.434" >> $GITHUB_ENV'
- run: 'echo "DOCKERTAGVERSION=2021.Q2.481" >> $GITHUB_ENV'
- name: Set env to develop
if: endsWith(github.ref, '/develop')
run: 'echo "DOCKERTAG=develop" >> $GITHUB_ENV; echo "DOCKERTAGVERSION=${{ env.DOCKERTAGVERSION }}-develop" >> $GITHUB_ENV'
Expand All @@ -34,7 +34,7 @@ jobs:
deploy-node:
runs-on: ubuntu-20.04
steps:
- run: 'echo "DOCKERTAGVERSION=2021.Q1.434" >> $GITHUB_ENV'
- run: 'echo "DOCKERTAGVERSION=2021.Q2.481" >> $GITHUB_ENV'
- name: Set env to develop
if: endsWith(github.ref, '/develop')
run: 'echo "DOCKERTAG=develop" >> $GITHUB_ENV; echo "DOCKERTAGVERSION=${{ env.DOCKERTAGVERSION }}-develop" >> $GITHUB_ENV'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/saas-update-front.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
runs-on: ubuntu-20.04
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop'
steps:
- run: 'echo "DOCKERTAGVERSION=2021.Q1.434" >> $GITHUB_ENV'
- run: 'echo "DOCKERTAGVERSION=2021.Q2.481" >> $GITHUB_ENV'
- name: Set env to develop
if: endsWith(github.ref, '/develop')
run: 'echo "DOCKERTAG=develop" >> $GITHUB_ENV; echo "DOCKERTAGVERSION=${{ env.DOCKERTAGVERSION }}-develop" >> $GITHUB_ENV'
Expand Down
61 changes: 61 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,64 @@
# Twake 2021.Q2.481

### Messages

- Fix a bug making too many desktop notifications at the same time.
- Fix a bug when sending a message using the send button, message now disapear as expected.
- Fix the "hidden notification" button that can be stuck on top or bottom of the channel list.

### Console

- Now if you change your language on Console it will affect Twake accordingly.
- Better onboarding of new users: automatic channel selection, add collaborators button, invite collaborators from Twake using console management app and more.
- Polishing console migration script, previous Twake users will soon uses the Console.

# Twake 2021.Q1.434

### Messages

- Default channels now available 🌟 You can set a channel as default, new users invited in workspace will be automatically added to this channel.

### General

- Console onboarding update (soon open source!)
- Multiple bug fixes

# Twake 2021.Q1.401

### General

- First elements of Twake new design, welcome to blue #3840f7
- Cmd+K / Ctrl+K now working on all channels types (direct and workspace channels)
- Multiple bug fixes

# Twake 2021.Q1.385

### General

- Twake is on OVH! OVH is a french infrastructure provider, it is a big step for us. Good bye Amazon 👋
- Started migration to NodeJS from PHP (30%) for faster and lighter server, compatibility with MongoDB and more!
- Move to socket.io from socketcluster for more robust websockets.
- We are now compatible with the Twake Console. Twake account and group management will be soon fully replaced by the Console.
- Big performances upgrades, we fixed a lot of memory leaks in the last weeks.

### Channels

- Ability to join and leave channels.
- Channel activity messages.
- Access and rights for channel creation updated (now everyone can create channels).
- Favorite direct channels, now you can put your direct channels in favorites too.
- Channel groups are back! Yes, you can again create groups of channels to organize your workspace.
- Channel members list: see who is in a channel and manage members

### Notifications

- Now you only receive badge notification for threads you follow and when you are mentionned.
- Other messages in channel will update the channel text to bold.

### Drive

- Ability to preview coding files and markdown files

# Twake 2020.Q4.137

### General
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,12 +139,21 @@ public function saveDocument($id, $content){
return false;
}
$document = new BuiltInConnectorsEntity($cred["api_id"], $id);
$document->setValue($content);
$this->doctrine->persist($document);
if($content === null){
$this->doctrine->remove($document);
}else{
$document->setValue($content);
$this->doctrine->persist($document);
}
$this->doctrine->flush();
return true;
}

/** Remove connector document from db */
public function removeDocument($id){
return $this->saveDocument($id, null);
}

/** Get connector document from db */
public function getDocument($id){
$cred = $this->getConnectorKeys();
Expand Down
4 changes: 2 additions & 2 deletions twake/backend/core/src/Twake/Calendar/Controller/Calendar.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function save(Request $request)
}else{
if($GLOBALS["segment_enabled"]) \Segment::track([
"event" => "calendar:".($object["id"] ? "edit" : "create"),
"userId" => $this->getUser()->getId()
"userId" => $this->getuser()->getIdentityProviderId() ?: $this->getUser()->getId()
]);
}
return new Response(Array("data" => Array("object" => $res)));
Expand All @@ -46,7 +46,7 @@ public function getAction(Request $request)
}else{
if($GLOBALS["segment_enabled"]) \Segment::track([
"event" => "calendar:open",
"userId" => $this->getUser()->getId()
"userId" => $this->getuser()->getIdentityProviderId() ?: $this->getUser()->getId()
]);
}

Expand Down
4 changes: 2 additions & 2 deletions twake/backend/core/src/Twake/Calendar/Controller/Event.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public function remove(Request $request)
}
if($GLOBALS["segment_enabled"]) \Segment::track([
"event" => "calendar:event:remove",
"userId" => $this->getUser()->getId()
"userId" => $this->getuser()->getIdentityProviderId() ?: $this->getUser()->getId()
]);
return new Response(Array("data" => Array("object" => $res)));
}
Expand All @@ -38,7 +38,7 @@ public function save(Request $request)
}
if($GLOBALS["segment_enabled"]) \Segment::track([
"event" => "calendar:event:".($object["id"] ? "edit" : "create"),
"userId" => $this->getUser()->getId()
"userId" => $this->getuser()->getIdentityProviderId() ?: $this->getUser()->getId()
]);
}
return new Response(Array("data" => Array("object" => $res)));
Expand Down
4 changes: 2 additions & 2 deletions twake/backend/core/src/Twake/Core/Controller/Version.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ function getVersion(Request $request)
"auth_mode" => array_keys($auth),
"auth" => $auth,
"version" => [
"current" => /* @VERSION_DETAIL */ "2021.Q1.434",
"current" => /* @VERSION_DETAIL */ "2021.Q2.481",
"minimal" => [
"web" => /* @MIN_VERSION_WEB */ "2021.Q1.385",
"web" => /* @MIN_VERSION_WEB */ "2021.Q1.481",
"mobile" => /* @MIN_VERSION_MOBILE */ "2021.Q1.385",
]
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function save(Request $request)
$this->get("administration.counter")->incrementCounter("total_messages", 1);
if($GLOBALS["segment_enabled"]) \Segment::track([
"event" => "message:send",
"userId" => $this->getUser()->getId()
"userId" => $this->getuser()->getIdentityProviderId() ?: $this->getUser()->getId()
]);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -580,6 +580,7 @@ public function sendToNode($channel, $message, $did_create){

$title = "";
$text = $this->buildShortText($message);
$body = $text; // we need original body just in case text gets updated further on
if ($channel->getData()["is_direct"]) {
$title = $senderName . " in " . $channel->getData()["company_name"];
}else{
Expand Down Expand Up @@ -622,8 +623,10 @@ public function sendToNode($channel, $message, $did_create){
"channel_id" => $messageArray["channel_id"],
"date" => $messageArray["creation_date"] * 1000,
"sender" => $messageArray["sender"],
"title" => $title,
"text" => $text
"sender_name" => $senderName, // username, because it's not convenient to make request to find out username by id
"title" => $title,
"text" => $text,
"body" => $body // original body of the message without sender
];

if($messageArray["message_type"] != 2){ //Ignore system messages
Expand Down
2 changes: 1 addition & 1 deletion twake/backend/core/src/Twake/Drive/Controller/Download.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function downloadfile(Request $request)

if($GLOBALS["segment_enabled"]) \Segment::track([
"event" => "drive:download",
"userId" => $this->isConnected() ? $this->getUser()->getId() : "anonymous"
"userId" => $this->isConnected() ? ($this->getuser()->getIdentityProviderId() ?: $this->getUser()->getId()) : "anonymous"
]);

@$response = $this->get('driveupload.download')->download($workspace_id, $files_ids, $download, $versionId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public function save(Request $request)

if($GLOBALS["segment_enabled"]) \Segment::track([
"event" => "drive:".($object["is_directory"] ? "directory" : "file") . ":" . ($object["id"] ? "edit" : "create"),
"userId" => $this->getUser()->getId()
"userId" => $this->getuser()->getIdentityProviderId() ?: $this->getUser()->getId()
]);

if (!empty($object["_once_set_access"]) && !empty($object["id"])) {
Expand Down
4 changes: 2 additions & 2 deletions twake/backend/core/src/Twake/Drive/Controller/Upload.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public function Preprocess(Request $request)

if($GLOBALS["segment_enabled"]) \Segment::track([
"event" => "drive:file:create",
"userId" => $this->getUser()->getId()
"userId" => $this->getuser()->getIdentityProviderId() ?: $this->getUser()->getId()
]);

return new Response(Array("identifier" => $identifier));
Expand All @@ -41,7 +41,7 @@ public function Preview(Request $request)

if($GLOBALS["segment_enabled"]) \Segment::track([
"event" => "drive:preview",
"userId" => $this->isConnected() ? $this->getUser()->getId() : "anonymous"
"userId" => $this->isConnected() ? ($this->getuser()->getIdentityProviderId() ?: $this->getUser()->getId()) : "anonymous"
]);

$this->get('driveupload.previewmanager')->generatePreviewFromFolder($request);
Expand Down
4 changes: 2 additions & 2 deletions twake/backend/core/src/Twake/Tasks/Controller/Board.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public function remove(Request $request)
}
if($GLOBALS["segment_enabled"]) \Segment::track([
"event" => "tasks:board:remove",
"userId" => $this->getUser()->getId()
"userId" => $this->getuser()->getIdentityProviderId() ?: $this->getUser()->getId()
]);
return new Response(Array("data" => Array("object" => $res)));
}
Expand All @@ -35,7 +35,7 @@ public function save(Request $request)
}
if($GLOBALS["segment_enabled"]) \Segment::track([
"event" => "tasks:board:".($object["id"] ? "edit" : "create"),
"userId" => $this->getUser()->getId()
"userId" => $this->getuser()->getIdentityProviderId() ?: $this->getUser()->getId()
]);
return new Response(Array("data" => Array("object" => $res)));
}
Expand Down
6 changes: 3 additions & 3 deletions twake/backend/core/src/Twake/Tasks/Controller/Task.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public function remove(Request $request)
}else{
if($GLOBALS["segment_enabled"]) \Segment::track([
"event" => "tasks:task:remove",
"userId" => $this->getUser()->getId()
"userId" => $this->getuser()->getIdentityProviderId() ?: $this->getUser()->getId()
]);
}
return new Response(Array("data" => Array("object" => $res)));
Expand All @@ -37,7 +37,7 @@ public function save(Request $request)
}
if($GLOBALS["segment_enabled"]) \Segment::track([
"event" => "tasks:task:".($object["id"] ? "edit" : "create"),
"userId" => $this->getUser()->getId()
"userId" => $this->getuser()->getIdentityProviderId() ?: $this->getUser()->getId()
]);

if (!$res) {
Expand All @@ -55,7 +55,7 @@ public function getAction(Request $request)
}else{
if($GLOBALS["segment_enabled"]) \Segment::track([
"event" => "tasks:task:get",
"userId" => $this->getUser()->getId()
"userId" => $this->getuser()->getIdentityProviderId() ?: $this->getUser()->getId()
]);
}
return new Response(Array("data" => $objects));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ function logoutSuccess(Request $request)
try{
$message = json_decode(urldecode($request->query->get("error_code")));
}catch(\Exception $err){
$message = "success";
$message = false;
}

return $this->redirect(rtrim($this->getParameter("env.frontend_server_name", $this->getParameter("env.server_name")), "/") . "/login" . "?error_code=".str_replace('+', '%20', urlencode(json_encode($message))));
return $this->redirect(rtrim($this->getParameter("env.frontend_server_name", $this->getParameter("env.server_name")), "/") . "/login" . ($message ? ("?error_code=".str_replace('+', '%20', urlencode(json_encode($message)))) : "?auto"));
}

function logout(Request $request, $message = null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,14 @@ class ApplyUpdates
/** @var App */
protected $app = null;

/** @var String */
protected $endpoint = null;

public function __construct(App $app)
{
$this->app = $app;
$this->em = $app->getServices()->get("app.twake_doctrine");
$this->endpoint = $app->getContainer()->getParameter("defaults.auth.console.provider");
$this->string_cleaner = $app->getServices()->get("app.string_cleaner");
$this->user_service = $app->getServices()->get("app.user");
}
Expand Down Expand Up @@ -55,6 +59,13 @@ function updateCompany($companyDTO){
$company->setIdentityProvider("console");
$company->setIdentityProviderId($companyConsoleCode);

$avatar = $userDTO["company"]["details"]["avatar"];
$picture = $companyDTO["value"] ?: "";
if($avatar["type"] && $avatar["type"] !== "url"){
$picture = rtrim($this->endpoint, "/") . "/avatars/" . $avatar["value"];
}
$company->setLogo($picture);

// Format is {name: "string", limits: {}}
$company->setPlan($companyDTO["company"]["plan"]);

Expand All @@ -71,8 +82,6 @@ function updateCompany($companyDTO){

$this->app->getServices()->get("app.groups")->init($company);

//TODO: realtime update

return $company;

}
Expand Down Expand Up @@ -163,34 +172,26 @@ function updateUser($userDTO){
// Update user names
$user->setEmail($email);
$user->setPhone("");
$user->setFirstName($userDTO["firstName"] ?: ($userDTO["fullName"] ?: ""));
$user->setFirstName($userDTO["firstName"] ?: ($userDTO["name"] ?: ""));
$user->setLastName($userDTO["lastName"] ?: "");
$user->setMailVerified(!!$userDTO["isVerified"]);
$user->setIdentityProvider("console");
$user->setIdentityProviderId($userConsoleId);

$user->setLanguage(@$userDTO["preferences"]["locale"] ?: "en");
$user->setTimezone(@$userDTO["preferences"]["timezone"] ?: "");
$user->setLanguage(@$userDTO["preference"]["locale"] ?: "en");
$user->setTimezone(@$userDTO["preference"]["timeZone"] ?: "");

// Update user picture
$picture = $userDTO["picture"];
if (($picture && (!$user->getThumbnail() || $user->getThumbnail()->getPublicLink() != $picture)) || ($user->getThumbnail() && !$picture)) {
if ($user->getThumbnail()) {
$this->em->remove($user->getThumbnail());
}
if($picture){
$thumbnail = new File();
$thumbnail->setPublicLink($picture);
$user->setThumbnail($thumbnail);
$this->em->persist($thumbnail);
}else{
$user->setThumbnail(null);
}
$avatar = $userDTO["avatar"];
$picture = $avatar["value"] ?: "";
if($avatar["type"] && $avatar["type"] !== "url"){
$picture = rtrim($this->endpoint, "/") . "/avatars/" . $avatar["value"];
}
$user->setPicture($picture);

$this->em->persist($user);
$this->em->flush();

//TODO websocket update

foreach($roles as $role){
$companyConsoleCode = $role["targetCode"];
$level = $role["roleCode"];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function login(Request $request)

$response = new Response();
$logged = $this->getUser() && !is_string($this->getUser());
if(!$logged){
if(!$logged || ($usernameOrMail && $password)){
$loginResult = $this->get("app.user")->login($usernameOrMail, $password, $rememberMe, $request, $response);
}

Expand Down
Loading

0 comments on commit c9b67d7

Please sign in to comment.