forked from mystiq/hydrogen-web
Move threading relation type const to relations.js
This commit is contained in:
parent
38781db858
commit
f44fa775de
3 changed files with 7 additions and 8 deletions
|
@ -16,9 +16,9 @@ limitations under the License.
|
||||||
|
|
||||||
import {BaseEntry} from "./BaseEntry";
|
import {BaseEntry} from "./BaseEntry";
|
||||||
import {REDACTION_TYPE} from "../../common.js";
|
import {REDACTION_TYPE} from "../../common.js";
|
||||||
import {createAnnotation, ANNOTATION_RELATION_TYPE, getRelationFromContent} from "../relations.js";
|
import {createAnnotation, ANNOTATION_RELATION_TYPE, THREADING_RELATION_TYPE, getRelationFromContent} from "../relations.js";
|
||||||
import {PendingAnnotation} from "../PendingAnnotation.js";
|
import {PendingAnnotation} from "../PendingAnnotation.js";
|
||||||
import {createReplyContent, THREADING_REL_TYPE} from "./reply.js"
|
import {createReplyContent} from "./reply.js";
|
||||||
|
|
||||||
/** Deals mainly with local echo for relations and redactions,
|
/** Deals mainly with local echo for relations and redactions,
|
||||||
* so it is shared between PendingEventEntry and EventEntry */
|
* so it is shared between PendingEventEntry and EventEntry */
|
||||||
|
@ -36,7 +36,7 @@ export class BaseEventEntry extends BaseEntry {
|
||||||
}
|
}
|
||||||
|
|
||||||
get isThread() {
|
get isThread() {
|
||||||
return this.relation?.["rel_type"] === THREADING_REL_TYPE;
|
return this.relation?.["rel_type"] === THREADING_RELATION_TYPE;
|
||||||
}
|
}
|
||||||
|
|
||||||
get isRedacting() {
|
get isRedacting() {
|
||||||
|
|
|
@ -14,9 +14,7 @@ See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {getRelatedEventId} from "../relations.js";
|
import {getRelatedEventId, THREADING_RELATION_TYPE} from "../relations.js";
|
||||||
|
|
||||||
export const THREADING_REL_TYPE = "io.element.thread";
|
|
||||||
|
|
||||||
function htmlEscape(string) {
|
function htmlEscape(string) {
|
||||||
return string.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
return string.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
||||||
|
@ -54,7 +52,7 @@ function _createReplyContent(targetId, msgtype, body, formattedBody, threadId) {
|
||||||
};
|
};
|
||||||
if (threadId) {
|
if (threadId) {
|
||||||
Object.assign(reply["m.relates_to"], {
|
Object.assign(reply["m.relates_to"], {
|
||||||
rel_type: THREADING_REL_TYPE,
|
rel_type: THREADING_RELATION_TYPE,
|
||||||
event_id: threadId,
|
event_id: threadId,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -93,7 +91,7 @@ function createThreadContent(entry, msgtype, body) {
|
||||||
msgtype,
|
msgtype,
|
||||||
body,
|
body,
|
||||||
"m.relates_to": {
|
"m.relates_to": {
|
||||||
"rel_type": THREADING_REL_TYPE,
|
"rel_type": THREADING_RELATION_TYPE,
|
||||||
"event_id": getRelatedEventId(entry)
|
"event_id": getRelatedEventId(entry)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -18,6 +18,7 @@ import {REDACTION_TYPE} from "../common.js";
|
||||||
|
|
||||||
export const REACTION_TYPE = "m.reaction";
|
export const REACTION_TYPE = "m.reaction";
|
||||||
export const ANNOTATION_RELATION_TYPE = "m.annotation";
|
export const ANNOTATION_RELATION_TYPE = "m.annotation";
|
||||||
|
export const THREADING_RELATION_TYPE = "io.element.thread";
|
||||||
|
|
||||||
export function createAnnotation(targetId, key) {
|
export function createAnnotation(targetId, key) {
|
||||||
return {
|
return {
|
||||||
|
|
Loading…
Reference in a new issue