Skip to content

Commit 4f6a53c

Browse files
Merge pull request #3415 from ClearlyClaire/glitch-soc/merge-4.5
Merge upstream changes up to 96a96a7 into stable-4.5
2 parents ffddcc7 + 93eb2ac commit 4f6a53c

File tree

33 files changed

+261
-90
lines changed

33 files changed

+261
-90
lines changed

app/controllers/api/fasp/base_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def validate_signature!
4747
provider = nil
4848

4949
Linzer.verify!(request.rack_request, no_older_than: 5.minutes) do |keyid|
50-
provider = Fasp::Provider.find(keyid)
50+
provider = Fasp::Provider.confirmed.find(keyid)
5151
Linzer.new_ed25519_public_key(provider.provider_public_key_pem, keyid)
5252
end
5353

app/helpers/json_ld_helper.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,10 @@ def supported_context?(json)
7070
!json.nil? && equals_or_includes?(json['@context'], ActivityPub::TagManager::CONTEXT)
7171
end
7272

73+
def supported_security_context?(json)
74+
!json.nil? && equals_or_includes?(json['@context'], 'https://w3id.org/security/v1')
75+
end
76+
7377
def unsupported_uri_scheme?(uri)
7478
uri.nil? || !uri.start_with?('http://', 'https://')
7579
end

app/javascript/flavours/glitch/actions/statuses.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,14 +109,15 @@ export function fetchStatusFail(id, error, skipLoading, parentQuotePostId) {
109109
};
110110
}
111111

112-
export function redraft(status, raw_text, content_type) {
112+
export function redraft(status, raw_text, content_type, quoted_status_id = null) {
113113
return (dispatch, getState) => {
114114
const maxOptions = getState().server.getIn(['server', 'configuration', 'polls', 'max_options']);
115115

116116
dispatch({
117117
type: REDRAFT,
118118
status,
119119
raw_text,
120+
quoted_status_id,
120121
content_type,
121122
maxOptions,
122123
});
@@ -135,7 +136,7 @@ export const editStatus = (id) => (dispatch, getState) => {
135136
api().get(`/api/v1/statuses/${id}/source`).then(response => {
136137
dispatch(fetchStatusSourceSuccess());
137138
ensureComposeIsVisible(getState);
138-
dispatch(setComposeToStatus(status, response.data.text, response.data.spoiler_text, response.data.content_type));
139+
dispatch(setComposeToStatus(status, response.data.text, response.data.spoiler_text, response.data.content_type, response.data.quote?.quoted_status?.id));
139140
}).catch(error => {
140141
dispatch(fetchStatusSourceFail(error));
141142
});

app/javascript/flavours/glitch/features/emoji/loader.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,19 @@ export async function importEmojiData(localeString: string, path?: string) {
2121
path ??= await localeToPath(locale);
2222
}
2323

24+
// Fix from #37858. Check if we've loaded this path before.
25+
const existing = await loadLatestEtag(locale);
26+
if (existing === path) {
27+
return null;
28+
}
29+
2430
const emojis = await fetchAndCheckEtag<CompactEmoji[]>(locale, path);
2531
if (!emojis) {
2632
return;
2733
}
34+
35+
await putLatestEtag(path, locale); // Fix from #37858. Put the path as the ETag to ensure we don't load the same data again.
36+
2837
const flattenedEmojis: FlatCompactEmoji[] = flattenEmojiData(emojis);
2938
await putEmojiData(flattenedEmojis, locale);
3039
return flattenedEmojis;

app/javascript/flavours/glitch/reducers/compose.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -646,7 +646,7 @@ export const composeReducer = (state = initialState, action) => {
646646
map => map.merge(new ImmutableMap({ do_not_federate })),
647647
);
648648
map.set('id', null);
649-
map.set('quoted_status_id', action.status.getIn(['quote', 'quoted_status'], null));
649+
map.set('quoted_status_id', action.quoted_status_id);
650650
// Mastodon-authored posts can be expected to have at most one automatic approval policy
651651
map.set('quote_policy', action.status.getIn(['quote_approval', 'automatic', 0]) || 'nobody');
652652

app/javascript/mastodon/actions/statuses.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,14 +109,15 @@ export function fetchStatusFail(id, error, skipLoading, parentQuotePostId) {
109109
};
110110
}
111111

112-
export function redraft(status, raw_text) {
112+
export function redraft(status, raw_text, quoted_status_id = null) {
113113
return (dispatch, getState) => {
114114
const maxOptions = getState().server.getIn(['server', 'configuration', 'polls', 'max_options']);
115115

116116
dispatch({
117117
type: REDRAFT,
118118
status,
119119
raw_text,
120+
quoted_status_id,
120121
maxOptions,
121122
});
122123
};
@@ -169,7 +170,7 @@ export function deleteStatus(id, withRedraft = false) {
169170
dispatch(importFetchedAccount(response.data.account));
170171

171172
if (withRedraft) {
172-
dispatch(redraft(status, response.data.text));
173+
dispatch(redraft(status, response.data.text, response.data.quote?.quoted_status?.id));
173174
ensureComposeIsVisible(getState);
174175
} else {
175176
dispatch(showAlert({ message: messages.deleteSuccess }));

app/javascript/mastodon/features/emoji/loader.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,19 @@ export async function importEmojiData(localeString: string, path?: string) {
2121
path ??= await localeToPath(locale);
2222
}
2323

24+
// Fix from #37858. Check if we've loaded this path before.
25+
const existing = await loadLatestEtag(locale);
26+
if (existing === path) {
27+
return null;
28+
}
29+
2430
const emojis = await fetchAndCheckEtag<CompactEmoji[]>(locale, path);
2531
if (!emojis) {
2632
return;
2733
}
34+
35+
await putLatestEtag(path, locale); // Fix from #37858. Put the path as the ETag to ensure we don't load the same data again.
36+
2837
const flattenedEmojis: FlatCompactEmoji[] = flattenEmojiData(emojis);
2938
await putEmojiData(flattenedEmojis, locale);
3039
return flattenedEmojis;

app/javascript/mastodon/reducers/compose.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -530,7 +530,7 @@ export const composeReducer = (state = initialState, action) => {
530530
map.set('sensitive', action.status.get('sensitive'));
531531
map.set('language', action.status.get('language'));
532532
map.set('id', null);
533-
map.set('quoted_status_id', action.status.getIn(['quote', 'quoted_status'], null));
533+
map.set('quoted_status_id', action.quoted_status_id);
534534
// Mastodon-authored posts can be expected to have at most one automatic approval policy
535535
map.set('quote_policy', action.status.getIn(['quote_approval', 'automatic', 0]) || 'nobody');
536536

app/lib/fasp/request.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def perform_request(verb, path, body: nil)
2929
response = HTTP
3030
.headers(headers)
3131
.use(http_signature: { key:, covered_components: COVERED_COMPONENTS })
32-
.send(verb, url, body:)
32+
.send(verb, url, body:, socket_class: ::Request::Socket)
3333

3434
validate!(response)
3535
@provider.delivery_failure_tracker.track_success!

app/lib/request.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,5 +349,5 @@ def check_private_address(_address, _host)
349349
end
350350
end
351351

352-
private_constant :ClientLimit, :Socket, :ProxySocket
352+
private_constant :ClientLimit
353353
end

0 commit comments

Comments
 (0)