Skip to content

Commit 365f464

Browse files
committed
frontend/projects: be careful what you get from COMPUTE_STATES
1 parent 8c493fa commit 365f464

File tree

1 file changed

+6
-4
lines changed
  • src/packages/frontend/projects

1 file changed

+6
-4
lines changed

src/packages/frontend/projects/util.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ import {
77
cmp_Date,
88
} from "@cocalc/util/misc";
99
import { webapp_client } from "../webapp-client";
10-
import { COMPUTE_STATES } from "@cocalc/util/compute-states";
10+
import { COMPUTE_STATES, ComputeState } from "@cocalc/util/compute-states";
11+
import { isIntlMessage } from "../i18n";
1112

1213
function parse_tags(info): string[] {
1314
const indices = parse_hashtags(info);
@@ -38,9 +39,10 @@ function get_search_info(project_id, project, user_map): string {
3839
if (desc != "No description") {
3940
s += " " + desc;
4041
}
41-
s +=
42-
" " +
43-
(COMPUTE_STATES[project.getIn(["state", "state"], "")]?.display ?? "");
42+
const compute_state: ComputeState =
43+
COMPUTE_STATES[project.getIn(["state", "state"], "")];
44+
const display = compute_state?.display;
45+
s += " " + (isIntlMessage(display) ? display.defaultMessage : display ?? "");
4446
s = s.toLowerCase();
4547
s = s + " " + hashtags_to_string(parse_tags(s));
4648
if (user_map != null) {

0 commit comments

Comments
 (0)