about summary refs log tree commit diff
path: root/app/models/web
AgeCommit message (Collapse)Author
2021-04-15Add `policy` param to `POST /api/v1/push/subscriptions` (#16040)Eugen Rochko
With possible values `all`, `followed`, `follower`, and `none`, control from whom notifications will generate a Web Push alert
2021-04-12Change Web Push API deliveries to use request pooling (#16014)Eugen Rochko
2020-05-12Bump doorkeeper from 5.3.3 to 5.4.0 (#13733)dependabot-preview[bot]
* Bump doorkeeper from 5.3.3 to 5.4.0 Bumps [doorkeeper](https://github.com/doorkeeper-gem/doorkeeper) from 5.3.3 to 5.4.0. - [Release notes](https://github.com/doorkeeper-gem/doorkeeper/releases) - [Changelog](https://github.com/doorkeeper-gem/doorkeeper/blob/master/CHANGELOG.md) - [Commits](https://github.com/doorkeeper-gem/doorkeeper/compare/v5.3.3...v5.4.0) Signed-off-by: dependabot-preview[bot] <support@dependabot.com> * Fix tests * Fix use of Doorkeeper::AccessToken.find_or_create_for * Fix tests? Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> Co-authored-by: Thibaut Girka <thib@sitedethib.com>
2019-09-27Validate Web::PushSubscription (#11971)abcang
2018-12-17Do no retry web push workers if the server returns a 4xx response (#9434)Eugen Rochko
Add timeout of 10s to web push requests
2018-06-09Fix has_one association on Web::PushSubscription (#7767)Eugen Rochko
* Fix has_one association on Web::PushSubscription * Fix code style issues
2018-05-19Ensure push subscription is immediately removed when application is revoked ↵Eugen Rochko
(#7548) * Ensure push subscription is immediately removed when application is revoked * When token is revoked from app, unsubscribe too
2018-05-19Improve payload format of Web Push API now that it's open (#7521)Eugen Rochko
> Good lord what is happening in there Previously the contents of the Web Push API payloads closely resembled the structure of JavaScript's [Notification](https://developer.mozilla.org/en-US/docs/Web/API/Notification). But now that the API is open to non-browser apps, and given that there is no required coupling between contents of the payload and a Notification object, here is how I changed the payload: ```json { "access_token": "...", "preferred_locale": "en", "notification_id": "12345", "notification_type": "follow", "title": "So and so followed you", "body": "This is my bio", "icon": "https://example.com/avatar.png" } ``` The title, body and icon attributes are included as a fallback so you can construct a minimal notification if you cannot perform a network request to the API to get more data.
2018-05-11Add REST API for Web Push Notifications subscriptions (#7445)Eugen Rochko
- POST /api/v1/push/subscription - PUT /api/v1/push/subscription - DELETE /api/v1/push/subscription - New OAuth scope: "push" (required for the above methods)
2018-04-23Update dependencies for Ruby (2018-04-23) (#7237)Yamagishi Kazutoshi
* Update annotate to version 2.7.3 * Update aws-sdk-s3 to version 1.9.2 * Update browser to version 2.5.3 * Update capistrano to version 3.10.2 * Update domain_name to version 0.5.20180417 * Update http to version 3.2.0 * Update lograge to version 0.10.0 * Update oj to version 3.5.1 * Update parallel_tests to version 2.21.3 * Update puma to version 3.11.4 * Update rubocop to version 0.55.0 * Update scss_lint to version 0.57.0 * Update simplecov to version 0.16.1 * Update tty-command to version 0.8.0 * Update tty-prompt to version 0.16.0 * Update pkg-config to version 1.3.0 * Update fog-local to version 0.5.0 * Update fog-openstack to version 0.1.25 * Update devise-two-factor to version 3.0.3 * bundle update
2018-02-07Change user_id column non-nullable (#6435)Akihiko Odaki
2017-11-18Lists (#5703)Eugen Rochko
* Add structure for lists * Add list timeline streaming API * Add list APIs, bind list-account relation to follow relation * Add API for adding/removing accounts from lists * Add pagination to lists API * Add pagination to list accounts API * Adjust scopes for new APIs - Creating and modifying lists merely requires "write" scope - Fetching information about lists merely requires "read" scope * Add test for wrong user context on list timeline * Clean up tests
2017-11-17Fix some rubocop style issues (#5730)Eugen Rochko
2017-11-12Update model annotations to use BIGINT for IDs (#5461)Daniel Hunsaker
All the migrations have been updated to use BIGINTs for ID fields in the DB, but ActiveRecord needs to be told to treat those values as BIGINT as well. This PR does that.
2017-10-02Make IdsToBigints (mostly!) non-blocking (#5088)aschmitz
* Make IdsToBigints (mostly!) non-blocking This pulls in GitLab's MigrationHelpers, which include code to make column changes in ways that Postgres can do without locking. In general, this involves creating a new column, adding an index and any foreign keys as appropriate, adding a trigger to keep it populated alongside the old column, and then progressively copying data over to the new column, before removing the old column and replacing it with the new one. A few changes to GitLab's MigrationHelpers were necessary: * Some changes were made to remove dependencies on other GitLab code. * We explicitly wait for index creation before forging ahead on column replacements. * We use different temporary column names, to avoid running into index name length limits. * We rename the generated indices back to what they "should" be after replacing columns. * We rename the generated foreign keys to use the new column names when we had to create them. (This allows the migration to be rolled back without incident.) # Big Scary Warning There are two things here that may trip up large instances: 1. The change for tables' "id" columns is not concurrent. In particular, the stream_entries table may be big, and does not concurrently migrate its id column. (On the other hand, x_id type columns are all concurrent.) 2. This migration will take a long time to run, *but it should not lock tables during that time* (with the exception of the "id" columns as described above). That means this should probably be run in `screen` or some other session that can be run for a long time. Notably, the migration will take *longer* than it would without these changes, but the website will still be responsive during that time. These changes were tested on a relatively large statuses table (256k entries), and the service remained responsive during the migration. Migrations both forward and backward were tested. * Rubocop fixes * MigrationHelpers: Support ID columns in some cases This doesn't work in cases where the ID column is referred to as a foreign key by another table. * MigrationHelpers: support foreign keys for ID cols Note that this does not yet support foreign keys on non-primary-key columns, but Mastodon also doesn't yet have any that we've needed to migrate. This means we can perform fully "concurrent" migrations to change ID column types, and the IdsToBigints migration can happen with effectively no downtime. (A few operations require a transaction, such as renaming columns or deleting them, but these transactions should not block for noticeable amounts of time.) The algorithm for generating foreign key names has changed with this, and therefore all of those changed in schema.rb. * Provide status, allow for interruptions The MigrationHelpers now allow restarting the rename of a column if it was interrupted, by removing the old "new column" and re-starting the process. Along with this, they now provide status updates on the changes which are happening, as well as indications about when the changes can be safely interrupted (when there are at least 10 seconds estimated to be left before copying data is complete). The IdsToBigints migration now also sorts the columns it migrates by size, starting with the largest tables. This should provide administrators a worst-case scenario estimate for the length of migrations: each successive change will get faster, giving admins a chance to abort early on if they need to run the migration later. The idea is that this does not force them to try to time interruptions between smaller migrations. * Fix column sorting in IdsToBigints Not a significant change, but it impacts the order of columns in the database and db/schema.rb. * Actually pause before IdsToBigints
2017-09-02Fix WebPush (regression from #4524) (#4778)unarist
* Fix NoMethodError in Web::PushSubscription ``` undefined method `site_contact_email' for #<Class:0x00005976d13c40> /usr/local/bundle/gems/activerecord-5.1.3/lib/active_record/dynamic_matchers.rb:22:in `method_missing' /usr/local/bundle/gems/attr_encrypted-3.0.3/lib/attr_encrypted.rb:295:in `method_missing' /usr/local/bundle/gems/attr_encrypted-3.0.3/lib/attr_encrypted/adapters/active_record.rb:129:in `method_missing_with_attr_encrypted' /mastodon/app/models/web/push_subscription.rb:53:in `push_payload' ``` * Specify serializer in Web::NotificationSerializer
2017-09-01Refactor Web::PushSubscription, remove welcome message (#4524)Eugen Rochko
* Refactor Web::PushSubscription, remove welcome message * Add missing helper * Use locale of the receiver on push notifications (#4519) * Remove unused translations * Fix dir on notifications
2017-08-01fix(web_push_notifications): Send message with welcome notifications (#4471)Sorin Davidoi
* fix(web_push_notifications): Send grouping title in welcome notification * fix(web_push_notifications): Read message from last notification
2017-07-28Fix web push notifications "boost" icon not being loaded (regression from ↵Eugen Rochko
#4426) (#4431)
2017-07-28Use consistent icons for web push notifications, same as web UI (#4426)Eugen Rochko
2017-07-28feat(web_push_notifications): Group notifications (#4388)Sorin Davidoi
2017-07-27fix(push_subscription): Use star icon for favourite action (#4396)Sorin Davidoi
2017-07-19fix(push_subscription): Guard against malformed favourite notification (#4271)Sorin Davidoi
2017-07-19Fix deprecation warning for non-pipeline assets (#4267)Eugen Rochko
2017-07-18fix(push-subscriptions): Refactor how Sidekiq jobs are handled (#4226)Sorin Davidoi
2017-07-13Web Push Notifications (#3243)Sorin Davidoi
* feat: Register push subscription * feat: Notify when mentioned * feat: Boost, favourite, reply, follow, follow request * feat: Notification interaction * feat: Handle change of public key * feat: Unsubscribe if things go wrong * feat: Do not send normal notifications if push is enabled * feat: Focus client if open * refactor: Move push logic to WebPushSubscription * feat: Better title and body * feat: Localize messages * chore: Fix lint errors * feat: Settings * refactor: Lazy load * fix: Check if push settings exist * feat: Device-based preferences * refactor: Simplify logic * refactor: Pull request feedback * refactor: Pull request feedback * refactor: Create /api/web/push_subscriptions endpoint * feat: Spec PushSubscriptionController * refactor: WebPushSubscription => Web::PushSubscription * feat: Spec Web::PushSubscription * feat: Display first media attachment * feat: Support direction * fix: Stuff broken while rebasing * refactor: Integration with session activations * refactor: Cleanup * refactor: Simplify implementation * feat: Set VAPID keys via environment * chore: Comments * fix: Crash when no alerts * fix: Set VAPID keys in testing environment * fix: Follow link * feat: Notification actions * fix: Delete previous subscription * chore: Temporary logs * refactor: Move migration to a later date * fix: Fetch the correct session activation and misc bugs * refactor: Move migration to a later date * fix: Remove follow request (no notifications) * feat: Send administrator contact to push service * feat: Set time-to-live * fix: Do not show sensitive images * fix: Reducer crash in error handling * feat: Add badge * chore: Fix lint error * fix: Checkbox label overlap * fix: Check for payload support * fix: Rename action "type" (crash in latest Chrome) * feat: Action to expand notification * fix: Lint errors * fix: Unescape notification body * fix: Do not allow boosting if the status is hidden * feat: Add VAPID keys to the production sample environment * fix: Strip HTML tags from status * refactor: Better error messages * refactor: Handle browser not implementing the VAPID protocol (Samsung Internet) * fix: Error when target_status is nil * fix: Handle lack of image * fix: Delete reference to invalid subscriptions * feat: Better error handling * fix: Unescape HTML characters after tags are striped * refactor: Simpify code * fix: Modify to work with #4091 * Sort strings alphabetically * i18n: Updated Polish translation it annoys me that it's not fully localized :P * refactor: Use current_session in PushSubscriptionController * fix: Rebase mistake * fix: Set cacheName to mastodon * refactor: Pull request feedback * refactor: Remove logging statements * chore(yarn): Fix conflicts with master * chore(yarn): Copy latest from master * chore(yarn): Readd offline-plugin * refactor: Use save! and update! * refactor: Send notifications async * fix: Allow retry when push fails * fix: Save track for failed pushes * fix: Minify sw.js * fix: Remove account_id from fabricator
2017-05-02annotate models (#2697)yhirano
* add annotate to Gemfile * rails g annotate:install * configure annotate_models * add schema info to models * fix rubocop to add frozen_string_literal
2017-01-09Persist UI settings, add missing localizations for GermanEugen Rochko