Squashed commit of the following:
commit 13bca8d5b7344445633ff3c8a162086be8215379
Merge: 1e2782647
ff157b237
Author: Essem <smswessem@gmail.com>
Date: Thu Mar 16 11:51:32 2023 -0500
Merge branch 'feat/emoji_reactions' of https://github.com/neatchee/mastodon into feat/emoji_reactions
commit ff157b2378a15a786763d7e13ad2de4ff223dc03
Author: neatchee <neatchee@gmail.com>
Date: Wed Mar 8 13:27:25 2023 -0800
Remove old .js locale files accidentally restored during rebase
commit 52beb88a19626c0b17d0945a43bf8725ceae4b04
Author: Ivan Rodriguez <104603218+IRod22@users.noreply.github.com>
Date: Tue Mar 7 23:21:32 2023 -0600
Keep emoji picker within screen bounds
Adds the `flip` prop to `<Overlay>`. Fixes #40
commit 7707004cf3d5bacd3ef830ef734dd003b607c2af
Author: neatchee <neatchee@gmail.com>
Date: Thu Jan 26 11:32:03 2023 -0800
Fix rebase issues
commit ce40bbbce1e5e9ab7770f89dd7cffd87d3ceb177
Author: neatchee <neatchee@gmail.com>
Date: Thu Jan 26 10:22:15 2023 -0800
Per PR suggestion, split name and domain, and look for emoji ID, for unreact, so remote emoji's can be unreacted
commit fc9f34a39fa40b3eda4ccfc0cc8e5c028b9ebe79
Author: fef <owo@fef.moe>
Date: Tue Dec 20 17:19:56 2022 +0000
move emoji reaction strings to locales-glitch
commit af0f50ca74631e9f2dafde0f0e08417f906c04a0
Author: Jeremy Kescher <jeremy@kescher.at>
Date: Sun Dec 18 04:23:42 2022 +0100
Fix status reactions preventing an on_cascade delete
commit 2e713c7792438f17ef026f6d79465be25a5fb7db
Author: fef <owo@fef.moe>
Date: Thu Dec 15 15:27:54 2022 +0000
bypass reaction limit for foreign accounts
commit 907e1e490ed9b2373eb18f92af9fda4426274713
Author: fef <owo@fef.moe>
Date: Sun Dec 11 13:26:23 2022 +0000
fix 404 when reacting with Keycap Number Sign
The Unicode sequence for this emoji starts with an
ASCII # character, which the browser's URI parser
truncates before sending the request to the
backend.
commit 9028d3841f7d5d2eb1b06bc210ded055c53fc1d2
Author: fef <owo@fef.moe>
Date: Thu Dec 8 09:48:55 2022 +0000
fix status action bar after upstream changes
commit 4ce5095d8c187947805ecf21c90ad494440e904a
Author: fef <owo@fef.moe>
Date: Wed Dec 7 21:52:53 2022 +0100
fix schema after rebase
commit 63b9e4392adbb13fe0ce71de4d28419df0f36bb1
Author: fef <owo@fef.moe>
Date: Wed Dec 7 12:47:03 2022 +0000
delete reaction notifications when deleting status
commit e407cc12b64a664c66717ce06d65342dd8bc609e
Author: fef <owo@fef.moe>
Date: Wed Dec 7 12:19:36 2022 +0000
support reacting with foreign custom emojis
commit b2dbb4dbe4996426a6cdb90e8da27e5096b3e88c
Author: fef <owo@fef.moe>
Date: Sun Dec 4 12:33:47 2022 +0000
properly disable reactions when not logged in
commit ec790f3b1e243e33ccd22685b8e3c017ca7f9273
Author: fef <owo@fef.moe>
Date: Sun Dec 4 10:52:02 2022 +0000
serialize custom emoji reactions properly for AP
Akkoma and possibly others expect the `tag` field
in an EmojiReact activity to be an array, not just
a single object, so it's being wrapped into one
now. I'm not entirely sure whether this is the
idiomatic way of doing it tbh, but it works fine.
commit 2637d9b77a6e696face0851328c5bd2e80d1dab2
Author: fef <owo@fef.moe>
Date: Sun Dec 4 08:47:24 2022 +0000
also disable reaction buttons in vanilla flavour
commit 0b4d5f700b74c0a6c8344321e491082511128f48
Author: fef <owo@fef.moe>
Date: Sat Dec 3 16:55:37 2022 +0000
disable reaction button when not signed in
commit afd0bb2c05be38477df1a808b32cece5c7e4b416
Author: fef <owo@fef.moe>
Date: Sat Dec 3 16:20:29 2022 +0000
fix image for new custom emoji reactions
commit b1dcd0eb6ce2f097fab310cdf32cd509426fcfba
Author: fef <owo@fef.moe>
Date: Sat Dec 3 14:23:55 2022 +0000
run i18n-tasks normalize
commit e4e7837bf30082185b2f14e8d60741261f7085f4
Author: fef <owo@fef.moe>
Date: Sat Dec 3 11:57:00 2022 +0000
display external custom emoji reactions properly
Using an emoji map was completely unnecessary in
the first place, because the reaction list from
the API response includes URLs for every custom
emoji anyway. The reaction list now also contains
a boolean field indicating whether it is an
external custom emoji, which is required because
people should only be able to react with Unicode
emojis and local custom ones, not with custom
emojis from other servers.
commit 6d3e364fa22370ab80f16a311dce15d93976464a
Author: fef <owo@fef.moe>
Date: Sat Dec 3 10:22:15 2022 +0000
handle incoming custom emoji reactions properly
commit 0a47a05905adc3e9d1dc1e7e619891b884b9e512
Author: fef <owo@fef.moe>
Date: Sat Dec 3 08:24:23 2022 +0000
support Undo action for EmojiReaction
commit b81f4537aced99e427cb30fd54a33c852839e08a
Author: fef <owo@fef.moe>
Date: Fri Dec 2 17:02:06 2022 +0000
download remote custom emojis from reactions
Emoji reactions containing custom emojis from
remote instances were assumed to already have
been downloaded and stored in the database.
This might obviously not be the case.
commit ff246bda3731753f58f7e499aae036c331953d0b
Author: fef <owo@fef.moe>
Date: Fri Dec 2 10:17:59 2022 +0000
fix integer cast bug
Gotta love Rails.
commit 40a645aab9e8071698051751d88262bb9e10199a
Author: fef <owo@fef.moe>
Date: Fri Dec 2 09:37:56 2022 +0000
sanitize setting for number of visible reactions
This is kind of a hack, but the lack of
validation for settings unfortunately makes it
necessary.
commit 391c6e22f2170f990d30d975c4a5ffb966484c17
Author: Jeremy Kescher <jeremy@kescher.at>
Date: Fri Dec 2 08:05:10 2022 +0100
Add reaction limit to instance serializer
commit 501ae9e2e1578ef80709ff38910dc46f483c5942
Author: fef <owo@fef.moe>
Date: Fri Dec 2 01:52:59 2022 +0000
fix padding on posts without reactions
The margins of the elements above and below the
main reaction list element overlapped before
reactions were added. Adding display: none to
empty reaction bars restores this exact look.
commit 956edd3ca7cd04a3524addc2c5b6ddc475358734
Author: fef <owo@fef.moe>
Date: Fri Dec 2 01:00:08 2022 +0000
rename nop handler to handleNoOp
This also adds the comment in action_bar.js to
status_action_bar.js, clarifying that a future
version could improve this code by modifying
EmojiPickerDropdown.
commit 2c93f1840f6cc74eef628b370b2c7b8485028cc8
Author: fef <owo@fef.moe>
Date: Thu Dec 1 23:30:39 2022 +0100
cleanup JS imports and other minor stuff
commit 4a2f91e3de2dfdb53e1a3f09430c6e0eabbf49be
Author: fef <owo@fef.moe>
Date: Thu Dec 1 04:26:13 2022 +0000
remove unnecessary parameter
commit 91d26c871786708f8c2c0188f82318ff2c438127
Author: fef <owo@fef.moe>
Date: Thu Dec 1 02:24:08 2022 +0000
change reaction api to match other interactions
Status reactions had an API similar to that of
announcement reactions, using PUT and DELETE at a
single endpoint. I believe that for statuses, it
makes more sense to follow the convention of the
other interactions and use separate POST endpoints
for create and destroy respectively.
commit c74e050e3d77920000d7226ae26966d27291e790
Author: fef <owo@fef.moe>
Date: Thu Dec 1 01:41:47 2022 +0000
fix reaction deletion bug and clean up controller
Turns out the strange error where it would delete
the wrong reaction occurred because I forgot to
pass the emoji name to the query, which resulted
in the database deleting the first reaction it
found. Also, this removes the unused set_reaction
callback and includes the Authorization module for
the status reactions controller.
commit e7ed7e37d7995d4bf39ad44c7a738290c81fa9dc
Author: fef <owo@fef.moe>
Date: Wed Nov 30 19:29:56 2022 +0000
remove outdated comments
commit d33f8330c019898f948334453b75fc2802fab9f8
Author: fef <owo@fef.moe>
Date: Wed Nov 30 17:09:16 2022 +0000
clean up new imports in vanilla flavour
commit 45f803e23f019dbe5246daa3131548acdb99a757
Author: fef <owo@fef.moe>
Date: Wed Nov 30 17:25:36 2022 +0100
rebase with upstream
commit 8b339e4a2d2632a269dccdba1a60e69b6b38a053
Author: fef <owo@fef.moe>
Date: Wed Nov 30 14:59:37 2022 +0000
make number of visible reactions a vanilla setting
Reactions will be backported to the vanilla
flavour, which requires all related settings to
be accessible from the vanilla settings page
rather than the glitch specific settings modal.
commit 56323209b519a90f9dbf10b1c45a320de4d6aaa5
Author: fef <owo@fef.moe>
Date: Wed Nov 30 13:20:20 2022 +0000
make number of displayed reactions a setting
This adds an extra item to the local settings for
specifying the number of reactions shown in toots.
The detailed status view always shows all
reactions.
commit e96fb97770877749b5c6bca8fe3e6136fffa309a
Author: fef <owo@fef.moe>
Date: Wed Nov 30 12:01:34 2022 +0000
change default reaction limit to 1
commit 30ae2ad2612bae2abb48c49205bbe71b97435dda
Author: fef <owo@fef.moe>
Date: Wed Nov 30 09:06:14 2022 +0000
limit number of reactions displayed
Too many reactions on a single post quickly get
spammy, so they are now sorted by count and only
the first MAX_REACTIONS number of different
emojis are actually displayed.
commit 84fb0f3cc252cabfa374b31f8a34e021a3ad8677
Author: fef <owo@fef.moe>
Date: Tue Nov 29 09:07:10 2022 +0000
fix reaction margins and paddings
commit 53b685ff1d4589915655da5cafa3a2dd9ee06a51
Author: fef <owo@fef.moe>
Date: Tue Nov 29 08:54:35 2022 +0000
cleanup frontend emoji reaction code
commit 2b0a474a73a84a3e841ddf44854fa5c2e0681a0f
Author: fef <owo@fef.moe>
Date: Tue Nov 29 08:15:52 2022 +0000
cleanup backend emoji reaction code
commit 3bfd5ceba17c42bee27ff0f10514332caa814332
Author: fef <owo@fef.moe>
Date: Tue Nov 29 06:25:43 2022 +0000
fix padding for reaction button
commit deabc28e182acc208bffe6fb57430b97c5bc7c6c
Author: fef <owo@fef.moe>
Date: Tue Nov 29 05:21:53 2022 +0000
handle misskey reactions properly
misskey federates emoji reactions as likes.
commit 4d47b9929852493b208fdf13dee38e27dde50b8c
Author: fef <owo@fef.moe>
Date: Tue Nov 29 04:37:44 2022 +0000
move react button to action bar
commit 151bcea7d4497086823adc0bca6c674ea78a8d8f
Author: fef <owo@fef.moe>
Date: Tue Nov 29 04:31:22 2022 +0100
cherry-pick emoji reaction changes
commit f150fd0dc8761c2a992875948a2736244e5f7076
Author: fef <owo@fef.moe>
Date: Tue Nov 29 00:39:40 2022 +0000
make frontend fetch reaction limit
the maximum number of reactions was previously
hardcoded to 8. this commit also fixes an
incorrect query in StatusReactionValidator where
it didn't count per-user reactions but the total
amount of different ones.
commit 12886aa19ae5be6c7077ff1704b1b4c75c15eae6
Author: fef <owo@fef.moe>
Date: Mon Nov 28 23:16:56 2022 +0000
make status reaction count limit configurable
commit 25806c568a57e9193b43427df80b60a88143a5eb
Author: fef <owo@fef.moe>
Date: Mon Nov 28 22:25:12 2022 +0000
remove accidentally created file
commit f3784cfef551ad1d9d0df0001b2b480bfc656b14
Author: fef <owo@fef.moe>
Date: Mon Nov 28 22:23:13 2022 +0000
federate emoji reactions
this is kind of experimental, but it should work
in theory. at least i tested it with a remove
akkoma instance and it didn't crash.
commit d32f3f8c2fb9e8a29e676e54c98d2cac85841728
Author: fef <owo@fef.moe>
Date: Fri Nov 25 23:02:40 2022 +0000
show reactions in detailed status view
commit 5e9bbb0be253b5b56c6d7b5ee8d843f401995b7c
Author: fef <owo@fef.moe>
Date: Thu Nov 24 17:30:52 2022 +0000
add frontend for emoji reactions
this is still pretty bare bones but hey, it works.
commit 85756b572a169857a09d7668ce9f2c856ebefd27
Author: fef <owo@fef.moe>
Date: Thu Nov 24 11:50:32 2022 +0000
add backend support for status emoji reactions
turns out we can just reuse the code for
announcement reactions.
This commit is contained in:
parent
eeee52b6c8
commit
7868fead64
10 changed files with 83 additions and 7 deletions
|
@ -122,6 +122,10 @@ class StatusActionBar extends ImmutablePureComponent {
|
|||
this.props.onReactionAdd(this.props.status.get('id'), data.native.replace(/:/g, ''), data.imageUrl);
|
||||
}
|
||||
|
||||
handleEmojiPick = data => {
|
||||
this.props.onReactionAdd(this.props.status.get('id'), data.native.replace(/:/g, ''), data.imageUrl);
|
||||
}
|
||||
|
||||
handleReblogClick = e => {
|
||||
const { signedIn } = this.context.identity;
|
||||
|
||||
|
@ -205,6 +209,8 @@ class StatusActionBar extends ImmutablePureComponent {
|
|||
|
||||
handleNoOp = () => {} // hack for reaction add button
|
||||
|
||||
handleNoOp = () => {} // hack for reaction add button
|
||||
|
||||
render () {
|
||||
const { status, intl, withDismiss, withCounters, showReplyCount, scrollKey } = this.props;
|
||||
const { permissions } = this.context.identity;
|
||||
|
|
|
@ -390,7 +390,7 @@ class EmojiPickerDropdown extends React.PureComponent {
|
|||
/>}
|
||||
</div>
|
||||
|
||||
<Overlay show={active} placement={'bottom'} target={this.findTarget} popperConfig={{ strategy: 'fixed' }}>
|
||||
<Overlay show={active} placement={'bottom'} flip target={this.findTarget} popperConfig={{ strategy: 'fixed' }}>
|
||||
{({ props, placement })=> (
|
||||
<div {...props} style={{ ...props.style, width: 299 }}>
|
||||
<div className={`dropdown-animation ${placement}`}>
|
||||
|
|
|
@ -179,6 +179,28 @@ export default class Notification extends ImmutablePureComponent {
|
|||
unread={this.props.unread}
|
||||
/>
|
||||
);
|
||||
case 'reaction':
|
||||
return (
|
||||
<StatusContainer
|
||||
containerId={notification.get('id')}
|
||||
hidden={hidden}
|
||||
id={notification.get('status')}
|
||||
account={notification.get('account')}
|
||||
prepend='reaction'
|
||||
muted
|
||||
notification={notification}
|
||||
onMoveDown={onMoveDown}
|
||||
onMoveUp={onMoveUp}
|
||||
onMention={onMention}
|
||||
getScrollPosition={getScrollPosition}
|
||||
updateScrollBottom={updateScrollBottom}
|
||||
cachedMediaWidth={this.props.cachedMediaWidth}
|
||||
cacheMediaWidth={this.props.cacheMediaWidth}
|
||||
onUnmount={this.props.onUnmount}
|
||||
withDismiss
|
||||
unread={this.props.unread}
|
||||
/>
|
||||
);
|
||||
case 'reblog':
|
||||
return (
|
||||
<StatusContainer
|
||||
|
|
|
@ -85,6 +85,10 @@ class ActionBar extends React.PureComponent {
|
|||
this.props.onReactionAdd(this.props.status.get('id'), data.native.replace(/:/g, ''), data.imageUrl);
|
||||
}
|
||||
|
||||
handleEmojiPick = data => {
|
||||
this.props.onReactionAdd(this.props.status.get('id'), data.native.replace(/:/g, ''), data.imageUrl);
|
||||
}
|
||||
|
||||
handleBookmarkClick = (e) => {
|
||||
this.props.onBookmark(this.props.status, e);
|
||||
};
|
||||
|
@ -147,6 +151,8 @@ class ActionBar extends React.PureComponent {
|
|||
|
||||
handleNoOp = () => {} // hack for reaction add button
|
||||
|
||||
handleNoOp = () => {} // hack for reaction add button
|
||||
|
||||
render () {
|
||||
const { status, intl } = this.props;
|
||||
const { signedIn, permissions } = this.context.identity;
|
||||
|
|
|
@ -311,6 +311,19 @@ class Status extends ImmutablePureComponent {
|
|||
this.props.dispatch(removeReaction(statusId, name));
|
||||
}
|
||||
|
||||
handleReactionAdd = (statusId, name, url) => {
|
||||
const { dispatch } = this.props;
|
||||
const { signedIn } = this.context.identity;
|
||||
|
||||
if (signedIn) {
|
||||
dispatch(addReaction(statusId, name, url));
|
||||
}
|
||||
}
|
||||
|
||||
handleReactionRemove = (statusId, name) => {
|
||||
this.props.dispatch(removeReaction(statusId, name));
|
||||
}
|
||||
|
||||
handlePin = (status) => {
|
||||
if (status.get('pinned')) {
|
||||
this.props.dispatch(unpin(status));
|
||||
|
|
|
@ -383,6 +383,10 @@
|
|||
.reactions-bar--empty {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.reactions-bar--empty {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
.notification-favourite {
|
||||
|
|
|
@ -135,6 +135,10 @@ class StatusActionBar extends ImmutablePureComponent {
|
|||
this.props.onReactionAdd(this.props.status.get('id'), data.native.replace(/:/g, ''), data.imageUrl);
|
||||
}
|
||||
|
||||
handleEmojiPick = data => {
|
||||
this.props.onReactionAdd(this.props.status.get('id'), data.native.replace(/:/g, ''), data.imageUrl);
|
||||
}
|
||||
|
||||
handleReblogClick = e => {
|
||||
const { signedIn } = this.context.identity;
|
||||
|
||||
|
@ -240,6 +244,8 @@ class StatusActionBar extends ImmutablePureComponent {
|
|||
|
||||
handleNoOp = () => {} // hack for reaction add button
|
||||
|
||||
handleNoOp = () => {} // hack for reaction add button
|
||||
|
||||
render () {
|
||||
const { status, relationship, intl, withDismiss, withCounters, scrollKey } = this.props;
|
||||
const { signedIn, permissions } = this.context.identity;
|
||||
|
|
|
@ -99,6 +99,10 @@ class ActionBar extends React.PureComponent {
|
|||
this.props.onReactionAdd(this.props.status.get('id'), data.native.replace(/:/g, ''));
|
||||
}
|
||||
|
||||
handleEmojiPick = data => {
|
||||
this.props.onReactionAdd(this.props.status.get('id'), data.native.replace(/:/g, ''));
|
||||
}
|
||||
|
||||
handleBookmarkClick = (e) => {
|
||||
this.props.onBookmark(this.props.status, e);
|
||||
};
|
||||
|
@ -189,6 +193,8 @@ class ActionBar extends React.PureComponent {
|
|||
|
||||
handleNoOp = () => {} // hack for reaction add button
|
||||
|
||||
handleNoOp = () => {} // hack for reaction add button
|
||||
|
||||
render () {
|
||||
const { status, relationship, intl } = this.props;
|
||||
const { signedIn, permissions } = this.context.identity;
|
||||
|
|
|
@ -270,6 +270,19 @@ class Status extends ImmutablePureComponent {
|
|||
this.props.dispatch(removeReaction(statusId, name));
|
||||
}
|
||||
|
||||
handleReactionAdd = (statusId, name, url) => {
|
||||
const { dispatch } = this.props;
|
||||
const { signedIn } = this.context.identity;
|
||||
|
||||
if (signedIn) {
|
||||
dispatch(addReaction(statusId, name, url));
|
||||
}
|
||||
}
|
||||
|
||||
handleReactionRemove = (statusId, name) => {
|
||||
this.props.dispatch(removeReaction(statusId, name));
|
||||
}
|
||||
|
||||
handlePin = (status) => {
|
||||
if (status.get('pinned')) {
|
||||
this.props.dispatch(unpin(status));
|
||||
|
|
|
@ -20,13 +20,13 @@ class Notification < ApplicationRecord
|
|||
include Paginable
|
||||
|
||||
LEGACY_TYPE_CLASS_MAP = {
|
||||
'Mention' => :mention,
|
||||
'Status' => :reblog,
|
||||
'Follow' => :follow,
|
||||
'FollowRequest' => :follow_request,
|
||||
'Favourite' => :favourite,
|
||||
'Mention' => :mention,
|
||||
'Status' => :reblog,
|
||||
'Follow' => :follow,
|
||||
'FollowRequest' => :follow_request,
|
||||
'Favourite' => :favourite,
|
||||
'StatusReaction' => :reaction,
|
||||
'Poll' => :poll,
|
||||
'Poll' => :poll,
|
||||
}.freeze
|
||||
|
||||
TYPES = %i(
|
||||
|
|
Loading…
Reference in a new issue