Skip to content

Commit 9d78140

Browse files
jainkuniyagnprice
authored andcommitted
emoji: Rename type RealmEmojiType to ImageEmojiType.
Zulip also supports "Zulip extra emoji". These are very similar to realm emoji, and we'll group them together under the name of "image emoji". Thus this renaming will help us in managing Zulip extra emojis in the similar way we handle realm emoji. Mark `author` as optional. We aren't using it anywhere. This marking it as optional will include Zulip extra emoji also in this category.
1 parent 2cdd301 commit 9d78140

File tree

7 files changed

+17
-17
lines changed

7 files changed

+17
-17
lines changed

src/api/modelTypes.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
//
1313
//
1414

15-
export type RealmEmojiType = $ReadOnly<{|
16-
author: $ReadOnly<{|
15+
export type ImageEmojiType = $ReadOnly<{|
16+
author?: $ReadOnly<{|
1717
email: string,
1818
full_name: string,
1919
id: number,
@@ -28,7 +28,7 @@ export type RealmEmojiType = $ReadOnly<{|
2828
|}>;
2929

3030
export type RealmEmojiById = $ReadOnly<{
31-
[id: string]: RealmEmojiType,
31+
[id: string]: ImageEmojiType,
3232
}>;
3333

3434
export type RealmFilter = [string, string, number];

src/emoji/EmojiRow.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import React, { PureComponent } from 'react';
33
import { connect } from 'react-redux';
44
import { StyleSheet, View } from 'react-native';
55

6-
import type { GlobalState, RealmEmojiType } from '../types';
6+
import type { GlobalState, ImageEmojiType } from '../types';
77
import { RawLabel, Touchable } from '../common';
88
import Emoji from './Emoji';
99
import RealmEmoji from './RealmEmoji';
@@ -22,7 +22,7 @@ const styles = StyleSheet.create({
2222

2323
type Props = {|
2424
name: string,
25-
realmEmoji: RealmEmojiType | void,
25+
realmEmoji: ImageEmojiType | void,
2626
onPress: (name: string) => void,
2727
|};
2828

src/emoji/RealmEmoji.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import React, { PureComponent } from 'react';
44
import { StyleSheet, Image } from 'react-native';
55

6-
import type { RealmEmojiType } from '../types';
6+
import type { ImageEmojiType } from '../types';
77

88
const styles = StyleSheet.create({
99
image: {
@@ -13,7 +13,7 @@ const styles = StyleSheet.create({
1313
});
1414

1515
type Props = {|
16-
emoji: RealmEmojiType,
16+
emoji: ImageEmojiType,
1717
|};
1818

1919
export default class RealmEmoji extends PureComponent<Props> {

src/emoji/data.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* @flow strict-local */
22
import 'string.fromcodepoint'; // eslint-disable-line spellcheck/spell-checker
33

4-
import type { RealmEmojiType } from '../types';
4+
import type { ImageEmojiType } from '../types';
55
import { unicodeCodeByName, override } from './codePointMap';
66

77
const unicodeEmojiNames = Object.keys(unicodeCodeByName);
@@ -26,7 +26,7 @@ export const codeToEmojiMap = unicodeEmojiNames.reduce((obj, name) => {
2626

2727
export const getFilteredEmojiNames = (
2828
query: string,
29-
activeRealmEmojiByName: $ReadOnly<{ [string]: RealmEmojiType }>,
29+
activeRealmEmojiByName: $ReadOnly<{ [string]: ImageEmojiType }>,
3030
): string[] => {
3131
const names = [...unicodeEmojiNames, ...Object.keys(activeRealmEmojiByName)];
3232
return Array.from(new Set([...names.filter(x => x.indexOf(query) === 0).sort()]));

src/emoji/emojiSelectors.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* @flow strict-local */
22
import { createSelector } from 'reselect';
3-
import type { Selector, RealmEmojiById, RealmEmojiType } from '../types';
3+
import type { Selector, RealmEmojiById, ImageEmojiType } from '../types';
44
import { getRawRealmEmoji } from '../directSelectors';
55
import { getIdentity } from '../account/accountsSelectors';
66
import { getFullUrl } from '../utils/url';
@@ -26,7 +26,7 @@ export const getActiveRealmEmojiById: Selector<RealmEmojiById> = createSelector(
2626
}, {}),
2727
);
2828

29-
export const getAllRealmEmojiByName: Selector<{ [string]: RealmEmojiType }> = createSelector(
29+
export const getAllRealmEmojiByName: Selector<{ [string]: ImageEmojiType }> = createSelector(
3030
getAllRealmEmojiById,
3131
emojis =>
3232
Object.keys(emojis).reduce((result, id) => {
@@ -35,7 +35,7 @@ export const getAllRealmEmojiByName: Selector<{ [string]: RealmEmojiType }> = cr
3535
}, {}),
3636
);
3737

38-
export const getActiveRealmEmojiByName: Selector<{ [string]: RealmEmojiType }> = createSelector(
38+
export const getActiveRealmEmojiByName: Selector<{ [string]: ImageEmojiType }> = createSelector(
3939
getActiveRealmEmojiById,
4040
emojis =>
4141
Object.keys(emojis).reduce((result, id) => {

src/webview/MessageList.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import type {
1818
Message,
1919
MuteState,
2020
Narrow,
21-
RealmEmojiType,
21+
ImageEmojiType,
2222
RenderedSectionDescriptor,
2323
Subscription,
2424
ThemeName,
@@ -68,7 +68,7 @@ export type BackgroundData = $ReadOnly<{
6868
flags: FlagsState,
6969
mute: MuteState,
7070
ownEmail: string,
71-
allRealmEmojiById: $ReadOnly<{ [id: string]: RealmEmojiType }>,
71+
allRealmEmojiById: $ReadOnly<{ [id: string]: ImageEmojiType }>,
7272
twentyFourHourTime: boolean,
7373
subscriptions: Subscription[],
7474
}>;

src/webview/html/messageAsHtml.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import type {
77
Message,
88
Outbox,
99
Reaction,
10-
RealmEmojiType,
10+
ImageEmojiType,
1111
} from '../../types';
1212
import type { BackgroundData } from '../MessageList';
1313
import { getAvatarFromMessage } from '../../utils/avatar';
@@ -30,7 +30,7 @@ const messageTagsAsHtml = (isStarred: boolean, timeEdited: number | void): strin
3030

3131
const messageReactionAsHtml = (
3232
reaction: AggregatedReaction,
33-
allRealmEmojiById: $ReadOnly<{ [id: string]: RealmEmojiType }>,
33+
allRealmEmojiById: $ReadOnly<{ [id: string]: ImageEmojiType }>,
3434
): string =>
3535
template`<span onClick="" class="reaction${reaction.selfReacted ? ' self-voted' : ''}"
3636
data-name="${reaction.name}"
@@ -44,7 +44,7 @@ const messageReactionAsHtml = (
4444
const messageReactionListAsHtml = (
4545
reactions: $ReadOnlyArray<Reaction>,
4646
ownEmail: string,
47-
allRealmEmojiById: $ReadOnly<{ [id: string]: RealmEmojiType }>,
47+
allRealmEmojiById: $ReadOnly<{ [id: string]: ImageEmojiType }>,
4848
): string => {
4949
if (reactions.length === 0) {
5050
return '';

0 commit comments

Comments
 (0)