mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2026-04-02 00:07:56 +01:00
Remove poll feature flag gates
Co-authored-by: yash-signal <yash@signal.org>
This commit is contained in:
@@ -1 +0,0 @@
|
||||
<svg width="20" height="20" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M15.809 3.355c.727.72.727 1.883 0 2.603l-7.051 6.974a.581.581 0 0 1-.814 0 .548.548 0 0 1 0-.783l4.752-4.7a.73.73 0 1 0-1.026-1.037l-4.751 4.7a2.006 2.006 0 0 0 0 2.857 2.04 2.04 0 0 0 2.865 0l7.05-6.975a3.283 3.283 0 0 0 0-4.675 3.35 3.35 0 0 0-4.704 0l-8.583 8.49a4.56 4.56 0 0 0 0 6.496 4.661 4.661 0 0 0 6.543 0l6.284-6.217a.73.73 0 0 0-1.025-1.037l-6.284 6.217a3.203 3.203 0 0 1-4.493 0 3.101 3.101 0 0 1 0-4.422l8.584-8.49a1.892 1.892 0 0 1 2.653 0Z" fill="#000"/></svg>
|
||||
|
Before Width: | Height: | Size: 560 B |
@@ -249,44 +249,4 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&__attach-file {
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
border-radius: 4px;
|
||||
padding: 0;
|
||||
border: none;
|
||||
background: transparent;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
@include mixins.keyboard-mode {
|
||||
&:focus {
|
||||
outline: 2px solid variables.$color-ultramarine;
|
||||
}
|
||||
}
|
||||
|
||||
outline: none;
|
||||
|
||||
&:before {
|
||||
content: '';
|
||||
display: inline-block;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
|
||||
@include mixins.light-theme {
|
||||
@include mixins.color-svg(
|
||||
'../images/icons/v3/attach/attach.svg',
|
||||
variables.$color-gray-75
|
||||
);
|
||||
}
|
||||
@include mixins.dark-theme {
|
||||
@include mixins.color-svg(
|
||||
'../images/icons/v3/attach/attach.svg',
|
||||
variables.$color-gray-15
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -71,12 +71,6 @@ const ScalarKeys = [
|
||||
'desktop.retryRespondMaxAge',
|
||||
'desktop.senderKey.retry',
|
||||
'desktop.senderKeyMaxAge',
|
||||
'desktop.pollReceive.alpha',
|
||||
'desktop.pollReceive.beta1',
|
||||
'desktop.pollReceive.prod1',
|
||||
'desktop.pollSend.alpha',
|
||||
'desktop.pollSend.beta',
|
||||
'desktop.pollSend.prod',
|
||||
'desktop.recentGifs.allowLegacyTenorCdnUrls',
|
||||
'global.attachments.maxBytes',
|
||||
'global.attachments.maxReceiveBytes',
|
||||
|
||||
@@ -67,11 +67,7 @@ import { RoutineProfileRefresher } from './routineProfileRefresh.preload.js';
|
||||
import { isOlderThan } from './util/timestamp.std.js';
|
||||
import { isValidReactionEmoji } from './reactions/isValidReactionEmoji.std.js';
|
||||
import { safeParsePartial } from './util/schemas.std.js';
|
||||
import {
|
||||
PollVoteSchema,
|
||||
PollTerminateSchema,
|
||||
isPollReceiveEnabled,
|
||||
} from './types/Polls.dom.js';
|
||||
import { PollVoteSchema, PollTerminateSchema } from './types/Polls.dom.js';
|
||||
import type { ConversationModel } from './models/conversations.preload.js';
|
||||
import { isIncoming } from './messages/helpers.std.js';
|
||||
import { getAuthor } from './messages/sources.preload.js';
|
||||
@@ -2519,11 +2515,6 @@ export async function startApp(): Promise<void> {
|
||||
}
|
||||
|
||||
if (data.message.pollVote) {
|
||||
if (!isPollReceiveEnabled()) {
|
||||
log.warn('Dropping PollVote because the flag is disabled');
|
||||
confirm();
|
||||
return;
|
||||
}
|
||||
const { pollVote, timestamp } = data.message;
|
||||
|
||||
const parsed = safeParsePartial(PollVoteSchema, pollVote);
|
||||
@@ -2561,11 +2552,6 @@ export async function startApp(): Promise<void> {
|
||||
}
|
||||
|
||||
if (data.message.pollTerminate) {
|
||||
if (!isPollReceiveEnabled()) {
|
||||
log.warn('Dropping PollTerminate because the flag is disabled');
|
||||
confirm();
|
||||
return;
|
||||
}
|
||||
const { pollTerminate, timestamp, expireTimer } = data.message;
|
||||
|
||||
const parsedTerm = safeParsePartial(PollTerminateSchema, pollTerminate);
|
||||
@@ -3029,11 +3015,6 @@ export async function startApp(): Promise<void> {
|
||||
}
|
||||
|
||||
if (data.message.pollVote) {
|
||||
if (!isPollReceiveEnabled()) {
|
||||
log.warn('Dropping PollVote because the flag is disabled');
|
||||
confirm();
|
||||
return;
|
||||
}
|
||||
const { pollVote, timestamp } = data.message;
|
||||
|
||||
const parsed = safeParsePartial(PollVoteSchema, pollVote);
|
||||
@@ -3074,11 +3055,6 @@ export async function startApp(): Promise<void> {
|
||||
}
|
||||
|
||||
if (data.message.pollTerminate) {
|
||||
if (!isPollReceiveEnabled()) {
|
||||
log.warn('Dropping PollTerminate because the flag is disabled');
|
||||
confirm();
|
||||
return;
|
||||
}
|
||||
const { pollTerminate, timestamp, expireTimer } = data.message;
|
||||
|
||||
const parsedTerm = safeParsePartial(PollTerminateSchema, pollTerminate);
|
||||
|
||||
@@ -87,7 +87,7 @@ import { FunPickerButton } from './fun/FunButton.dom.js';
|
||||
import { AxoDropdownMenu } from '../axo/AxoDropdownMenu.dom.js';
|
||||
import { AxoIconButton } from '../axo/AxoIconButton.dom.js';
|
||||
import { tw } from '../axo/tw.dom.js';
|
||||
import { isPollSendEnabled, type PollCreateType } from '../types/Polls.dom.js';
|
||||
import type { PollCreateType } from '../types/Polls.dom.js';
|
||||
import { PollCreateModal } from './PollCreateModal.dom.js';
|
||||
import { useDocumentKeyDown } from '../hooks/useDocumentKeyDown.dom.js';
|
||||
|
||||
@@ -823,11 +823,8 @@ export const CompositionArea = memo(function CompositionArea({
|
||||
'flex size-8 shrink-0 items-center justify-center'
|
||||
);
|
||||
|
||||
let attButton;
|
||||
if (draftEditMessage || linkPreviewResult || isRecording) {
|
||||
attButton = undefined;
|
||||
} else if (isPollSendEnabled()) {
|
||||
attButton = (
|
||||
const composerAddMenuButton =
|
||||
draftEditMessage || linkPreviewResult || isRecording ? null : (
|
||||
<div className="CompositionArea__button-cell">
|
||||
<AxoDropdownMenu.Root>
|
||||
<div className={actionSlotClassName}>
|
||||
@@ -860,18 +857,6 @@ export const CompositionArea = memo(function CompositionArea({
|
||||
</AxoDropdownMenu.Root>
|
||||
</div>
|
||||
);
|
||||
} else {
|
||||
attButton = (
|
||||
<div className="CompositionArea__button-cell">
|
||||
<button
|
||||
type="button"
|
||||
className="CompositionArea__attach-file"
|
||||
onClick={launchFilePicker}
|
||||
aria-label={i18n('icu:CompositionArea--attach-file')}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
const sendButtonFragment = !draftEditMessage ? (
|
||||
<>
|
||||
@@ -1304,7 +1289,7 @@ export const CompositionArea = memo(function CompositionArea({
|
||||
<>
|
||||
{!dirty ? micButtonFragment : null}
|
||||
{editMessageFragment}
|
||||
{attButton}
|
||||
{composerAddMenuButton}
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
@@ -1316,7 +1301,7 @@ export const CompositionArea = memo(function CompositionArea({
|
||||
)}
|
||||
>
|
||||
{leftHandSideButtonsFragment}
|
||||
{attButton}
|
||||
{composerAddMenuButton}
|
||||
{!dirty ? micButtonFragment : null}
|
||||
{editMessageFragment}
|
||||
{dirty || !shouldShowMicrophone ? sendButtonFragment : null}
|
||||
|
||||
@@ -98,7 +98,6 @@ import { isPaymentNotificationEvent } from '../../types/Payment.std.js';
|
||||
import type { AnyPaymentEvent } from '../../types/Payment.std.js';
|
||||
import { getPaymentEventDescription } from '../../messages/payments.std.js';
|
||||
import { PanelType } from '../../types/Panels.std.js';
|
||||
import { isPollReceiveEnabled } from '../../types/Polls.dom.js';
|
||||
import type { PollWithResolvedVotersType } from '../../state/selectors/message.preload.js';
|
||||
import { PollMessageContents } from './poll-message/PollMessageContents.dom.js';
|
||||
import { openLinkInWebBrowser } from '../../util/openLinkInWebBrowser.dom.js';
|
||||
@@ -2062,7 +2061,7 @@ export class Message extends React.PureComponent<Props, State> {
|
||||
|
||||
public renderPoll(): React.JSX.Element | null {
|
||||
const { poll, direction, i18n, id, endPoll, canEndPoll } = this.props;
|
||||
if (!poll || !isPollReceiveEnabled()) {
|
||||
if (!poll) {
|
||||
return null;
|
||||
}
|
||||
return (
|
||||
|
||||
@@ -68,7 +68,7 @@ import {
|
||||
import { saveAndNotify } from './saveAndNotify.preload.js';
|
||||
import { MessageModel } from '../models/messages.preload.js';
|
||||
import { safeParsePartial } from '../util/schemas.std.js';
|
||||
import { PollCreateSchema, isPollReceiveEnabled } from '../types/Polls.dom.js';
|
||||
import { PollCreateSchema } from '../types/Polls.dom.js';
|
||||
|
||||
import type { SentEventData } from '../textsecure/messageReceiverEvents.std.js';
|
||||
import type {
|
||||
@@ -472,11 +472,6 @@ export async function handleDataMessage(
|
||||
|
||||
let validatedPollCreate: z.infer<typeof PollCreateSchema> | undefined;
|
||||
if (initialMessage.pollCreate) {
|
||||
if (!isPollReceiveEnabled()) {
|
||||
log.warn(`${idLog}: Dropping PollCreate because flag is not enabled`);
|
||||
confirm();
|
||||
return;
|
||||
}
|
||||
const result = safeParsePartial(
|
||||
PollCreateSchema,
|
||||
initialMessage.pollCreate
|
||||
|
||||
@@ -3,13 +3,6 @@
|
||||
|
||||
import { z } from 'zod';
|
||||
import { hasAtMostGraphemes } from '../util/grapheme.std.js';
|
||||
import {
|
||||
Environment,
|
||||
getEnvironment,
|
||||
isMockEnvironment,
|
||||
} from '../environment.std.js';
|
||||
import * as RemoteConfig from '../RemoteConfig.dom.js';
|
||||
import { isAlpha, isBeta, isProduction } from '../util/version.std.js';
|
||||
import { isFeaturedEnabledNoRedux } from '../util/isFeatureEnabled.dom.js';
|
||||
import type { SendStateByConversationId } from '../messages/MessageSendState.std.js';
|
||||
import { aciSchema } from './ServiceId.std.js';
|
||||
@@ -117,64 +110,6 @@ export type PollCreateType = Pick<
|
||||
'question' | 'options' | 'allowMultiple'
|
||||
>;
|
||||
|
||||
export function isPollReceiveEnabled(): boolean {
|
||||
const env = getEnvironment();
|
||||
|
||||
if (
|
||||
env === Environment.Development ||
|
||||
env === Environment.Test ||
|
||||
env === Environment.Staging ||
|
||||
isMockEnvironment()
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const version = window.getVersion?.();
|
||||
|
||||
if (version != null) {
|
||||
if (isProduction(version)) {
|
||||
return RemoteConfig.isEnabled('desktop.pollReceive.prod1');
|
||||
}
|
||||
if (isBeta(version)) {
|
||||
return RemoteConfig.isEnabled('desktop.pollReceive.beta1');
|
||||
}
|
||||
if (isAlpha(version)) {
|
||||
return RemoteConfig.isEnabled('desktop.pollReceive.alpha');
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
export function isPollSendEnabled(): boolean {
|
||||
const env = getEnvironment();
|
||||
|
||||
if (
|
||||
env === Environment.Development ||
|
||||
env === Environment.Test ||
|
||||
env === Environment.Staging ||
|
||||
isMockEnvironment()
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const version = window.getVersion?.();
|
||||
|
||||
if (version != null) {
|
||||
if (isProduction(version)) {
|
||||
return RemoteConfig.isEnabled('desktop.pollSend.prod');
|
||||
}
|
||||
if (isBeta(version)) {
|
||||
return RemoteConfig.isEnabled('desktop.pollSend.beta');
|
||||
}
|
||||
if (isAlpha(version)) {
|
||||
return RemoteConfig.isEnabled('desktop.pollSend.alpha');
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
export function isPollSend1to1Enabled(): boolean {
|
||||
return isFeaturedEnabledNoRedux({
|
||||
betaKey: 'desktop.pollSend1to1.beta',
|
||||
|
||||
@@ -5,7 +5,6 @@ import type { ConversationModel } from '../models/conversations.preload.js';
|
||||
import { isDirectConversation } from './whatTypeOfConversation.dom.js';
|
||||
import {
|
||||
isPollSend1to1Enabled,
|
||||
isPollSendEnabled,
|
||||
type PollCreateType,
|
||||
} from '../types/Polls.dom.js';
|
||||
|
||||
@@ -13,10 +12,6 @@ export async function enqueuePollCreateForSend(
|
||||
conversation: ConversationModel,
|
||||
poll: PollCreateType
|
||||
): Promise<void> {
|
||||
if (!isPollSendEnabled()) {
|
||||
throw new Error('enqueuePollCreateForSend: poll sending is not enabled');
|
||||
}
|
||||
|
||||
if (
|
||||
isDirectConversation(conversation.attributes) &&
|
||||
!isPollSend1to1Enabled()
|
||||
|
||||
Reference in New Issue
Block a user