forked from mystiq/hydrogen-web
Refactor code
This commit is contained in:
parent
9eeeea47d9
commit
78c79b148a
2 changed files with 8 additions and 4 deletions
|
@ -18,7 +18,7 @@ import {BaseEntry} from "./BaseEntry";
|
|||
import {REDACTION_TYPE} from "../../common.js";
|
||||
import {createAnnotation, ANNOTATION_RELATION_TYPE, getRelationFromContent} from "../relations.js";
|
||||
import {PendingAnnotation} from "../PendingAnnotation.js";
|
||||
import {createReplyContent} from "./reply.js"
|
||||
import {createReplyContent, THREADING_REL_TYPE} from "./reply.js"
|
||||
|
||||
/** Deals mainly with local echo for relations and redactions,
|
||||
* so it is shared between PendingEventEntry and EventEntry */
|
||||
|
@ -36,7 +36,7 @@ export class BaseEventEntry extends BaseEntry {
|
|||
}
|
||||
|
||||
get isThread() {
|
||||
return this.relation?.["rel_type"] === "io.element.thread";
|
||||
return this.relation?.["rel_type"] === THREADING_REL_TYPE;
|
||||
}
|
||||
|
||||
get isRedacting() {
|
||||
|
|
|
@ -14,6 +14,10 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
import {getRelatedEventId} from "../relations.js";
|
||||
|
||||
export const THREADING_REL_TYPE = "io.element.thread";
|
||||
|
||||
function htmlEscape(string) {
|
||||
return string.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
||||
}
|
||||
|
@ -81,8 +85,8 @@ function createThreadContent(entry, msgtype, body) {
|
|||
msgtype,
|
||||
body,
|
||||
"m.relates_to": {
|
||||
"rel_type": "m.thread",
|
||||
"event_id": entry.id
|
||||
"rel_type": THREADING_REL_TYPE,
|
||||
"event_id": getRelatedEventId(entry)
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue