Skip to content

Commit

Permalink
Eik/UI features account div1 (element-hq#45)
Browse files Browse the repository at this point in the history
* 1898 New Ui-features (Accountdata)
1899 New Ui-features (div1)

* 1898 New Ui-features (Accountdata)
1899 New Ui-features (div1)

* 1898 New Ui-features (Accountdata)
1899 New Ui-features (div1)

* 1898 New Ui-features (Accountdata)
1899 New Ui-features (div1)

* 1902 New Ui-features (div2)

* 1902 New Ui-features (div2)

* 1902 New Ui-features (div2)

* 1902 New Ui-features (div3)

* 1902 New Ui-features (div3)

* 1902 New Ui-features (div4)

* 1902 New Ui-features (div4)

* 1902 New Ui-features (div4)

* 1902 New Ui-features (div4), test to fix matrix tests

* 1902 New Ui-features (div4), test to fix matrix tests

* 1914 New Ui-features (div5)

* 1914 New Ui-features (div5)

* 1914 New Ui-features (div5)

* 1914 New Ui-features (div5)

* 1914 New Ui-features (div5)

* 1914 New Ui-features (div5)

* 1914 New Ui-features (div5)

* new uifeature account div1 checking

* new uifeature account div1 checkin

* new uifeature account div1 checkin

* new uifeature account div1 checkin

* new uifeature account div1 checkin

* new uifeature account div1 checkin

* new uifeature account div1 checkin

* new uifeature account div1 checkin

* new uifeature account div1 , the rest

* 1928 - verji changes/additions

* 1939 - verji changes/additions

* 1928 - verji changes/additions

* 1941 - verji changes/additions

* 1941 - verji changes/additions

* 1941 - verji changes/additions

* 1941 - verji changes/additions

* 1941 - verji changes/additions

* 1941 - verji changes/additions

* 1941 - verji changes/additions

* verji changes/additions

* verji changes/additions, translations

* verji changes/additions, translations

* verji changes/additions, translations

* verji changes/additions, translations
  • Loading branch information
eiksta authored Jun 5, 2024
1 parent 99338d8 commit 102b57e
Show file tree
Hide file tree
Showing 23 changed files with 302 additions and 90 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@
"react-focus-lock": "^2.5.1",
"react-transition-group": "^4.4.1",
"rfc4648": "^1.4.0",
"rss-parser": "^3.12.0",
"sanitize-filename": "^1.6.3",
"sanitize-html": "2.13.0",
"tar-js": "^0.3.0",
Expand Down
1 change: 1 addition & 0 deletions res/css/structures/_HomePage.pcss
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ limitations under the License.
height: 100%;
margin-left: auto;
margin-right: auto;
max-height: 100%;
}

.mx_HomePage_default {
Expand Down
11 changes: 11 additions & 0 deletions res/css/structures/_LeftPanel.pcss
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,8 @@ limitations under the License.
}
}

.mx_LeftPanel_omButton,
.mx_LeftPanel_newsButton,
.mx_LeftPanel_exploreButton,
.mx_LeftPanel_recentsButton {
width: 32px;
Expand Down Expand Up @@ -179,6 +181,15 @@ limitations under the License.
}
}

//Verji start
.mx_LeftPanel_newsButton::before {
mask-image: url("$(res)/img/verji/news.svg");
}
.mx_LeftPanel_omButton::before {
mask-image: url("$(res)/img/verji/shield.svg");
}
//Verji end

.mx_LeftPanel_exploreButton::before {
mask-image: url("$(res)/img/element-icons/roomlist/explore.svg");
}
Expand Down
26 changes: 26 additions & 0 deletions res/css/structures/_RoomView.pcss
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,32 @@ limitations under the License.
margin-bottom: 80px; /* visually center the content (intentional offset) */
}

// Verji start
@keyframes fade1 {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}
.mx_RoomView_News1 {
animation: 0.2s ease-out 0s 0.2 fade1;
}

@keyframes fade2 {
0% {
transform: translateX(70px);
}
100% {
transform: translateX(0);
}
}
.mx_RoomView_News2 {
animation: 0.2s ease 0s 0.2 fade2;
}
// Verji end

.mx_RoomView_MessageList {
list-style-type: none;
padding: var(--RoomView_MessageList-padding); /* mx_ProfileResizer depends on this value */
Expand Down
2 changes: 1 addition & 1 deletion res/css/views/elements/_Tooltip.pcss
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ limitations under the License.
line-height: $font-14px;
font-size: $font-12px;
font-weight: 500;
max-width: 300px;
max-width: 320px;
word-break: break-word;

background-color: var(--cpd-color-alpha-gray-1400);
Expand Down
6 changes: 6 additions & 0 deletions res/css/views/rooms/_NotificationBadge.pcss
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ limitations under the License.
align-items: center;
justify-content: center;

//Verji start
&.mx_NotificationBadge_green {
background-color: $accent;
}
// Verji end

/* These are the 3 background types */

&.mx_NotificationBadge_dot {
Expand Down
4 changes: 3 additions & 1 deletion src/LegacyCallHandler.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -991,7 +991,9 @@ export default class LegacyCallHandler extends EventEmitter {
await this.placeMatrixCall(roomId, type, transferee);
} else {
// > 2
await this.placeJitsiCall(roomId, type);
if (SettingsStore.getValue(UIFeature.MultipleCallsInRoom)) {
await this.placeJitsiCall(roomId, type);
}
}
}

Expand Down
1 change: 1 addition & 0 deletions src/Roles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export function levelRoleMap(usersDefault: number): Record<number | "undefined",
0: _t("power_level|restricted"),
[usersDefault]: _t("power_level|default"),
50: _t("power_level|moderator"),
95: "VerjiAdmin", //Verji
100: _t("power_level|admin"),
};
}
Expand Down
15 changes: 15 additions & 0 deletions src/components/structures/LoggedInView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ class LoggedInView extends React.Component<IProps, IState> {
OwnProfileStore.instance.on(UPDATE_EVENT, this.refreshBackgroundImage);
this.loadResizerPreferences();
this.refreshBackgroundImage();
this.attachFreshworksWidget(); //Verji
}

