Skip to content

Commit

Permalink
🛠 Multiple fixes (#2000)
Browse files Browse the repository at this point in the history
* Send mobile configuration from backend

* Fix #1985

* Implements #1929

* Fix #1997

* Fix removing users

* Fix #1969

* Fix #1999

* Remove console log
  • Loading branch information
RomaricMourgues authored and Labels Bot committed Mar 8, 2022
1 parent 2cdcbb2 commit 298b3c3
Show file tree
Hide file tree
Showing 64 changed files with 354 additions and 103 deletions.
5 changes: 5 additions & 0 deletions twake/backend/node/config/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
"general": {
"help_url": false,
"pricing_plan_url": "",
"mobile": {
"mobile_redirect": "mobile.twake.app",
"mobile_appstore": "https://apps.apple.com/fr/app/twake/id1588764852?l=en",
"mobile_googleplay": "https://play.google.com/store/apps/details?id=com.twake.twake&gl=FR"
},
"accounts": {
"_type": "console",
"type": "internal",
Expand Down
9 changes: 8 additions & 1 deletion twake/backend/node/src/cli/cmds/users_cmds/remove.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import twake from "../../../twake";
import UserServiceAPI from "../../../services/user/api";
import { getInstance as getUserInstance } from "../../../services/user/entities/user";
import Table from "cli-table";
import { exit } from "process";

/**
* Merge command parameters. Check the builder definition below for more details.
Expand All @@ -22,6 +23,10 @@ const services = [
"database",
"webserver",
"statistics",
"applications",
"auth",
"realtime",
"websocket",
];

const command: yargs.CommandModule<unknown, CLIArgs> = {
Expand Down Expand Up @@ -66,13 +71,15 @@ const command: yargs.CommandModule<unknown, CLIArgs> = {
},
);

const finalUser = await userService.users.get(getUserInstance({ id: argv.id }));
const finalUser = await userService.users.get({ id: argv.id });

// Table after
tableAfter.push([finalUser.id, finalUser.username_canonical, finalUser.deleted]);

spinner.stop();
}

exit();
},
};

Expand Down
2 changes: 0 additions & 2 deletions twake/backend/node/src/core/platform/framework/pubsub.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ class EventBus {

this.subjects.get(name).subscribe({
next: (value: T) => {
logger.trace("Got a new value to dispatch to topic '%s': %o", name, value);
try {
listener(value);
} catch (err) {
Expand All @@ -38,7 +37,6 @@ class EventBus {
return false;
}

logger.trace("Publish new value to topic '%s': %o", name, data);
this.subjects.get(name)?.next(data);

return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ export class MongoConnector extends AbstractConnector<MongoConnectionOptions, mo
const { columnsDefinition, entityDefinition } = getEntityDefinition(instance);

const pk = unwrapPrimarykey(entityDefinition);

const indexes = unwrapIndexes(entityDefinition);
if (
Object.keys(filters).some(key => pk.indexOf(key) < 0) &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ export class AMQPPubSub implements PubsubClient {
const data = err ? originalMessage : message;

if (err) {
logger.error(`${LOG_PREFIX} Received a message which can not be parsed on topic ${topic}: %o`, originalMessage?.content.toString());
logger.error(
`${LOG_PREFIX} Received a message which can not be parsed on topic ${topic}: %o`,
originalMessage?.content.toString(),
);
}

listener({
Expand All @@ -51,7 +54,12 @@ export class AMQPPubSub implements PubsubClient {
}

return options?.unique
? this.client.subscribeToDurableQueue(topic, options?.queue || topic, subscribeOptions, callback)
? this.client.subscribeToDurableQueue(
topic,
options?.queue || topic,
subscribeOptions,
callback,
)
: this.client.subscribe(topic, subscribeOptions, callback);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -625,7 +625,9 @@ export class Service implements ChannelService {
if (isDirectChannel(channel)) {
const users = [];
for (const user of channel.members) {
const e = await this.userService.formatUser(await this.userService.users.get({ id: user }));
const e = await this.userService.formatUser(
await this.userService.users.getCached({ id: user }),
);
users.push(e);
}
channelWithUsers.users = users;
Expand Down Expand Up @@ -711,7 +713,7 @@ export class Service implements ChannelService {
onRead(channel: Channel, member: ChannelMember): void {
logger.info(`Channel ${channel.id} as been marked as read for user ${member.id}`);

localEventBus.publish("channel:read", {
this.platformServices.pubsub.publish("channel:read", {
data: {
channel,
member,
Expand All @@ -729,7 +731,7 @@ export class Service implements ChannelService {
onUnread(channel: Channel, member: ChannelMember): void {
logger.info(`Channel ${channel.id} as been marked as unread for user ${member.id}`);

localEventBus.publish("channel:unread", {
this.platformServices.pubsub.publish("channel:unread", {
data: {
channel,
member,
Expand Down
5 changes: 5 additions & 0 deletions twake/backend/node/src/services/general/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ export type ServerConfiguration = {
configuration: {
help_url: string | null;
pricing_plan_url: string | null;
mobile: {
mobile_redirect: string;
mobile_appstore: string;
mobile_googleplay: string;
};
accounts: {
type: "console" | "internal";
console: null | {
Expand Down
2 changes: 1 addition & 1 deletion twake/backend/node/src/services/general/web/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const routes: FastifyPluginCallback<{ configuration: ServerConfiguration["config
status: "ready",
version: version,
configuration: {
..._.pick(options.configuration, "help_url", "pricing_plan_url"),
..._.pick(options.configuration, "help_url", "pricing_plan_url", "mobile"),
accounts: {
type: accounts.type,
console: _.pick(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import { NotificationPubsubHandler, NotificationServiceAPI } from "../../../../a
import { ChannelReadMessage } from "../../../../types";

export class MarkChannelAsReadMessageProcessor
implements NotificationPubsubHandler<ChannelReadMessage, void> {
implements NotificationPubsubHandler<ChannelReadMessage, void>
{
constructor(readonly service: NotificationServiceAPI) {}

readonly topics = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import { NotificationPubsubHandler, NotificationServiceAPI } from "../../../../a
import { ChannelUnreadMessage } from "../../../../types";

export class MarkChannelAsUnreadMessageProcessor
implements NotificationPubsubHandler<ChannelUnreadMessage, void> {
implements NotificationPubsubHandler<ChannelUnreadMessage, void>
{
constructor(readonly service: NotificationServiceAPI) {}

readonly topics = {
Expand Down
2 changes: 1 addition & 1 deletion twake/frontend/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@

</style>
<link rel="manifest" href="/manifest.json" />
<link rel="stylesheet" href="/public/font/tt_norms/stylesheet.css" />
<link rel="stylesheet" href="/public/font/inter/inter.css" />
<link rel="stylesheet" href="/public/font/helvetica/stylesheet.css" />
</head>
<body id="body" style="margin: 0; padding: 0;">
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
200 changes: 200 additions & 0 deletions twake/frontend/public/public/font/inter/inter.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,200 @@
@font-face {
font-family: 'Inter';
font-style: normal;
font-weight: 100;
font-display: swap;
src: url("Inter-Thin.woff2?v=3.19") format("woff2"),
url("Inter-Thin.woff?v=3.19") format("woff");
}
@font-face {
font-family: 'Inter';
font-style: italic;
font-weight: 100;
font-display: swap;
src: url("Inter-ThinItalic.woff2?v=3.19") format("woff2"),
url("Inter-ThinItalic.woff?v=3.19") format("woff");
}

@font-face {
font-family: 'Inter';
font-style: normal;
font-weight: 200;
font-display: swap;
src: url("Inter-ExtraLight.woff2?v=3.19") format("woff2"),
url("Inter-ExtraLight.woff?v=3.19") format("woff");
}
@font-face {
font-family: 'Inter';
font-style: italic;
font-weight: 200;
font-display: swap;
src: url("Inter-ExtraLightItalic.woff2?v=3.19") format("woff2"),
url("Inter-ExtraLightItalic.woff?v=3.19") format("woff");
}

@font-face {
font-family: 'Inter';
font-style: normal;
font-weight: 300;
font-display: swap;
src: url("Inter-Light.woff2?v=3.19") format("woff2"),
url("Inter-Light.woff?v=3.19") format("woff");
}
@font-face {
font-family: 'Inter';
font-style: italic;
font-weight: 300;
font-display: swap;
src: url("Inter-LightItalic.woff2?v=3.19") format("woff2"),
url("Inter-LightItalic.woff?v=3.19") format("woff");
}

@font-face {
font-family: 'Inter';
font-style: normal;
font-weight: 400;
font-display: swap;
src: url("Inter-Regular.woff2?v=3.19") format("woff2"),
url("Inter-Regular.woff?v=3.19") format("woff");
}
@font-face {
font-family: 'Inter';
font-style: italic;
font-weight: 400;
font-display: swap;
src: url("Inter-Italic.woff2?v=3.19") format("woff2"),
url("Inter-Italic.woff?v=3.19") format("woff");
}

@font-face {
font-family: 'Inter';
font-style: normal;
font-weight: 500;
font-display: swap;
src: url("Inter-Medium.woff2?v=3.19") format("woff2"),
url("Inter-Medium.woff?v=3.19") format("woff");
}
@font-face {
font-family: 'Inter';
font-style: italic;
font-weight: 500;
font-display: swap;
src: url("Inter-MediumItalic.woff2?v=3.19") format("woff2"),
url("Inter-MediumItalic.woff?v=3.19") format("woff");
}

@font-face {
font-family: 'Inter';
font-style: normal;
font-weight: 600;
font-display: swap;
src: url("Inter-SemiBold.woff2?v=3.19") format("woff2"),
url("Inter-SemiBold.woff?v=3.19") format("woff");
}
@font-face {
font-family: 'Inter';
font-style: italic;
font-weight: 600;
font-display: swap;
src: url("Inter-SemiBoldItalic.woff2?v=3.19") format("woff2"),
url("Inter-SemiBoldItalic.woff?v=3.19") format("woff");
}

@font-face {
font-family: 'Inter';
font-style: normal;
font-weight: 700;
font-display: swap;
src: url("Inter-Bold.woff2?v=3.19") format("woff2"),
url("Inter-Bold.woff?v=3.19") format("woff");
}
@font-face {
font-family: 'Inter';
font-style: italic;
font-weight: 700;
font-display: swap;
src: url("Inter-BoldItalic.woff2?v=3.19") format("woff2"),
url("Inter-BoldItalic.woff?v=3.19") format("woff");
}

@font-face {
font-family: 'Inter';
font-style: normal;
font-weight: 800;
font-display: swap;
src: url("Inter-ExtraBold.woff2?v=3.19") format("woff2"),
url("Inter-ExtraBold.woff?v=3.19") format("woff");
}
@font-face {
font-family: 'Inter';
font-style: italic;
font-weight: 800;
font-display: swap;
src: url("Inter-ExtraBoldItalic.woff2?v=3.19") format("woff2"),
url("Inter-ExtraBoldItalic.woff?v=3.19") format("woff");
}

@font-face {
font-family: 'Inter';
font-style: normal;
font-weight: 900;
font-display: swap;
src: url("Inter-Black.woff2?v=3.19") format("woff2"),
url("Inter-Black.woff?v=3.19") format("woff");
}
@font-face {
font-family: 'Inter';
font-style: italic;
font-weight: 900;
font-display: swap;
src: url("Inter-BlackItalic.woff2?v=3.19") format("woff2"),
url("Inter-BlackItalic.woff?v=3.19") format("woff");
}

/* -------------------------------------------------------
Variable font.
Usage:
html { font-family: 'Inter', sans-serif; }
@supports (font-variation-settings: normal) {
html { font-family: 'Inter var', sans-serif; }
}
*/
@font-face {
font-family: 'Inter var';
font-weight: 100 900;
font-display: swap;
font-style: normal;
font-named-instance: 'Regular';
src: url("Inter-roman.var.woff2?v=3.19") format("woff2");
}
@font-face {
font-family: 'Inter var';
font-weight: 100 900;
font-display: swap;
font-style: italic;
font-named-instance: 'Italic';
src: url("Inter-italic.var.woff2?v=3.19") format("woff2");
}


/* --------------------------------------------------------------------------
[EXPERIMENTAL] Multi-axis, single variable font.
Slant axis is not yet widely supported (as of February 2019) and thus this
multi-axis single variable font is opt-in rather than the default.
When using this, you will probably need to set font-variation-settings
explicitly, e.g.
* { font-variation-settings: "slnt" 0deg }
.italic { font-variation-settings: "slnt" 10deg }
*/
@font-face {
font-family: 'Inter var experimental';
font-weight: 100 900;
font-display: swap;
font-style: oblique 0deg 10deg;
src: url("Inter.var.woff2?v=3.19") format("woff2");
}
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export default (
strategy: findEmojiEntities,
component: Emoji,
},
trigger: /\B:([-+\w]+)$/,
trigger: /\B:([-+\w]{2,})$/,
resourceType: EmojiResourceType,
onSelected: (emoji: EmojiSuggestionType, editorState: EditorState) =>
addEmoji(emoji, editorState),
Expand Down
Loading

0 comments on commit 298b3c3

Please sign in to comment.