public componentWillUnmount(): void {
Expand All @@ -215,6 +216,20 @@ class LoggedInView extends React.Component<IProps, IState> {
this.resizer?.detach();
}

// Verji start
private attachFreshworksWidget(): void {
const head = document.querySelector("head");
const script = document.createElement("script");
const scriptExt = document.createElement("script");
script.setAttribute("src", "./scripts/freshworks.js");
scriptExt.setAttribute("src", "https://euc-widget.freshworks.com/widgets/80000004505.js");
scriptExt.async = true;
scriptExt.defer = true;
head?.appendChild(script);
head?.appendChild(scriptExt);
}
// Verji end

private onCallState = (): void => {
const activeCalls = LegacyCallHandler.instance.getAllActiveCalls();
if (activeCalls === this.state.activeCalls) return;
Expand Down
20 changes: 13 additions & 7 deletions src/components/structures/ViewSource.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { MatrixEvent } from "matrix-js-sdk/src/matrix";
import SyntaxHighlight from "../views/elements/SyntaxHighlight";
import { _t } from "../../languageHandler";
import MatrixClientContext from "../../contexts/MatrixClientContext";
import { canEditContent } from "../../utils/EventUtils";
// import { canEditContent } from "../../utils/EventUtils"; //Verji
import { MatrixClientPeg } from "../../MatrixClientPeg";
import BaseDialog from "../views/dialogs/BaseDialog";
import { DevtoolsContext } from "../views/dialogs/devtools/BaseTool";
Expand Down Expand Up @@ -155,9 +155,9 @@ export default class ViewSource extends React.Component<IProps, IState> {
const isEditing = this.state.isEditing;
const roomId = mxEvent.getRoomId()!;
const eventId = mxEvent.getId()!;
const canEdit = mxEvent.isState()
? this.canSendStateEvent(mxEvent)
: canEditContent(MatrixClientPeg.safeGet(), this.props.mxEvent);
// const canEdit = mxEvent.isState() //Verji
// ? this.canSendStateEvent(mxEvent)
// : canEditContent(MatrixClientPeg.safeGet(), this.props.mxEvent);
return (
<BaseDialog className="mx_ViewSource" onFinished={this.props.onFinished} title={_t("action|view_source")}>
<div className="mx_ViewSource_header">
Expand All @@ -176,11 +176,17 @@ export default class ViewSource extends React.Component<IProps, IState> {
)}
</div>
{isEditing ? this.editSourceContent() : this.viewSourceContent()}
{!isEditing && canEdit && (
{/* NOTE: Verji - Removed the Edit button as we have no use for it at the moment. */}
{/* {!isEditing && canEdit && (
<div className="mx_Dialog_buttons">
<button onClick={() => this.onEdit()}>{_t("action|edit")}</button>
<button onClick={() => this.onEdit()}>{_t("Edit")}</button>
</div>
)}
)} */}

<div className="mx_Dialog_buttons">
<button onClick={() => this.onEdit()}>{_t("action|edit")}</button>
</div>
{/* Verji end */}
</BaseDialog>
);
}
Expand Down
102 changes: 64 additions & 38 deletions src/components/views/context_menus/MessageContextMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import {
Relations,
Thread,
M_POLL_START,
EventTimeline,
} from "matrix-js-sdk/src/matrix";

import { MatrixClientPeg } from "../../../MatrixClientPeg";
Expand Down Expand Up @@ -168,18 +169,36 @@ export default class MessageContextMenu extends React.Component<IProps, IState>
private checkPermissions = (): void => {
const cli = MatrixClientPeg.safeGet();
const room = cli.getRoom(this.props.mxEvent.getRoomId());
const roomState = room?.getLiveTimeline().getState(EventTimeline.FORWARDS); // Verji

// We explicitly decline to show the redact option on ACL events as it has a potential
// to obliterate the room - https://github.com/matrix-org/synapse/issues/4042
// Similarly for encryption events, since redacting them "breaks everything"
// Verji start, adds more events to prevent redact
let redactable = true;
if (
this.props.mxEvent?.event?.type?.includes(".avatar") ||
this.props.mxEvent?.event?.type?.includes(".topic") ||
this.props.mxEvent.getType() === EventType.RoomMember ||
this.props.mxEvent.getType() === EventType.RoomJoinRules ||
this.props.mxEvent.getType() === EventType.RoomPowerLevels ||
this.props.mxEvent.getType() === EventType.RoomHistoryVisibility ||
this.props.mxEvent.getType() === EventType.RoomGuestAccess ||
this.props.mxEvent.getType() === EventType.RoomName ||
this.props.mxEvent.getType() === EventType.RoomTopic
) {
redactable = false;
}
const canRedact =
//!!roomState?.maySendRedactionForEvent(this.props.mxEvent, cli.getSafeUserId()) &&
!!room?.currentState.maySendRedactionForEvent(this.props.mxEvent, cli.getSafeUserId()) &&
this.props.mxEvent.getType() !== EventType.RoomServerAcl &&
this.props.mxEvent.getType() !== EventType.RoomEncryption;
this.props.mxEvent.getType() !== EventType.RoomEncryption &&
redactable;
//Verji end

let canPin =
!!room?.currentState.mayClientSendStateEvent(EventType.RoomPinnedEvents, cli) &&
canPinEvent(this.props.mxEvent);
!!roomState?.mayClientSendStateEvent(EventType.RoomPinnedEvents, cli) && canPinEvent(this.props.mxEvent);

// HACK: Intentionally say we can't pin if the user doesn't want to use the functionality
if (!SettingsStore.getValue("feature_pinning")) canPin = false;
Expand All @@ -189,16 +208,19 @@ export default class MessageContextMenu extends React.Component<IProps, IState>

private isPinned(): boolean {
const room = MatrixClientPeg.safeGet().getRoom(this.props.mxEvent.getRoomId());
const pinnedEvent = room?.currentState.getStateEvents(EventType.RoomPinnedEvents, "");
const roomState = room?.getLiveTimeline().getState(EventTimeline.FORWARDS); // Verji
const pinnedEvent = roomState?.getStateEvents(EventType.RoomPinnedEvents, "");
if (!pinnedEvent) return false;
const content = pinnedEvent.getContent();
return content.pinned && Array.isArray(content.pinned) && content.pinned.includes(this.props.mxEvent.getId());
}

private canEndPoll(mxEvent: MatrixEvent): boolean {
// ROSBERG isMyEvent to overide verji strict canRedact rules - in case where ender of the poll is the owner of the poll
const isMyEvent = mxEvent.sender?.userId === MatrixClientPeg.safeGet().getSafeUserId();
return (
M_POLL_START.matches(mxEvent.getType()) &&
this.state.canRedact &&
(this.state.canRedact || isMyEvent) && // Verji - evaluates to true if you are admin OR the event is yours
!isPollEnded(mxEvent, MatrixClientPeg.safeGet())
);
}
Expand Down Expand Up @@ -382,15 +404,15 @@ export default class MessageContextMenu extends React.Component<IProps, IState>

public render(): React.ReactNode {
const cli = MatrixClientPeg.safeGet();
const me = cli.getUserId();
// const me = cli.getUserId(); //Verji
const { mxEvent, rightClick, link, eventTileOps, reactions, collapseReplyChain, ...other } = this.props;
delete other.getRelationsForEvent;
delete other.permalinkCreator;

const eventStatus = mxEvent.status;
const unsentReactionsCount = this.getUnsentReactions().length;
const contentActionable = isContentActionable(mxEvent);
const permalink = this.props.permalinkCreator?.forEvent(this.props.mxEvent.getId()!);
// const permalink = this.props.permalinkCreator?.forEvent(this.props.mxEvent.getId()!); //Verji
// status is SENT before remote-echo, null after
const isSent = !eventStatus || eventStatus === EventStatus.SENT;
const { timelineRenderingType, canReact, canSendMessages } = this.context;
Expand Down Expand Up @@ -483,25 +505,27 @@ export default class MessageContextMenu extends React.Component<IProps, IState>
);
}

let permalinkButton: JSX.Element | undefined;
if (permalink) {
permalinkButton = (
<IconizedContextMenuOption
iconClassName="mx_MessageContextMenu_iconPermalink"
onClick={this.onShareClick}
label={_t("action|share")}
element="a"
{
// XXX: Typescript signature for AccessibleButton doesn't work properly for non-inputs like `a`
...{
href: permalink,
target: "_blank",
rel: "noreferrer noopener",
}
}
/>
);
}
// Verji start
// let permalinkButton: JSX.Element | undefined;
// if (permalink) {
// permalinkButton = (
// <IconizedContextMenuOption
// iconClassName="mx_MessageContextMenu_iconPermalink"
// onClick={this.onShareClick}
// label={_t("action|share")}
// element="a"
// {
// // XXX: Typescript signature for AccessibleButton doesn't work properly for non-inputs like `a`
// ...{
// href: permalink,
// target: "_blank",
// rel: "noreferrer noopener",
// }
// }
// />
// );
// }
// Verji end

let endPollButton: JSX.Element | undefined;
if (this.canEndPoll(mxEvent)) {
Expand Down Expand Up @@ -561,16 +585,18 @@ export default class MessageContextMenu extends React.Component<IProps, IState>
);
}

let reportEventButton: JSX.Element | undefined;
if (mxEvent.getSender() !== me) {
reportEventButton = (
<IconizedContextMenuOption
iconClassName="mx_MessageContextMenu_iconReport"
label={_t("timeline|context_menu|report")}
onClick={this.onReportEventClick}
/>
);
}
// Verji start
// let reportEventButton: JSX.Element | undefined;
// if (mxEvent.getSender() !== me) {
// reportEventButton = (
// <IconizedContextMenuOption
// iconClassName="mx_MessageContextMenu_iconReport"
// label={_t("timeline|context_menu|report")}
// onClick={this.onReportEventClick}
// />
// );
// }
// Verji end

let copyLinkButton: JSX.Element | undefined;
if (link) {
Expand Down Expand Up @@ -689,8 +715,8 @@ export default class MessageContextMenu extends React.Component<IProps, IState>
{endPollButton}
{forwardButton}
{pinButton}
{permalinkButton}
{reportEventButton}
{/*Verji removed {permalinkButton} */}
{/*Verji removed {reportEventButton} */}
{externalURLButton}
{jumpToRelatedEventButton}
{unhidePreviewButton}
Expand Down
2 changes: 1 addition & 1 deletion src/components/views/dialogs/LogoutDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export default class LogoutDialog extends React.Component<IProps, IState> {
};

// we can't call setState() immediately, so wait a beat
window.setTimeout(() => this.startLoadBackupStatus(), 0);
//window.setTimeout(() => this.startLoadBackupStatus(), 0); //Verji
}

/** kick off the asynchronous calls to populate `state.backupStatus` in the background */
Expand Down
Loading

0 comments on commit 102b57e

Please sign in to comment.